/** * Curated model catalog (Phase D+): provider -> OpenAI-compatible base URL * resolution for `provider:model` specs stored in Agent.model. * * The authoritative copy + update process live in `docs/agent-models.md`. * This file mirrors the frontend catalog * (`frontend/src/lib/constants/models.ts`) and the docs table — keep all * three in sync (see the docs for the 3-step update process). */ export declare const MODEL_BASE_URLS: Record; /** Provider keys accepted by the catalog (for validation/docs). */ export declare const MODEL_PROVIDERS: string[]; /** Providers that are harness-native (only work via the harness CLI, not --self). */ export declare const HARNESS_NATIVE_PROVIDERS: Set; /** * Default direct-callable vision model for browser auto-answer. `mimo:` maps to * the Xiaomi MiMo token plan (Singapore) endpoint - the plan most users key. */ export declare const DEFAULT_VISION_MODEL = "mimo:mimo-v2.5"; /** Provider slug of a `provider:model` / `provider/model` spec. */ export declare function providerOf(spec: string): string; /** * Resolve a direct API key for a model spec using (in order): an explicit key, * the agent's per-provider BYOK map, the agent's single provider key, the * provider's dedicated env var, then the generic LLM_API_KEY / CHAT_LLM_API_KEY. */ export declare function resolveDirectApiKey(spec: string, providerKeys?: Record | null, providerKey?: string | null): string | null; /** * Resolve an API key for a `provider:model` spec. Precedence: the provider's * dedicated env var (e.g. OPENROUTER_API_KEY) > generic LLM_API_KEY / * CHAT_LLM_API_KEY. Returns null when none is set. */ export declare function resolveApiKeyForProvider(spec: string): string | null; /** Default OpenAI-compatible base when nothing else is configured. */ export declare const DEFAULT_LLM_BASE_URL = "https://api.openai.com/v1"; export interface ResolvedModel { /** Base URL for chat/completions (env LLM_BASE_URL always wins). */ baseUrl: string; /** Model id sent to the API. */ model: string; /** True when the spec was resolved via the catalog (vs raw env default). */ catalogued: boolean; /** True when the model is harness-native (opencode-go) and cannot be used with --self. */ harnessOnly: boolean; } /** * Resolves a model spec to (baseUrl, model): * - `provider:model` (e.g. "gemini:gemini-2.5-flash") -> catalog base URL. * - `provider/model` (e.g. "opencode/x-preview-f-free") -> same, slash form. * - `opencode-go:*` -> harness-only flag (caller must use opencode harness, not --self). * - Anything else (legacy "deepseek-chat") -> env LLM_BASE_URL default, * preserving the pre-catalog behavior. * The provider is whatever precedes the EARLIEST separator (`:` or `/`), so * catalogued ids that themselves contain slashes * ("openrouter:anthropic/claude-...") still resolve correctly. * Precedence for the base URL: LLM_BASE_URL env > catalog provider URL. */ export declare function resolveModel(spec: string, envBaseUrl?: string): ResolvedModel; /** * Resolve a model spec for a DIRECT OpenAI-compatible call (browser * auto-answer). Unlike `resolveModel`, this treats `opencode/*` (Zen) as * direct-callable via the Zen OpenAI-compatible endpoint, and rejects * `opencode-go/*` / `anthropic:*` (harness-only) with a clear error. * A custom `baseUrl` (from the run form) always wins. */ export declare function resolveBrowseModel(spec: string, envBaseUrl?: string, customBaseUrl?: string): { baseUrl: string; model: string; harnessOnly: boolean; }; /** * Get the fallback model for opencode-go providers. * When opencode-go is detected and --self cannot be used, * this returns the agent's configured model or the default harness model. */ export declare function getHarnessFallbackModel(agentModel?: string): string;