Interface ModelOption

Flexible model option accepted by the high-level API functions.

At least one of provider or model must be supplied, or an appropriate API key environment variable must be set for auto-detection.

interface ModelOption {
    provider?: string;
    model?: string;
    apiKey?: string;
    baseUrl?: string;
}

Properties

provider?: string

Provider name. When set without model, the default model for the requested task is looked up in PROVIDER_DEFAULTS.

Example

`"openai"`, `"anthropic"`, `"ollama"`
model?: string

Explicit model identifier. Accepted in two formats:

  • "provider:model" (e.g. "openai:gpt-4o"), split only when the prefix is a provider id agentos knows; the prefix then wins over provider. Under provider: 'ollama' an id is never split (Ollama tags carry colons: "qwen2.5:7b"), and an id whose prefix is not a provider ("meta-llama/llama-3.3-70b-instruct:free") is kept whole.
  • "model" — plain name (e.g. "gpt-4o-mini"). Requires provider or env-var auto-detect.
apiKey?: string

API key override (takes precedence over environment variables).

baseUrl?: string

Base URL override (useful for local proxies or Ollama). An empty or whitespace-only value is unset: the global default's URL, then the provider's base-URL variable, apply as with no baseUrl, and with none the call goes to the provider's own endpoint. It is never refused as a base URL meant for another provider, since it names no endpoint.