import type { ModelsDevModel, ResolvedProvider } from '../types/models-registry.js'; /** * A model descriptor shaped for the WebUI `provider.models` message. All * metadata fields are optional because OAuth / subscription providers that * models.dev doesn't list contribute only a bare id. */ export interface ProviderModelDescriptor { id: string; name: string; /** One-line capability blurb, when known (e.g. the Codex subscription models). */ description?: string | undefined; releaseDate?: string | undefined; contextWindow?: number | undefined; inputCost?: number | undefined; outputCost?: number | undefined; capabilities: string[]; } /** Map a models.dev catalog model to the WebUI descriptor shape. */ export declare function describeCatalogModel(m: ModelsDevModel): ProviderModelDescriptor; /** * Resolve the model list to offer for a provider, merging a saved-config * allowlist with optional models.dev catalog metadata. * * The result is a **union** of all available sources — the saved allowlist * (if any), the catalog models (base + curated overlay), the sibling * catalog models (e.g. `openai` for `openai-codex`), and the offline Codex * catalog (when `providerHint === 'openai-codex'`). Each source is * deduplicated by model id; the saved allowlist ids appear first so the * user's explicit preferences float to the top. * * Priority: * 1. The saved `models` allowlist (if non-empty) — enriched with catalog * metadata or the offline Codex catalog name+description when a same-id * entry exists. These ids always come first in the result. * 2. Catalog models (base + layered `providers.json` overlay) not already * in the saved list — this ensures the curated overlay is *never* hidden * by a stale saved model list. An empty `[]` saved list (not `undefined`) * still shows the full catalog. * 3. Sibling catalog models (when `siblingCatalog` is provided) — e.g. the * `openai` models from models.dev for `openai-codex` subscribers. Merged * only when the sibling is a different provider from the primary catalog. * 4. Offline Codex catalog (`CODEX_MODELS`) for `openai-codex` — fallback * when both saved list and catalog are empty/unavailable. This guarantees * ChatGPT sign-in users always see the canonical model list even fully * offline. * 5. Otherwise an empty list — *never* an error. A provider the user saved * that is neither in the catalog, the curated overlay, nor the offline * Codex catalog simply has no suggestions yet; callers must not raise a * toast for that case (doing so produced the "not found in catalog" * notification flood when the WebUI model switcher lazy-loaded every * saved provider). */ export declare function resolveProviderModelList(savedModels: string[] | undefined, catalog: ResolvedProvider | undefined, /** * Provider id / wire family the list is being resolved for. Lets the * resolver fall back to a known offline catalog (currently the ChatGPT * `openai-codex` models) when the saved allowlist is empty AND the * models.dev catalog is unavailable — so deleting the models from config * never leaves the provider showing zero models. */ providerHint?: string | undefined, /** * Optional sibling catalog — e.g. the `openai` catalog when resolving * `openai-codex` models. Merged alongside the primary `catalog` so users * of subscription/OAuth providers also see the wire-family models they * may have access to (OpenAI models for ChatGPT Codex subscribers). */ siblingCatalog?: ResolvedProvider | undefined): ProviderModelDescriptor[]; //# sourceMappingURL=provider-model-resolve.d.ts.map