Model failover
Auth profile rotation, cooldowns, and how that interacts with fallbacks.
Model providers
Quick provider overview and examples.
Models CLI reference
Full
openclaw models command and flag reference.Configuration reference
Model config keys, defaults, and examples.
provider/model) chooses a provider and model. It does not usually choose the low-level agent runtime. OpenAI is the main exception: openai/gpt-5.5 runs through the Codex app-server runtime by default on the official OpenAI provider. Subscription Copilot refs (github-copilot/*) can be opted into the external GitHub Copilot agent runtime plugin, but that path is always explicit (never selected by auto). Runtime overrides belong on provider/model policy, not on the whole agent or session. In Codex runtime mode, openai/gpt-* does not imply API-key billing; auth can come from a Codex account or an openai OAuth profile. See Agent runtimes and GitHub Copilot agent runtime.
Selection order
Related model-config surfaces:
agents.defaults.modelsis the allowlist/catalog of models OpenClaw can use, plus aliases. Useprovider/*entries to allow every discovered model from a provider without listing each one.agents.defaults.utilityModelis an optional lower-cost model for short internal tasks such as generated dashboard session titles and supported channel thread/topic titles. Per-agentagents.list[].utilityModeloverrides it. When unset, these tasks use the agent’s primary model. Utility tasks are separate model calls and may send bounded task content to the selected model provider.agents.defaults.imageModelis used only when the primary model cannot accept images.agents.defaults.pdfModelis used by thepdftool. If unset, the tool falls back toimageModel, then the resolved session/default model.agents.defaults.imageGenerationModel,musicGenerationModel, andvideoGenerationModelback the shared media-generation tools. If unset, each tool infers an auth-backed provider default: current default provider first, then the remaining registered providers for that capability in provider-id order. Setagents.defaults.mediaGenerationAutoProviderFallback: falseto disable that cross-provider inference while keeping explicit fallbacks.- Per-agent
agents.list[].model(plus bindings) overridesagents.defaults.model— see Multi-agent routing.
Selection source and fallback strictness
The sameprovider/model behaves differently depending on where it came from:
| Source | Behavior |
|---|---|
Configured default (agents.defaults.model.primary, per-agent primary) | Normal starting point; uses agents.defaults.model.fallbacks. |
| Auto fallback | Temporary recovery state, stored as modelOverrideSource: "auto". OpenClaw periodically reprobes the original primary, clears the auto selection on recovery, and announces fallback/recovery transitions once per state change. |
| User session selection | Exact and strict. /model, the model picker, session_status(model=...), and sessions.patch store modelOverrideSource: "user". If that provider/model becomes unreachable, the run fails visibly instead of falling through to another configured model. |
Cron --model / payload model | Per-job primary. Still uses configured fallbacks unless the job supplies its own payload fallbacks (fallbacks: [] forces a strict run). |
- Changing
agents.defaults.model.primarydoes not rewrite existing session pins. If status reportsThis session is pinned to X; config primary Y will apply to new/unpinned sessions., run/model defaultto clear the pin. - CLI default-model and allowlist pickers respect
models.mode: "replace"by listing onlymodels.providers.*.modelsinstead of the full built-in catalog. - The Control UI model picker asks the Gateway for its configured model view:
agents.defaults.modelswhen set (includingprovider/*wildcard entries), otherwisemodels.providers.*.modelsplus providers with usable auth. The full built-in catalog is reserved for explicit browse views (models.listwithview: "all", oropenclaw models list --all).
Quick model policy
- Set your primary to the strongest latest-generation model available to you.
- Use fallbacks for cost/latency-sensitive tasks and lower-stakes chat.
- For tool-enabled agents or untrusted inputs, avoid older/weaker model tiers.
Onboarding
”Model is not allowed” (and why replies stop)
Ifagents.defaults.models is set, it becomes the allowlist for /model and session overrides. Selecting a model outside that allowlist returns, before any normal reply is generated:
agents.defaults.models, clearing the allowlist entirely (remove the key), or picking a model from /model list. If the rejected command included a runtime override such as /model openai/gpt-5.5 --runtime codex, fix the allowlist first, then retry the same /model ... --runtime ... command.
For local/GGUF models, the allowlist needs the full provider-prefixed ref, for example ollama/gemma4:26b or lmstudio/Gemma4-26b-a4-it-gguf — check openclaw models list --provider <provider> for the exact string. Bare filenames or display names are not enough once the allowlist is active.
To limit providers without listing every model, use provider/* wildcard entries:
/model, /models, and model pickers then show the discovered catalog for those providers only, and new models can appear without editing the allowlist. Mix exact provider/model entries with provider/* entries to pull in one specific model from another provider.
Example allowlist with aliases:
Safe allowlist edits from the CLI
Safe allowlist edits from the CLI
Use
--merge for additive changes:openclaw config set refuses plain-object assignments to agents.defaults.models, models.providers, or models.providers.<id>.models when they would drop existing entries; use --replace only when the new value should become the complete target value. Interactive provider setup and openclaw configure --section model already merge provider-scoped selections into the allowlist, so adding a provider does not drop unrelated entries; configure preserves an existing agents.defaults.model.primary. Explicit commands like openclaw models auth login --provider <id> --set-default and openclaw models set <model> still replace the primary./model in chat
/modeland/model listshow a compact numbered picker (model family + available providers);/model <#>selects from it. On Discord this opens provider/model dropdowns with a Submit step; on Telegram, picker selections are session-scoped and never rewrite the agent’s persistent default inopenclaw.json./models addis deprecated and returns a message instead of registering models from chat./modelpersists the new session selection immediately. If the agent is idle, the next run uses it right away; if a run is already active, the switch is queued for the next clean retry point (or a later one, if tool activity or reply output already started)./model defaultclears the session selection so it inherits the configured primary again.- A user-selected
/modelref is strict for that session: if it becomes unreachable, the reply fails visibly instead of silently falling back throughagents.defaults.model.fallbacks. Configured defaults and cron job primaries still use fallback chains. /model statusis the detailed view: auth candidates per provider, and (when configured) the provider endpointbaseUrlplusapimode.- Model refs are parsed by splitting on the first
/; typeprovider/model. If the model ID itself contains/(OpenRouter-style), include the provider prefix, e.g./model openrouter/moonshotai/kimi-k2. If you omit the provider, OpenClaw tries: (1) alias match, (2) unique configured-provider match for that exact unprefixed model id, (3) the configured default provider (deprecated fallback) — and if that provider no longer exposes the configured default model, the first configured provider/model instead, to avoid surfacing a stale removed-provider default. - Model refs are normalized to lowercase; provider IDs are otherwise exact, so use the ID advertised by the plugin.
CLI
openclaw models with no subcommand is a shortcut for models status, which also surfaces OAuth expiry for auth-store profiles (warns within 24h by default). Full flags, JSON shapes, and auth-profile subcommands: Models CLI reference.
Scanning (OpenRouter free models)
Scanning (OpenRouter free models)
openclaw models scan inspects OpenRouter’s public free-model catalog and can probe candidates for tool and image support live. The catalog itself is public, so metadata-only scans (--no-probe) need no key; live probing and --set-default/--set-image require an OpenRouter API key (auth profile or OPENROUTER_API_KEY) and fail closed to metadata-only output without one.Results rank by: image support, then tool latency, then context size, then parameter count. In a TTY, probed results prompt an interactive fallback selection; non-interactive mode needs --yes to accept defaults.Models registry (models.json)
Custom providers configured under models.providers are written into models.json under the agent directory (default ~/.openclaw/agents/<agentId>/agent/models.json). Provider-plugin catalogs are stored separately as generated plugin-owned catalog shards and load automatically. This file is merged with config by default; set models.mode: "replace" to use only your configured providers.
Merge mode precedence
Merge mode precedence
For matching provider IDs:
- A non-empty
baseUrlalready present in the agentmodels.jsonwins. - A non-empty
apiKeyinmodels.jsonwins only when that provider is not SecretRef-managed in the current config/auth-profile context. - SecretRef-managed
apiKeyvalues refresh from source markers instead of persisting resolved secrets: the env variable name for env refs,secretref-managedfor file/exec refs. - SecretRef-managed header values refresh the same way, using
secretref-env:ENV_VAR_NAMEfor env refs. - Empty or missing
apiKey/baseUrlinmodels.jsonfall back to configmodels.providers. - Other provider fields refresh from config and normalized catalog data.
models.json — including command-driven paths like openclaw agent.
Related
- Agent runtimes — OpenClaw, Codex, and other agent loop runtimes
- Configuration reference — model config keys
- Image generation — image model configuration
- Model failover — fallback chains
- Model providers — provider routing and auth
- Models CLI reference — full command and flag reference
- Music generation — music model configuration
- Video generation — video model configuration