Skip to content

Inventory

Methods

add_anthropic

Inventory:add_anthropic(args)

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 to https://api.anthropic.com; override it for a proxy or gateway.
    • api_key — API key, sent as the x-api-key header. Source it from os.getenv(...) in Lua rather than hard-coding.
    • billing — How the user is billed: "subscription" or "metered" (the default).

add_claude_code

Inventory:add_claude_code(args)

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 how list-models presents cost, so it is configured rather than assumed.

add_favourite_models

Inventory:add_favourite_models(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

Inventory:add_ollama(args)

Register a native Ollama provider.

Parameters

  • args: {name: string, base_url: string, api_key: string?, billing: string?, 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 as Authorization: Bearer <key> on every request. Source it from os.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 of ModelInfo.billing; no code path prices an Ollama turn.
    • model_options — Per-model option overrides, keyed by the model tag verbatim (e.g. "llama3.1:8b", with no :latest synthesis). The highest-precedence source for num_ctx.

add_openai

Inventory:add_openai(args)

Register an OpenAI-compatible 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 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).

set_default_model

Inventory:set_default_model(name)

Choose the default model id, used when --model is omitted.

Parameters

  • name: string

set_default_provider

Inventory:set_default_provider(name)

Choose the default provider by name, used when --provider is omitted.

Parameters

  • name: string