Oscar talks to one provider at a time (plus an optional chain of fallbacks).
Choose it with oscar setup or oscar model, or set provider, model and
the provider's key yourself. With no provider configured, Oscar picks one
from the keys it finds (see Auto-detection); with no key
either, it asks you to run setup.
Auto-detection
When neither --provider, OSCAR_PROVIDER nor provider in config.toml
names a provider (or provider = "auto"), Oscar takes the first of these
whose key is in the environment or in credentials.env, or that you are
signed in to:
openrouter, anthropic, openai-compatible, openai-codex,
opencode-go, gemini, deepseek, xai, zai, kimi-coding, minimax,
alibaba, nebius-token-factory, fireworks, deepinfra, huggingface,
nvidia, opencode-zen, ai-gateway, kilocode, novita, gmi,
ollama-cloud.
(OPENAI_BASE_URL or OPENAI_API_KEY in the environment still mean
openai-compatible, before this list.) Without a model, the provider's
first suggested model is used. The welcome line of the chats and oscar doctor say which provider was picked and why ("auto-detected:
OPENROUTER_API_KEY is set"); set provider to choose for good.
Where a provider's settings come from
Each provider has a row below with the variable that holds its key and the
variable that overrides its base URL. For every setting, a flag beats the
environment, which beats config.toml:
- provider:
--provider>OSCAR_PROVIDER>providerinconfig.toml; - model:
--model>OSCAR_MODEL>modelinconfig.toml; - base URL:
--base-url> the provider's*_BASE_URL>base_urlinconfig.toml> the default in the table; - key: the provider's key variable in the environment, then in
$OSCAR_HOME/credentials.env(mode 0600;oscar setupwrites it).
The file's model and base URL belong to the file's provider: if the
environment switches provider, they no longer apply. Aliases work wherever
an id does (or for openrouter, claude for anthropic, glm for zai,
chatgpt or codex for openai-codex, nebius or tokenfactory for
nebius-token-factory, ollama for custom…); oscar setup lists them.
A custom provider you name in config.toml works
wherever an id does too. oscar model and oscar doctor show each setting
and where it came from — never a key.
A model can be named together with its provider anywhere a model is asked
for: -m openrouter:anthropic/claude-sonnet-5, /model mylab:qwen3-coder,
the fallback list, helper routing and the side-task models. The part before
the first colon counts as a provider only when it is one, so qwen3:8b
stays a model id. A model alias works in all of these
places as well.
The providers
The API column is the protocol Oscar speaks to it: OpenAI chat completions
(chat), Anthropic messages (anthropic), the OpenAI Responses API
(responses) or Bedrock Converse (converse). "Per model" means Oscar picks
the protocol for each model (see Routing).
Sign in (no API key)
| Provider id | Name | Credential | Default base URL (override) | API |
|---|---|---|---|---|
openai-codex |
ChatGPT / Codex subscription | oscar auth login openai-codex |
https://chatgpt.com/backend-api/codex (OPENAI_CODEX_BASE_URL) |
responses |
qwen-oauth |
Qwen (Qwen Code sign-in) | oscar auth login qwen-oauth, or QWEN_API_KEY |
https://portal.qwen.ai/v1 (QWEN_BASE_URL) |
chat |
minimax-oauth |
MiniMax (sign-in) | oscar auth login minimax-oauth |
https://api.minimax.io/anthropic (MINIMAX_OAUTH_BASE_URL) |
anthropic |
Model APIs
| Provider id | Name | Key variable(s) | Default base URL (override) | API |
|---|---|---|---|---|
openai-compatible |
OpenAI, or any OpenAI-compatible server | OPENAI_API_KEY |
https://api.openai.com/v1 (OPENAI_BASE_URL) |
chat |
anthropic |
Anthropic | ANTHROPIC_API_KEY |
https://api.anthropic.com (ANTHROPIC_BASE_URL) |
anthropic |
deepseek |
DeepSeek | DEEPSEEK_API_KEY |
https://api.deepseek.com/v1 (DEEPSEEK_BASE_URL) |
chat |
xai |
xAI | XAI_API_KEY |
https://api.x.ai/v1 (XAI_BASE_URL) |
responses |
gemini |
Google AI Studio (Gemini) | GOOGLE_API_KEY, GEMINI_API_KEY |
https://generativelanguage.googleapis.com/v1beta/openai (GEMINI_BASE_URL) |
chat |
zai |
Z.AI (GLM) | GLM_API_KEY, ZAI_API_KEY, Z_AI_API_KEY |
https://api.z.ai/api/paas/v4 (GLM_BASE_URL) |
chat |
kimi-coding |
Kimi / Moonshot | KIMI_API_KEY, KIMI_CODING_API_KEY |
https://api.moonshot.ai/v1 (KIMI_BASE_URL) |
chat |
kimi-coding-cn |
Kimi / Moonshot (China) | KIMI_CN_API_KEY |
https://api.moonshot.cn/v1 (KIMI_CN_BASE_URL) |
chat |
minimax |
MiniMax | MINIMAX_API_KEY |
https://api.minimax.io/anthropic (MINIMAX_BASE_URL) |
anthropic |
minimax-cn |
MiniMax (China) | MINIMAX_CN_API_KEY |
https://api.minimaxi.com/anthropic (MINIMAX_CN_BASE_URL) |
anthropic |
alibaba |
Qwen Cloud (Alibaba DashScope) | DASHSCOPE_API_KEY |
https://dashscope-intl.aliyuncs.com/compatible-mode/v1 (DASHSCOPE_BASE_URL) |
chat |
alibaba-cn |
Alibaba DashScope (China) | DASHSCOPE_API_KEY |
https://dashscope.aliyuncs.com/compatible-mode/v1 (DASHSCOPE_CN_BASE_URL) |
chat |
alibaba-coding-plan |
Alibaba Cloud (Coding Plan) | ALIBABA_CODING_PLAN_API_KEY, DASHSCOPE_API_KEY |
https://coding-intl.dashscope.aliyuncs.com/v1 (ALIBABA_CODING_PLAN_BASE_URL) |
chat |
alibaba-coding-plan-cn |
Alibaba Cloud (Coding Plan, China) | ALIBABA_CODING_PLAN_CN_API_KEY, ALIBABA_CODING_PLAN_API_KEY, DASHSCOPE_API_KEY |
https://coding.dashscope.aliyuncs.com/v1 (ALIBABA_CODING_PLAN_CN_BASE_URL) |
chat |
alibaba-token-plan |
Alibaba Cloud (Token Plan) | ALIBABA_TOKEN_PLAN_API_KEY |
https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 (ALIBABA_TOKEN_PLAN_BASE_URL) |
chat |
alibaba-token-plan-cn |
Alibaba Cloud (Token Plan, China) | ALIBABA_TOKEN_PLAN_CN_API_KEY, ALIBABA_TOKEN_PLAN_API_KEY |
https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 (ALIBABA_TOKEN_PLAN_CN_BASE_URL) |
chat |
xiaomi |
Xiaomi MiMo | XIAOMI_API_KEY |
https://api.xiaomimimo.com/v1 (XIAOMI_BASE_URL) |
chat |
stepfun |
StepFun Step Plan | STEPFUN_API_KEY |
https://api.stepfun.ai/step_plan/v1 (STEPFUN_BASE_URL) |
chat |
arcee |
Arcee AI | ARCEEAI_API_KEY |
https://api.arcee.ai/api/v1 (ARCEE_BASE_URL) |
chat |
upstage |
Upstage Solar | UPSTAGE_API_KEY |
https://api.upstage.ai/v1 (UPSTAGE_BASE_URL) |
chat |
meta-ai |
Meta Model API | MODEL_API_KEY, META_API_KEY, META_MODEL_API_KEY |
https://api.meta.ai/v1 (META_BASE_URL) |
responses |
nvidia |
NVIDIA NIM | NVIDIA_API_KEY |
https://integrate.api.nvidia.com/v1 (NVIDIA_BASE_URL) |
chat |
tencent-tokenhub |
Tencent TokenHub | TOKENHUB_API_KEY |
https://tokenhub.tencentmaas.com/v1 (TOKENHUB_BASE_URL) |
chat |
tencent-tokenplan |
Tencent TokenPlan | TOKENPLAN_API_KEY |
https://api.lkeap.cloud.tencent.com/plan/anthropic (TOKENPLAN_BASE_URL) |
anthropic |
When several key variables are listed, the first one set is used. A Kimi
Code key (sk-kimi-…) in KIMI_API_KEY is sent to Kimi Code's own
endpoint, https://api.kimi.com/coding.
Aggregators and gateways
| Provider id | Name | Key variable(s) | Default base URL (override) | API |
|---|---|---|---|---|
opencode-go |
OpenCode Go | OPENCODE_GO_API_KEY |
https://opencode.ai/zen/go/v1 (OPENCODE_GO_BASE_URL) |
per model |
openrouter |
OpenRouter | OPENROUTER_API_KEY |
https://openrouter.ai/api/v1 (OPENROUTER_BASE_URL) |
chat |
opencode-zen |
OpenCode Zen | OPENCODE_ZEN_API_KEY |
https://opencode.ai/zen/v1 (OPENCODE_ZEN_BASE_URL) |
per model |
ai-gateway |
Vercel AI Gateway | AI_GATEWAY_API_KEY |
https://ai-gateway.vercel.sh/v1 (AI_GATEWAY_BASE_URL) |
chat |
kilocode |
Kilo Code | KILOCODE_API_KEY |
https://api.kilo.ai/api/gateway (KILOCODE_BASE_URL) |
chat |
fireworks |
Fireworks AI | FIREWORKS_API_KEY |
https://api.fireworks.ai/inference/v1 (FIREWORKS_BASE_URL) |
chat |
deepinfra |
DeepInfra | DEEPINFRA_API_KEY |
https://api.deepinfra.com/v1/openai (DEEPINFRA_BASE_URL) |
chat |
novita |
NovitaAI | NOVITA_API_KEY |
https://api.novita.ai/openai/v1 (NOVITA_BASE_URL) |
chat |
huggingface |
Hugging Face | HF_TOKEN |
https://router.huggingface.co/v1 (HF_BASE_URL) |
chat |
nebius-token-factory |
Nebius Token Factory | NEBIUS_API_KEY, NEBIUS_TOKEN_FACTORY_API_KEY |
https://api.tokenfactory.nebius.com/v1 (NEBIUS_BASE_URL) |
chat |
gmi |
GMI Cloud | GMI_API_KEY |
https://api.gmi-serving.com/v1 (GMI_BASE_URL) |
chat |
ollama-cloud |
Ollama Cloud | OLLAMA_API_KEY |
https://ollama.com/v1 (OLLAMA_BASE_URL) |
chat |
commandcode |
CommandCode | COMMANDCODE_API_KEY |
https://api.commandcode.ai/provider/v1 (COMMANDCODE_BASE_URL) |
chat |
commandcode-anthropic |
CommandCode (Anthropic) | COMMANDCODE_API_KEY |
https://api.commandcode.ai/provider/v1 (COMMANDCODE_ANTHROPIC_BASE_URL) |
anthropic |
router |
Ramp Router | RAMP_ROUTER_API_KEY, ROUTER_API_KEY |
https://api.router.com/v1 (RAMP_ROUTER_BASE_URL) |
responses |
actual |
Actual Computer | ACTUAL_API_KEY (none on a local daemon) |
https://api.actual.inc/v1 (ACTUAL_BASE_URL) |
chat |
Clouds
| Provider id | Name | Credential | Default base URL (override) | API |
|---|---|---|---|---|
azure-foundry |
Azure AI Foundry | AZURE_FOUNDRY_API_KEY |
none: set yours (AZURE_FOUNDRY_BASE_URL) |
per model |
bedrock |
AWS Bedrock | AWS credentials, or a Bedrock API key in AWS_BEARER_TOKEN_BEDROCK |
https://bedrock-runtime.us-east-1.amazonaws.com (BEDROCK_BASE_URL) |
converse |
vertex |
Google Vertex AI | a service account, or application-default credentials | built from project and region (VERTEX_BASE_URL) |
chat |
Local and custom endpoints
| Provider id | Name | Key variable | Default base URL (override) | API |
|---|---|---|---|---|
lmstudio |
LM Studio | LM_API_KEY (optional) |
http://127.0.0.1:1234/v1 (LM_BASE_URL) |
chat |
custom |
Ollama, vLLM, llama.cpp or any OpenAI-compatible server | CUSTOM_API_KEY (optional) |
none: set yours (CUSTOM_BASE_URL) |
chat |
Signing in instead of a key
Three providers use your account rather than an API key:
oscar auth login openai-codex # device code (default)
oscar auth login openai-codex --browser # browser sign-in, redirects to localhost:1455
oscar auth login openai-codex --import-codex-cli # copy the Codex CLI's login (only read)
oscar auth login qwen-oauth # uses the Qwen Code CLI's login (`qwen` must be signed in)
oscar auth login minimax-oauth [--region global|cn]
oscar auth status # who is signed in, and whether tokens renew
oscar auth logout <provider>--no-browser prints the sign-in address instead of opening a browser;
--timeout <seconds> (default 600) bounds the wait. Tokens are kept in
$OSCAR_HOME/auth/<provider>.json (owner-only) and renewed shortly before
they expire; a request the provider refuses with HTTP 401 renews the token
once and is sent again. oscar setup offers the same sign-in. qwen-oauth
also takes a plain key in QWEN_API_KEY.
Anthropic is API-key only, on purpose: Oscar uses ANTHROPIC_API_KEY and
does not sign in with a Claude subscription (Free, Pro or Max) or use
subscription tokens such as CLAUDE_CODE_OAUTH_TOKEN.
An OpenRouter key from your browser. oscar auth login openrouter (or
oscar auth keys add openrouter --oauth) uses OpenRouter's documented PKCE
flow: you sign in at openrouter.ai, the browser comes back to a short-lived
address on this machine, and the code it carries is exchanged for an API key
that belongs to you (revoke it any time at openrouter.ai/keys). The key goes
to credentials.env as OPENROUTER_API_KEY, or the next free pool slot
(OPENROUTER_API_KEY_2 …) when there is one already. On a machine without a
browser, open the printed address anywhere and paste the address the browser
ends on (or the code the page shows) back into the terminal.
Azure AI Foundry
Point AZURE_FOUNDRY_BASE_URL (or base_url) at your deployment's endpoint
and put the key in AZURE_FOUNDRY_API_KEY; Oscar sends it as an api-key
header. The model id is your deployment name. Per model:
- an endpoint ending in
/anthropicspeaks Anthropic messages (with a bearer token,api-version=2025-04-15unless you set one); - deployments named
gpt-5…,codex…,o1…,o3…,o4…use the Responses API, which is all they accept; - everything else uses chat completions. A pre-v1
/openai/deployments/…path getsapi-version=2024-10-21unless the URL carries its own; the v1 endpoint needs none.
AWS Bedrock
Requests go to the Converse API, signed with AWS Signature Version 4, or
sent with a Bedrock API key (AWS_BEARER_TOKEN_BEDROCK) as a bearer token.
AWS credentials are read from AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
and AWS_SESSION_TOKEN, or from a profile in the shared files
(AWS_PROFILE, ~/.aws/credentials, ~/.aws/config; AWS_SHARED_CREDENTIALS_FILE
and AWS_CONFIG_FILE move them). Single sign-on, credential_process and
instance roles are not read: export the keys they produce. The region
(AWS_REGION, then AWS_DEFAULT_REGION, default us-east-1) picks the
endpoint. Model ids are Bedrock's (us.anthropic.claude-sonnet-4-6,
us.amazon.nova-pro-v1:0); oscar model list reads them from
ListFoundationModels. Claude and Nova get prompt-cache points, and Claude
its thinking (see Prompt caching and
Reasoning).
Google Vertex AI
Gemini through Vertex's OpenAI-compatible endpoint, with a short-lived
Google token. The token comes from a service-account key file
(VERTEX_CREDENTIALS_PATH or GOOGLE_APPLICATION_CREDENTIALS), or from
application-default credentials (gcloud auth application-default login).
The project is VERTEX_PROJECT_ID, GOOGLE_CLOUD_PROJECT, or the one in
the credentials file; the region is VERTEX_REGION (default global).
Model ids look like google/gemini-3.6-flash. Gemini caches prompt prefixes
on its own, and takes reasoning_effort.
Local servers
- LM Studio: start its server;
lmstudiouseshttp://127.0.0.1:1234/v1by default and needs no key. - Ollama, vLLM, llama.cpp and any other OpenAI-compatible server: use
customand set the base URL, for exampleCUSTOM_BASE_URL=http://127.0.0.1:11434/v1for Ollama. A key is sent only whenCUSTOM_API_KEYis set. - Actual Computer's local daemon needs no key on a loopback address.
The model must accept tool definitions: Oscar works through tool calls.
Routing
Some providers serve model families through different protocols; Oscar picks one per model and never falls back to another protocol silently:
- OpenCode Go: Anthropic messages for
claude-,minimax-,qwenandunion-alphamodels; the Responses API forgpt-,grok-andmuse-sparkmodels (their reasoning is carried from turn to turn, and only back to the model that produced it); chat completions for the rest. Model ids are the bare slug (glm-5.3, notopencode-go/glm-5.3), and requests carry the per-conversation session header the relay requires. - OpenCode Zen: Anthropic messages for
claude-,union-alphaandqwenmodels, the Responses API forgpt-,grok-andmuse-spark, chat completions for the rest. - Azure AI Foundry: see above.
- For the model APIs, most aggregators and
custom, a base URL ending in/anthropic(or Kimi Code's/coding) switches to Anthropic messages.
A model that needs a protocol Oscar does not implement is refused with that
reason; oscar model list marks such models.
OpenRouter provider routing
OpenRouter serves most models through several providers. These settings say
which may serve your requests and in what order; they are sent as the
provider object of every request to OpenRouter, and to no other provider:
# config.toml (or OSCAR_OPENROUTER_SORT, OSCAR_OPENROUTER_ONLY, … in the environment)
openrouter_sort = "price" # price | throughput | latency
openrouter_only = ["anthropic", "google"] # only these providers
openrouter_ignore = ["deepinfra"] # never these
openrouter_order = ["anthropic", "google"] # try these first, in order
openrouter_data_collection = "deny" # deny: only providers that do not keep or train on prompts
openrouter_allow_fallbacks = "off" # off: no provider outside order/only when those failLists take OpenRouter's provider slugs, as an array or comma-separated. Leave
a setting out and OpenRouter decides as usual; with none set nothing is sent.
They also apply to an OpenRouter entry in the fallback chain. oscar doctor
shows them in words ("OpenRouter: sorted by price; only anthropic, google"),
says when they are set but the provider is not OpenRouter (and so not sent),
and names values it could not use.
The model catalogue: windows, output limits and prices
Oscar keeps a copy of the public catalogue at models.dev — every provider's
models with their context windows, output limits and prices (input, output,
cached input, cache writes) — in $OSCAR_HOME/cache/models-dev.json.
- Refreshed daily, in the background. When the copy is older than a day
(or missing), a refresh starts as a chat,
oscar runor a gateway builds its agent; no turn ever waits for it, and a long-running gateway refreshes as the days pass. A failed refresh keeps the old copy and is not tried again for an hour; with no copy at all, Oscar's built-in tables are used. The request carriesUser-Agent: Oscar-Agent/<version>and nothing else. - Only for hosted providers. A setup whose provider runs on this machine (a local server) never fetches it, so a fully local Oscar stays offline.
oscar model catalogue [--refresh] [model]shows the copy's age and what it says about a model (default: the configured one);--refreshfetches it now, also for a local setup.models_dev = "off"in config.toml (orOSCAR_MODELS_DEV=off) uses the built-in tables only.OSCAR_MODELS_DEV_URLfetches from elsewhere (a mirror).
Entries are matched to the provider you use first (OpenRouter's own prices
for an OpenRouter model, Bedrock's for a Bedrock id), then to the model's
vendor (anthropic/claude-sonnet-4.5 → Anthropic's entry), then to the
first-party providers by the bare id (so a custom OpenAI-compatible endpoint
serving gpt-5 finds OpenAI's entry).
Windows and output limits. The context window and output cap come from,
in order: your setting (context_window, max_output_tokens), the
provider's own model list (oscar model list), the catalogue, what Oscar
knows of the model family, then a default. oscar doctor says which one
each came from ("200000 tokens (models.dev: anthropic)").
Prices and costs. Each turn's cost is computed from the catalogue's
price for the model, or from Oscar's built-in table for the main families
(Claude by generation — Opus 4.5 and later at $5/$25 per million input/output
tokens, Opus 5.5 at $4/$20, Sonnet 5 and 5.5 at $2/$10, Haiku 4.5 at $1/$5 —
GPT-5 and GPT-4.1, the o-series, Gemini 2.5, DeepSeek and Grok). Cached
input is priced at the cache-read price and Claude's cache writes at 1.25 ×
input. A model neither knows has an unknown cost, never a cost of zero:
/cost, /usage, !usage and the footer after each reply say so. oscar doctor prints the configured model's prices and where they came from.
Choosing and switching models
oscar model: on a terminal, a picker for the provider (custom providers first, each with whether it has a key or sign-in), its key or sign-in, and the model;oscar model <provider:model>(or an alias) sets one directly.oscar model list [--refresh]: the provider's live list, cached for an hour in$OSCAR_HOME/cache/; when it cannot be fetched, the cached list and then a built-in list are used, and the output says which. Models Oscar cannot use (no tool support, an unsupported protocol) are marked.oscar model set <id>: check the id against the list and save it (provider:modeland aliases name the provider too).oscar model catalogue [--refresh] [model]: the model's window, output limit and prices from the catalogue (see above).oscar model alias add|remove|list: see Model aliases.
In every chat — the full-screen chat, the line chat, and Matrix, Telegram
and Discord — /model (!model in Matrix and Discord) switches the model:
/model glm-5.3 a model of the chat's provider
/model openrouter:anthropic/claude-sonnet-5
/model mylab:qwen3-coder a custom provider's model
/model fav an alias
/model gpt-5.6-sol --provider openai-codex
/model reset back to the configured model
/model fav --global also write it to config.toml
/model fav --reasoning high and the reasoning effort, in one stepWithout --global the switch holds for this conversation (in a chat
gateway: this room) only. /model alone lists models to pick from: the
current one, your aliases, the provider's catalogue, your custom providers'
models and the fallback chain. Each catalogue model shows the lab that
makes it and its context window where known (Z.ai · 1000k window), which
matters on routers like OpenCode Go and OpenRouter that serve many labs'
models; typing a lab's name (moonshot) narrows the list to its models. The full-screen chat opens a list you
narrow by typing; the line chat prints a numbered list (/model 3 picks
from it); Telegram and Discord put buttons under the list; Matrix adds
number reactions to it (react, or reply with the number). Switching a room's
model in a chat gateway is for admins. A model on another provider brings
that provider's key, base URL, limits and defaults; the fallback chain stays
in place after a switch.
A running chat gateway follows config.toml: after oscar model set, a
--global switch or an edit of provider, model or base_url, the next
message in every room runs on the new main model, no restart needed. A room
that chose its own model (!model <id>) keeps it until !model reset,
which makes it follow config.toml again. A model given at start by
--model or OSCAR_MODEL stays for the life of the process. If the new
setting cannot be used (an unknown provider, a missing key), the gateway
keeps the model it had and says why in its log.
Model aliases
Short names for models you use often:
[model_aliases]
fav = "openrouter:anthropic/claude-sonnet-5"
lab = "mylab:qwen3-coder"
cheap = "deepseek:deepseek-flash"oscar model alias add fav openrouter:anthropic/claude-sonnet-5, oscar model alias remove fav and oscar model alias list edit the table. An
alias works with -m, /model, oscar model set, in fallback, in
helper_model / helper_model_map / helper_models and in the side-task
models (aux_model, compression_model, …). Alias names are lowercase
letters, digits, - and _, and may not be a provider's name.
Named custom providers
An endpoint you run or rent — vLLM, a company proxy, a second OpenAI-style
account — gets a name of its own and then works wherever a provider id
does (<name>:<model>, provider = "<name>", fallbacks, aliases, side
tasks, helpers):
[providers.mylab]
api = "openai" # openai (chat completions), anthropic or responses
base_url = "http://127.0.0.1:8000/v1"
key_env = "MYLAB_API_KEY" # the variable holding the key (environment or credentials.env)
extra_headers = { "X-Team" = "research" }
extra_body = { top_k = 20 } # or a JSON object in a string, for nested values
context_length = 65536
max_output_tokens = 8192
models = ["qwen3-coder", "qwen3-32b"] # offered in /model and `oscar model`
streaming = true # false: whole replies (api = "openai" only)
request_timeout = 300 # seconds a reply may take to start
ca_bundle = "/etc/ssl/mylab-ca.pem" # this endpoint's own CA (adds trust; checks stay on)
[providers.claude-proxy]
api = "anthropic"
base_url = "https://llm-proxy.example.com/anthropic"
key_cmd = ["pass", "show", "llm/proxy"] # prints the key; run without a shell- The key comes from
key_env(with a pool inKEY_2…KEY_16, like every key variable) or fromkey_cmd: a program and its arguments, run once per process without a shell; the first line it prints is the key, kept in memory only. With neither, no key is sent (local servers). A key never goes inconfig.toml, andextra_headersmay not carry one. context_lengthandmax_output_tokensstand in for a catalogue (a[models."<name>:<model>"]table still wins for one model).apipicks the protocol for every model of the provider; Oscar does not guess from the URL.- A name may not be a built-in provider's id or alias.
oscar doctorlists each custom provider with its API, address, where its key comes from and what it adds.
Mixture of agents
Several models on one turn: reference models write their analysis first,
then an aggregator model answers with their analyses in view. Name a preset
in config.toml:
[moa.deep]
aggregator = "anthropic:claude-opus-4-6" # answers, and calls the tools
references = ["openrouter:openai/gpt-5.1", "deepseek:deepseek-chat"] # advise
reference_max_tokens = 2048 # optional: the cap on each analysis
reference_timeout = 180 # optional: seconds a reference may takeRun on it with -m moa:deep, /model moa:deep (--global saves it as
provider = "moa", model = "deep"), or in a fallback list. Each entry is a
model choice like any other — provider:model, a custom provider's
<name>:<model>, an alias — with its key and base URL found the usual way.
- Once per user turn every reference reads the conversation (as text: the start of the system prompt and the newest messages) and writes what it thinks: what is asked, the facts that matter, risks, the answer or approach it recommends. The calls run side by side.
- References only advise. They are given no tools, and a tool call one makes anyway is dropped. The aggregator alone sees the tools and calls them; its later requests in the same turn (after tool results) reuse the same analyses instead of asking again.
- The aggregator's model decides the context window, the output cap, the reasoning setting and the fallback chain; its requests carry the references' analyses after your message, marked as advice to weigh and check.
- Costs per model. Every reference's tokens and cost are recorded under
its own model name (
oscar usage,/usage,oscar insights); the footer's cost adds them up. - A reference that fails or takes too long is left out of that turn (the
chat says which); when none answers, the aggregator answers alone. A
reference that cannot be built at all (no key) is left out with a warning,
and when none can be built the choice is refused.
oscar doctorlists the preset's references and whether each can be used. - Helper calls of the conversation (summaries, titles) go to the aggregator
alone. A preset may not name another
moa:preset.
Side-task models
Some work is done off the conversation's path: summaries when the context
is compressed, session titles, the approve = "smart" judge, background
reviews and image descriptions for a model that cannot see. Each can run on
any provider:
aux_model = "openrouter:google/gemini-3-flash" # the default for every side task but vision
compression_model = "cheap" # an alias works too
title_model = "deepseek:deepseek-flash"
approval_model = "anthropic:claude-haiku-4-5-20251001"
review_model = "mylab:qwen3-32b"
vision_model = "gemini:gemini-3.6-flash"A bare model id stays on the main provider. A provider:model finds its key,
sign-in, base URL and key pool the way the main model does. Summaries and
titles fall back along the main chain when their model fails; the judge and
the vision model do not (a judge that cannot answer means a person is
asked). Unset, a task uses aux_model, then the provider's documented cheap
model (titles, the judge), then the main model. oscar doctor shows which
model each task uses. oscar import sets them from the side-task models of
your previous agent where they are not set yet (see
getting started).
Per-model settings
Settings for one model, read before any catalogue and before the settings for every model:
[models."openrouter:anthropic/claude-sonnet-5"]
context_window = 200000
max_output_tokens = 32000
compression_threshold = "70%"
reasoning_effort = "high"
supports_vision = true
prompt_cache_ttl = "1h"The table's name is provider:model as you would write it in /model (a
custom provider's name works). --reasoning on the command line still wins
over reasoning_effort here. oscar doctor shows when a value came from
the model's table.
Fallback providers
When the provider fails in a way another provider could fix, Oscar can send the request to the next provider in a chain:
# config.toml (or OSCAR_FALLBACK in the environment)
fallback = "openrouter:moonshotai/kimi-k3, anthropic:claude-sonnet-5"Each entry is provider:model (split at the first colon, so model ids may
contain more colons). A fallback finds its key, sign-in and base URL exactly
as it would as the main provider; with the same provider as the main one, it
uses the same endpoint. An entry that cannot be used (unknown provider, no
key) is left out and oscar doctor says why.
- What falls back: rate limits (HTTP 429) after the retries, used-up quota or credit (402), a refused or expired key or sign-in (401, 403), server errors (5xx, 408), network errors and timeouts.
- What never falls back: errors that would fail the same way anywhere — a bad request (400, 422), an unknown model (404), an unparseable answer.
- You are told once per turn: "openrouter · glm-5.3 failed (HTTP 503); answering with fallback anthropic · claude-sonnet-5 — your next message tries openrouter again". The rest of that turn stays on the fallback; the next turn starts with the main provider again.
- A conversation too long for the model: it goes to the first fallback
whose context window is known to be larger (windows come from the
providers' model lists, as
oscar model listcaches them, or from the error message itself). With no such fallback, Oscar learns the window from the error, compresses the conversation and sends it again once. - Nothing is sent twice once part of a reply has streamed.
Output limits
Each reply may be as long as the model allows: max_output_tokens when you
set it, else the cap the provider's model list states (OpenRouter's
max_completion_tokens, Anthropic's max_tokens), else the catalogue's
output limit, else what Oscar knows of the family (Claude 4.6 and later and the 5 family: 128,000; Claude 4.5:
64,000; GPT-5: 128,000; Gemini 2.5 and later: 65,536), else 16,384 — 4,096
for local servers and for non-Claude models on Bedrock, which is called
without streaming (and capped at 32,000 there for the same reason). The cap
never takes more than half of the context window. When a provider refuses
the cap ("max_tokens: … > 32000", "the valid range is [1, 8192]", "exceed
context limit"), Oscar reads the allowed value from the error, sends the
request again and keeps that value.
A reply that reaches the cap is not lost: text is continued — Oscar asks the model to go on exactly where it stopped, up to three times, and joins the pieces into one reply — and a tool call cut off mid-way is never run with half its arguments: the model is told its call was cut off and to split the work (write a large file in parts, make smaller edits). Both are shown as notes in the chats.
Prompt caching
Every request re-sends the conversation, so the provider's prompt cache is what keeps long sessions fast and cheap. Oscar keeps the start of every request stable — the system prompt does not change during a session, and recalled memory and attached files ride on your message instead — and marks it where the API needs marking:
- Anthropic (and Anthropic-compatible endpoints):
cache_controlbreakpoints on the system prompt, which covers the tools before it, and on the last three messages — four, the API's maximum. The stable start is read from the cache; the rolling breakpoints keep the growing conversation cached as it moves. In the chats (full-screen, line, dashboard, chat gateways, editors) the breakpoints ask for the one-hour cache, since minutes pass between your messages; one-shot runs (oscar run, scheduled jobs, the API, helpers) keep the five-minute default. Writing an hour costs more than five minutes (2 × input instead of 1.25 ×); reading is the same.prompt_cache_ttl = "5m","1h"or"auto"(the default) decides; every breakpoint of a request gets the same lifetime. - Bedrock: cache points in the same places, for Claude 3.5 and later and Amazon Nova models.
- OpenRouter: the same
cache_controlmarkers (and lifetime) for Anthropic models, which OpenRouter passes on. - OpenAI, Gemini, DeepSeek and the others cache prompt prefixes on their own; the stable start is all they need.
Cached tokens are counted where the API reports them: /cost, usage and
the footer show them, and the cost uses the cache prices (Anthropic and
Bedrock report cache writes too, priced at 1.25 × input for Claude).
prompt_caching = "off" sends no markers; a provider that refuses them gets
the request again without, for the rest of the session. oscar doctor
shows how the configured model is cached.
Keeping the cache warm
A cached prompt lives for its TTL after it was last read. If you think longer
than that between two messages, the next request pays the full input price
again. cache_keep_warm = "<minutes>" (off by default) keeps it alive while
a terminal chat (full-screen or line) is idle: shortly before the cache would
expire, Oscar sends the conversation as it stands (the same system prompt,
tools and history, so it reads the cache) and asks for a one-token answer.
It stops when you send the next message, after that many minutes of
idleness, or after 10 pings in the session.
- Only Anthropic's own API (
provider = "anthropic") withprompt_cachingon; elsewhere the setting does nothing. - With the one-hour cache (the default in chats) a ping is needed only for
stretches longer than an hour; it is mostly useful with
prompt_cache_ttl = "5m", whose writes cost less (1.25 × input instead of 2 ×). - Each ping costs a cache read of the conversation (0.1 × input for Claude)
plus a few tokens. It is recorded with the session (
/cost,oscar usage) and a line says what it read and cost ("kept the prompt cache warm (2/10): 41200 cached tokens read, $0.0124"). - Chat gateways, editors and the API do not keep warm.
Reasoning
reasoning_effort — none, minimal, low, medium, high, xhigh or
max — sets how hard the model thinks, where the provider has such a
setting. Unset, nothing is sent and the provider's default applies. A
level a model does not have is sent as the nearest it has, and oscar doctor says so ("this model has no max; sent as high").
| Provider and model | What Oscar sends |
|---|---|
OpenAI Responses API (OpenAI, Codex, xAI, Meta, the OpenCode relays' gpt-/grok- models) |
reasoning.effort (none … xhigh; max goes as xhigh), with a summary of the reasoning to show |
| Claude 4.6 and later, and the 5 family (Anthropic, Anthropic-compatible, Bedrock) | adaptive thinking with that effort: max as max, xhigh as high where the model has no xhigh, minimal as low; none turns thinking off, or to the lowest effort on models that always think |
| Claude 3.7 to 4.5 | extended thinking with a token budget: 1,024 / 2,048 / 8,000 / 16,000 / 32,000 / 64,000 tokens for minimal to max, always below the output cap |
| OpenRouter | its reasoning parameter (minimal … high; xhigh and max go as high) |
| OpenAI chat completions at api.openai.com, Gemini, Vertex | reasoning_effort (minimal … high; xhigh and max go as high) |
| anything else | nothing: oscar doctor says the setting is ignored |
/reasoning <level> changes it for the conversation; /reasoning <level> save also writes it to config.toml; /model <model> --reasoning <level>
switches both at once. A model can have its own level in its
[models."<provider>:<model>"] table.
A model that refuses the setting gets the request again without it, with a note, for the rest of the session. With thinking on, Claude takes no temperature, so none is sent.
Thinking across tool calls. Claude's thinking blocks come back signed; Oscar keeps them with the reply, in the order they came, and sends them back unchanged to the same endpoint and model on the following requests, as tool use with thinking requires. They are not sent to another model or endpoint, and they are left out once the conversation before them has changed (after a compression, or when a stored session is loaded, since the stored messages are what you typed rather than the context the model got with them). The Responses API's encrypted reasoning is carried the same way.
Seeing it. What the model shares of its reasoning appears dimmed in the
full-screen chat by default, apart from the reply (show_reasoning = "off"
or /reasoning hide hides it); the line chat shows it with
show_reasoning = "on" or /reasoning show. It is never sent to chat
gateways.
Priority processing (/fast)
/fast on (and fast_mode = "on" in config.toml, from the start) asks
for faster processing where the provider sells it, billed at its higher
rates:
| Provider | What Oscar sends |
|---|---|
OpenAI's own API (openai-compatible at api.openai.com), chat completions and Responses |
service_tier: "priority" |
| Anthropic's own API, Claude Opus 5.5, Fable 5.2 and Mythos 5.2 | speed: "fast" |
| Anthropic's own API, Claude Opus 5 (research preview, needs access) | speed: "fast" with the fast-mode-2026-02-01 beta flag |
Anywhere else /fast on is refused with the reason, and fast_mode is
ignored with a note in oscar doctor. The full-screen chat's status line
shows fast while it is on; /fast off turns it off, /fast alone says
how it stands. A provider that refuses the field gets the request again at
normal speed, with a note, for the rest of the conversation. In the chat
gateways /fast on|off is for admins and holds for the room.
Usage and limits
/usage (or /cost; !usage in Matrix and Discord) and oscar usage [--session <name>] [--offline] show:
- this session: how long it has run, how full the context window is (about N of M tokens), tokens in and out, and the cost split into input, output and cache reads at the prices Oscar knows ("unknown" for a model without a price, never zero);
- the provider account, where an API tells: OpenRouter's credits
(
/credits) and the key's spending limit (/key), asked when you run the command; and the rate limits the last responses reported — OpenAI's and compatible servers'x-ratelimit-*(requests and tokens per minute), Anthropic'santhropic-ratelimit-*(and fast-mode limits), the ChatGPT Codex backend's five-hour and weekly windows (x-codex-*). Only those headers are kept (in$OSCAR_HOME/cache/ratelimits.json, sooscar usagesees what the chats saw), never anything else of a response.
A provider that reports none of these is shown as "unknown".
Retries
A rate limit or a server error is retried after a short pause (1 s, then
4 s, then 16 s) before anything falls back. provider_retries = "0" in
config.toml (or OSCAR_PROVIDER_RETRIES, 0 to 5, default 3) sets how
many times. When the provider says how long to wait (Retry-After), Oscar
waits that long instead when it is longer, up to two minutes.
When a provider fails
A provider that stops answering cannot hold a turn:
- Connecting gives up after 30 seconds.
- The reply must start within
request_timeout(default 120 s), and a stream must keep sending bytes within it. - A stream that stalls — it keeps sending keep-alives but no events —
is given up after
stream_idle_timeout(default 180 s). - A local server (a
localhostbase URL) may think for minutes before its first token, so it gets 1800 s and 900 s unless you set them. - The turn watchdog (
turn_watchdog, default 600 s,0off) gives up a model request that shows no progress at all (no text, reasoning or notice) for that long.
Each of these is retried like a dropped connection: provider_retries
times, then through the fallback chain. When all of
that is spent on a failure that may pass — a server error, an overloaded
provider, a timeout, a rate limit — the turn waits and tries again, up to
auto_recovery_cycles times (default 5; 15 s, 30 s, then a minute apart, a
Retry-After of up to two minutes wins), with a notice in the chat:
"… failed (HTTP 503); retrying automatically in 30s (attempt 2 of 5); stop
the turn to cancel". Ctrl-C, /stop or !stop ends the wait. A refused
key, a used-up quota, a bad request or a conversation too long never waits:
another try would fail the same way. oscar doctor shows the limits in
force.
A model that does not exist (HTTP 404, or a reply saying the model is not found or not valid: retired, misspelt, or a wrong endpoint) is not retried with the same provider: the request moves to the next fallback at once, with a notice ("… failed (model not found (HTTP 404)); answering with fallback …").
Several keys for one provider
Give a provider more keys and Oscar spreads the load across them:
# credentials.env (or the environment)
OPENROUTER_API_KEY=sk-or-...
OPENROUTER_API_KEY_2=sk-or-...
OPENROUTER_API_KEY_3=sk-or-...
# or, all at once:
OPENROUTER_API_KEYS=sk-or-...,sk-or-...Any provider's key variable works this way (_2 up to _16, and the plural
form with a comma-separated list), and so does a custom provider's
key_env. Which key a request starts with is pool_strategy:
fill_first(the default): stay on one key while it works;round_robin: each request starts with the next key in turn;least_used: each request starts with the key that served the fewest requests in this process.
A key that is rate-limited sits out for a minute; one whose quota is used up
or that is refused sits out for an hour; the request moves to the next key at
once. When every key is resting, the one free soonest is tried. The rests are
shared by every Oscar process on the machine ($OSCAR_HOME/auth/key-pool.json,
owner-only, holding a one-way fingerprint per key, never the key).
oscar doctor shows how many keys there are, the strategy, and which are
resting, by number and variable name only.
oscar auth keys manages a pool in credentials.env without ever showing
a key — only its place, its variable and a short fingerprint:
oscar auth keys list openrouter # #1 OPENROUTER_API_KEY 3f2a…, cooling down 12m: rate limited
oscar auth keys add openrouter < key.txt # the next free slot; hidden prompt on a terminal, never argv
oscar auth keys add openrouter --oauth # mint one in the browser (OpenRouter only)
oscar auth keys remove openrouter 2 # the rest move up
oscar auth keys priority openrouter 3 1 # key #3 is tried first
oscar auth keys reset openrouter [n] # put resting keys back in service nowKeys in the environment are listed (marked) but changed there, not here.
Keys from a password manager
A value in credentials.env (or the environment) may name where the key is
kept instead of holding it:
# credentials.env
OPENROUTER_API_KEY=op://Private/OpenRouter/credential # 1Password CLI: op read
ANTHROPIC_API_KEY=bw://anthropic/password # Bitwarden CLI: bw get password anthropic
TAVILY_API_KEY=bw://tavily/api key # a custom field of the item
EXA_API_KEY=bws://be8e0ad8-d545-4017-a55a-b02f014d4158 # Bitwarden Secrets Manager: bws secret get
GITHUB_TOKEN=cmd:pass show api/github # any command; its output is the keyop://vault/item/fieldis read withop read(with--accountwhenvault_op_accountis set);bw://item/fieldwithbw get <field> <item>forpassword,username,totp,notesanduri, and from the item's custom fields for any other name;bws://<secret id>withbws secret get <id> --output json(the secret's value);cmd:<command>runs the command without a shell (quotes group words,$VARstays literal) and takes its output, without the trailing newline.- The programs are the vault's:
vault_op,vault_bwandvault_bwsmay name a path, otherwiseop,bwandbwson thePATH(see vault). Their sessions are yours:opneeds to be signed in (orOP_SERVICE_ACCOUNT_TOKENset),bwunlocked (BW_SESSION),bwsan access token (BWS_ACCESS_TOKEN; fromcredentials.envit is passed tobwsalone, in its environment). - Each value is resolved once when Oscar starts, with a 30-second limit, and
kept in memory only:
credentials.envkeeps the reference, nothing is written back, and the value is never logged (tool output and logs are redacted of it). A run gets no input and never seesOSCAR_VAULT_PASSPHRASE; what it prints on error is discarded. - A reference that cannot be read leaves the variable unset, as if it were
missing.
oscar doctorlists the variables read from secret managers and the ones that failed, by name and kind of failure only ("OPENROUTER_API_KEY: 1Password: the program failed (exit status 1)"), never the reference or a value. - The gateway service (
oscar gateway install) runs without your login session, so a manager that needs one cannot answer there. Give the service what it needs: the unit loads every*.envfile in$OSCAR_HOME(and--env-file <path>), so putOP_SERVICE_ACCOUNT_TOKEN=…(a 1Password service account),BW_SESSION=…(an unlocked Bitwarden session, which ends when the vault locks) orBWS_ACCESS_TOKEN=…(a Bitwarden Secrets Manager machine account) in, say,$OSCAR_HOME/manager.env(mode 0600), then runoscar gateway installagain (the unit names the files it loads) andoscar gateway restart. The unit'sPATHis the oneinstallsaw;vault_op/vault_bwcan name the programs' full paths. Acmd:helper must work without a terminal or a desktop prompt. Commands Oscar runs never see those variables (*_TOKEN,BW_SESSIONandOP_SESSION_*are kept out of their environment). A key that could not be read is in the service log and inoscar doctor; or keep plain keys incredentials.envfor the service.
Common provider errors
HTTP 401/key refused— a wrong, revoked or missing key, or an expired sign-in;oscar modelshows where the key comes from; for sign-in providers runoscar auth login <provider>.HTTP 429/rate limited— wait, add a second key, or configure a fallback.- "requires the … API, an API surface Oscar does not support yet" — pick
another model (
oscar model list). - "no provider configured" — run
oscar setup, or setOSCAR_PROVIDER,OSCAR_MODELand the provider's key. - "<provider> is not signed in" —
oscar auth login <provider>.