/** * The model catalog behind every OrcaRouter model control in this package. * * ONE SOURCE OF TRUTH, AND IT IS THE LIVE ONE. `GET {apiBase}/models` on the configured OrcaRouter * origin is authoritative whenever it answers. What ships in this file is a five-entry VERIFIED SEED * for a cold start or an outage -- never mixed into a successful live result, because a seed blended * into a live catalog is how a model nobody can call ends up in a dropdown. * * WHY THE FILTERS ARE STRICT AND PER-ENTRY. OrcaRouter routes many providers behind one endpoint, so * the catalog contains models that speak different wire formats. A model that does not declare an * endpoint type this client can speak, or does not declare the input modality an entry point is about * to send, must be absent from that entry point's options rather than present-and-rejected. The rule * everywhere below is fail-closed: an undeclared capability is not an assumed capability. * * NOTHING HERE GUESSES FROM A MODEL NAME. `gpt-` does not imply reasoning support, `-vision` does not * imply image input, and `-embed` does not imply an embeddings endpoint. The only exception is the * seed, whose entries carry metadata verified against the live catalog and are labelled as such. * * BOUNDED ON PURPOSE. A catalog response is remote input that reaches a dropdown, so the request has * a timeout, the body has a byte cap, the array has an item cap, and each item has to match a shape * before it is accepted. A hostile or broken endpoint can therefore make discovery fail, which is * recoverable, rather than exhaust memory, which is not. */ import { type OrcaRouterOrigins } from './endpoints.js'; export declare const CATALOG_TIMEOUT_MS = 10000; export declare const CATALOG_MAX_BYTES: number; export declare const CATALOG_MAX_ITEMS = 500; /** * The endpoint types this client can actually speak. * * The proxy forwards OpenAI- and Anthropic-shaped requests, and the summarizer adapter speaks the * OpenAI chat dialect, so a text model is usable when it declares any of these. `openai-response` is * included because the Responses dialect is a supported client mode here. */ export declare const TEXT_ENDPOINT_TYPES: readonly ["openai", "anthropic", "gemini", "openai-response"]; /** Endpoint types that name a non-text job. Their presence excludes a model from a chat dropdown. */ export declare const NON_TEXT_ENDPOINT_TYPES: readonly ["image-generation", "openai-video", "jina-rerank", "embeddings"]; export type CatalogCapability = 'chat' | 'embedding' | 'image' | 'video' | 'rerank'; export type InputModality = 'text' | 'image' | 'audio' | 'video'; export type ReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh'; export interface CatalogModel { /** The vendor/model namespace, kept byte-for-byte as the catalog reports it. */ readonly id: string; readonly name: string | null; readonly contextLength: number | null; readonly supportedEndpointTypes: readonly string[]; readonly inputModalities: readonly InputModality[]; readonly reasoningEfforts: readonly ReasoningEffort[]; /** True when this entry came from the shipped seed rather than a live response. */ readonly fromSeed: boolean; } export type CatalogStatus = 'live' | 'degraded'; export interface CatalogResult { readonly status: CatalogStatus; /** Why the live catalog was not used, when it was not. Safe to show a user. */ readonly degradedReason: string | null; readonly sourceUrl: string; readonly models: readonly CatalogModel[]; } export interface CatalogRequest { readonly capability: CatalogCapability; /** For a multimodal entry point: the non-text modality it is actually about to send. */ readonly requiresInputModality?: InputModality; readonly signal?: AbortSignal; readonly fetchImpl?: typeof fetch; readonly timeoutMs?: number; } /** * The verified outage seed. * * SMALL AND LABELLED. These five are the entries the protocol guide names, each carrying the metadata * this package uses to filter and to price. `openai/gpt-5.5` keeps the four-step reasoning ladder the * guide calls out, because a fallback that restores a model's name while dropping its effort levels * is a capability regression that an id-only assertion cannot see. */ export declare const VERIFIED_SEED: readonly CatalogModel[]; /** * Accept one catalog record, or reject it. * * Rejects rather than repairs: a record whose `id` is missing cannot be selected, and inventing one * would put a name in the dropdown that no request can use. */ export declare function parseCatalogModel(raw: unknown): CatalogModel | null; /** Does this model declare an endpoint type a text request can be sent to? */ export declare function speaksText(model: CatalogModel): boolean; /** * Is this model usable by the given entry point? * * The `requiresInputModality` branch is the fail-closed one: a chat model with no `architecture` * block at all is excluded from a multimodal dropdown, because "did not say" and "said yes" are not * the same claim and only one of them can be relied on before sending an image. */ export declare function isCompatible(model: CatalogModel, request: Pick): boolean; export declare function filterCatalog(models: readonly CatalogModel[], request: Pick): CatalogModel[]; /** * Fetch the catalog, or fall back to the seed. * * The fallback is never silent: `status` and `degradedReason` travel with the models so the UI can * say it is showing a reduced list, and a caller can refuse to treat a seed as authoritative. */ export declare function fetchCatalog(origins: OrcaRouterOrigins, apiKey: string | null, request: CatalogRequest): Promise; export declare class CatalogError extends Error { constructor(message: string); } /** * Keep a previously selected model id only while it is still offered. * * A stored selection is not a promise: a provider switch, an added attachment or a changed task can * invalidate it, and silently keeping the old value sends a request the user did not choose. The * caller clears the control when this returns null. */ export declare function reconcileSelection(selectedId: string | null, options: readonly CatalogModel[]): CatalogModel | null; //# sourceMappingURL=catalog.d.ts.map