Inventory¶
Methods¶
add_anthropic¶
Register a native Anthropic Messages API provider.
Parameters
args:{name: string, base_url: string?, api_key: string, billing: string?}name— The name used to select this provider on the command line.base_url— Base URL of the Anthropic API. Defaults tohttps://api.anthropic.com; override it for a proxy or gateway.api_key— API key, sent as thex-api-keyheader. Source it fromos.getenv(...)in Lua rather than hard-coding.billing— How the user is billed:"subscription"or"metered"(the default).
add_claude_code¶
Register the Claude Code (subscription) provider.
Parameters
args:{name: string, billing: string?}name— The name used to select this provider on the command line.billing— How the user is billed:"subscription"or"metered"(the default). Claude Code can run under either, and it changes howlist-modelspresents cost, so it is configured rather than assumed.
add_codex¶
Register a subscription-billed Codex provider on the ChatGPT backend.
Parameters
args:{name: string, models: {[integer]: string}?, timeout: string | number?, diagnostics: boolean?}name— The name used to select this provider on the command line.models— The Codex model ids to offer in the picker. Omitted (the default) lists the models the backend reports for the signed-in account.timeout— Maximum inactivity to tolerate while a turn streams, as a number of seconds,"none"to wait indefinitely, or"default"(the default) to use the built-in budget. This budget also bounds how long a rate-limited turn keeps retrying.diagnostics(defaulttrue) — Whether to record per-turn diagnostics for this instance. On by default; setfalseto opt an instance out. Recording also requires the process-wide diagnostics directory to be configured.
add_favourite_models¶
Mark models as favourites, floating them to the top of the /model
picker. Each entry is a provider/model reference (the provider is
required). Accumulates across calls (and across handlers) like the
add_* methods.
Parameters
models:{[integer]: string}
add_ollama¶
Register a native Ollama provider.
Parameters
args:{name: string, base_url: string, api_key: string?, billing: string?, http_keep_alive: boolean?, model_options: {[string]: {num_ctx: number?}}?}name— The name used to select this provider on the command line.base_url— Base URL of the Ollama server, e.g."http://localhost:11434".api_key— Optional API key / bearer token. A bare local Ollama needs none; when set it is sent asAuthorization: Bearer <key>on every request. Source it fromos.getenv(...)in Lua rather than hard-coding.billing— How the user is billed:"subscription"(the default here, since a local Ollama has no per-token cost) or"metered". Affects only the display ofModelInfo.billing; no code path prices an Ollama turn.http_keep_alive(defaulttrue) — Whether to reuse HTTP connections across requests (keep-alive). On by default, which suits a remote endpoint where a fresh connection costs a TCP and TLS handshake. Setfalsefor a server that closes idle connections quickly: reuse then risks sending on a connection the server has already closed, and the per-request handshake it avoids is negligible over a LAN. Distinct from the model keep-alive (how long a model stays resident), which is a per-request concern, not a transport one.model_options— Per-model option overrides, keyed by the model tag verbatim (e.g."llama3.1:8b", with no:latestsynthesis). The highest-precedence source fornum_ctx.
add_openai¶
Register an OpenAI-compatible provider.
Parameters
args:{name: string, base_url: string, api_key: string, billing: string?, timeout: string | number?, diagnostics: boolean?, http_keep_alive: boolean?, model_options: {[string]: {context_window: number?, temperature: number?, top_p: number?, top_k: number?, min_p: number?, presence_penalty: number?, frequency_penalty: number?, repetition_penalty: number?, max_tokens: number?, parallel_tool_calls: boolean?}}?}name— The name used to select this provider on the command line.base_url— Base URL of the OpenAI-compatible endpoint.api_key— API key for the endpoint. Pass an empty string for servers that need none.billing— How the user is billed:"subscription"or"metered"(the default).timeout— Maximum inactivity to tolerate while a turn streams, as a number of seconds,"none"to wait indefinitely, or"default"(the default) to use the built-in budget. A gap longer than this ends the turn with an error rather than hanging on a dead stream. The same budget bounds how long a rate-limited turn keeps retrying:"none"retries a 429 until it clears, so a tighter value both catches a dead stream sooner and gives up on a rate limit sooner.diagnostics(defaulttrue) — Whether to record per-turn diagnostics for this instance. On by default; setfalseto opt an instance out. Recording also requires the process-wide diagnostics directory to be configured; when it is not, nothing is recorded regardless of this flag.http_keep_alive(defaulttrue) — Whether to reuse HTTP connections across requests (keep-alive). On by default, which suits a remote endpoint where a fresh connection costs a TCP and TLS handshake. Setfalsefor a local server that closes idle connections quickly (llama.cpp drops one after a few seconds): reuse then risks sending on a connection the server has already closed, and the per-request handshake it avoids is negligible over a LAN.model_options— Per-model overrides, keyed by the model id as the endpoint advertises it. Takes precedence over the models.dev catalog.
set_default_model¶
Choose the default model id, used when --model is omitted.
Parameters
name:string
set_default_provider¶
Choose the default provider by name, used when --provider is omitted.
Parameters
name:string