/** * The model list for a provider, as one implementation. * * This was inside the TUI component, which meant the browser had no way to get at it and offered * a text field instead — you had to already know the name of the model you wanted to type. The * listing is the same OpenAI-compatible `/models` call either way, so it belongs out here where * both front ends can ask for it. * * A provider that does not implement the endpoint is a normal outcome, not a failure: several * gateways don't, and a virtual model like OmniRoute's `auto/best-coding` is routing instruction * rather than a catalogue entry, so it will never appear in a listing. Both cases are reported as * such so the interface can keep letting you name a model by hand. */ import type { AgentConfig } from './types.js'; import { type ModelInfo } from './usage.js'; /** One row, with everything already worked out that a picker needs to show. */ export interface CatalogEntry { id: string; /** Grouping key, which turns a flat several-hundred-entry list into something scannable. */ vendor: string; /** The annotation line: cost, context, tool support, and how it answered last time. */ detail: string; free: boolean; local: boolean; contextLength?: number; maxOutput?: number; toolCalling?: boolean; /** Whether it accepts images. Undefined means the provider said nothing and the name is silent. */ vision?: boolean; /** What is known about paying for it. Undefined means nothing is, and nothing should be implied. */ cost?: 'free' | 'paid' | 'local'; /** Dollars per million prompt tokens, when the provider published a rate. */ promptRate?: number; state?: string; } export interface Catalog { provider: string; entries: CatalogEntry[]; /** True when the provider answered with a list. False means name it by hand. */ listed: boolean; /** Why the listing is empty, in words, when it is. */ note?: string; /** * The endpoint this list came from — the one resolved for the request, not the provider's * suggested default. The two differ exactly when a misrouted `baseURL` is the problem, which is * the case the header naming a host exists to make visible. */ endpoint: string; } /** * The annotation beside a model name. Shared so the TUI and the browser read alike. * * Nothing here is guessed. The word about money appears only when something is actually known * about it: a rate the provider reported, a name the gateway marked free, or a runtime serving its * own weights and charging nobody. Otherwise the row says nothing about price — which is honest, * and better than the alternative that shipped: every model without a published rate was labelled * "paid", so a list of Ollama models on a LAN box came back as a bill. */ export declare function detailFor(m: ModelInfo, local: boolean, state?: string): string; export { rateText } from './pricing.js'; /** * Asks a provider what it serves. * * Never throws: an unreachable endpoint, a missing credential and an unimplemented route all * come back as an empty catalogue carrying the reason, because every one of them still leaves you * able to type a model name. */ /** * As much of a provider's complaint as is worth reading, cut where a line ends. * * It was cut at 160 characters, which is long enough to hold the diagnosis and not the cure. What * that produced on screen was `export OPENROUTER_API_KEY="$(bw get p` — the message names the * variable to set and then stops halfway through the command that would set it, so the one part * the reader needed was the part removed. A cap still exists, because a provider having a bad day * will return an HTML error page and that should not become the note; but it cuts generously and * only at a line boundary, so a shell command is either shown whole or not shown at all. */ export declare function readable(why: string): string; /** Forgets what an endpoint said, so the next ask is live. For "refresh" and for after a new key. */ export declare function forgetCatalog(provider?: string): void; export declare function listModels(config: AgentConfig, opts?: { fresh?: boolean; }): Promise; /** * The model a provider is configured to use by default, for pre-filling a picker. * * A declared provider may carry its own; otherwise the built-in default stands. */ export declare function defaultModelFor(provider: string): string; /** * The best model in a catalogue for sending a picture to. * * Ordered by what actually matters when a turn has just failed for want of one: it must take * images, it must not be an alias (an alias is what just re-routed), and among those a larger * context beats a smaller one because an image costs a great many tokens. A model already known to * be failing is passed over — being sent to a second dead end is worse than being told there is * none. */ export declare function bestForImages(entries: readonly CatalogEntry[]): CatalogEntry | null; //# sourceMappingURL=model-catalog.d.ts.map