getModelEndpointDecision (services/modelEndpointPolicy.ts)

OmniRoute · open-sse/services/modelEndpointPolicy.ts · typescript · MIT
ai

Determines model endpoint kind and chat selectability based on provider metadata and endpoint lists.

// Source: https://github.com/diegosouzapw/OmniRoute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Provider model endpoint policy.
 *
 * Upstream `/models` responses often omit endpoint/modality metadata. In that
 * case, specialty models can otherwise be imported as chat models simply
 * because "chat" is OmniRoute's historical default. Keep the exceptional
 * provider knowledge here so discovery, import, and catalog projection agree.
 */

export type ModelEndpointKind =
  "chat" | "image" | "video" | "embedding" | "rerank" | "non-chat" | "unknown";

export type ModelEndpointDecision = {
  kind: ModelEndpointKind;
  chatSelectable: boolean;
  reason: "explicit-endpoints" | "provider-policy" | "unclassified";
};

type E

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key