# OpenClaw Model Configuration: Providers and Model Switching

> Learn how to complete OpenClaw model configuration: understand the provider/model reference rules, use the openclaw models command to view, set, and switch…

Source: https://gaodong.ai/en/openclaw/1-start/05-models-overview

---

# Model Connection Overview: The Provider System and Model Switching {#连接模型总览-provider-体系与模型切换}

With OpenClaw installed and onboarding completed, you already have a working model. But OpenClaw itself does not come with a model — models all come from "provider plugins," and this is exactly the core of OpenClaw model configuration: which plugin to connect, which credentials to configure, and writing the model reference in the correct `provider/model` form.

This lesson (1.6) explains this whole system in one go: how to check the current state, how to list the catalog, how to set the default, how to switch anytime in chat, and how to connect a brand-new provider. Every model connection page that follows in 1.7–1.15 is a concrete application of these rules. This tutorial is based on v2026.10.9.

## What You'll Be Able to Do After This Lesson {#学完你能做什么}

- Tell which model your current OpenClaw is using: `openclaw models status` tells you at a glance
- Browse any provider's model catalog with `openclaw models list` — no more searching for "OpenClaw supported models"
- Change the default model with `openclaw models set <provider/model>`, no need to edit config files by hand
- Switch models anytime in chat with the `/model` command family: both temporary and persistent
- When connecting a new provider, recite the three-step order off the top of your head: install plugin → configure credentials → choose model

## Your Current Predicament {#你现在的困境}

- It works after installation, but you can't say clearly "which model am I actually using"; you want to switch to a cheaper or stronger one but don't know where to start
- Searching for "OpenClaw supported models" yields all kinds of answers, mixed with old commands from the Clawdbot / Moltbot era
- You see others editing `agents.defaults` in the config file and want to try it yourself, but you're afraid of breaking the Gateway so it won't start

## When to Use This Technique {#什么时候用这一招}

When you need to:

- Understand OpenClaw's model system — what's currently in use, what else is available, and how to switch
- Switch the default model to a domestic model (DeepSeek, Qwen, GLM...), or let different sessions use different models
- Temporarily switch to a stronger model mid-chat, then switch back when done

And you don't want to:

- Hand-edit the config file every time you switch models
- Get lost in the official provider catalog with 70+ entries
- Mix up "connecting a new model" with "switching an existing model" and flail around blindly

## 🎒 Prerequisites {#🎒-开始前的准备}

- [ ] Completed the [installation: up and running in 5 minutes OpenClaw](/openclaw/1-start/03-install): onboarding has configured at least one provider (Claude / Codex login or some API Key)
- [ ] Gateway is running: `openclaw gateway status` should show it listening on 18789 (you can still check models if it's not running, only `models list` will read the local cache directory)
- [ ] If you want to connect a new provider along the way, have that provider's API Key ready — starting from the next lesson, DeepSeek will be used as the example

## Core Idea {#核心思路}

**OpenClaw itself does not come with a model.** Models and agent harnesses (Claude, Codex, local models) are all swappable plugins. Connecting a model = one provider plugin + one set of credentials. OpenClaw Model configuration has only three concepts:

1. **provider** — a plugin for connecting a model vendor, with a unique id (e.g., `deepseek`, `qwen`, `anthropic`)
2. **model reference `provider/model`** — the unified way to name a specific model, e.g., `deepseek/deepseek-v4-pro`
3. **default model and switching** — write one default in the config; switch anytime in chat with `/model`

The reference rules are the foundation of this entire lesson:

| Rule | Example | Explanation |
|---|---|---|
| What comes before the first `/` is the provider id | `qwen/qwen3.5-plus` | provider ids are always lowercase (normalized) |
| When the model ID itself contains `/`, the full prefix must be kept | `openrouter/moonshotai/kimi-k2` | Split at the "first `/`"; a missing prefix means it won't be found |
| The spelling of the model ID follows the vendor | `minimax/MiniMax-M3` | MiniMax model IDs are case-sensitive; copy them exactly from the plugin catalog |

**Two ways to connect**, distinguished in one table:

| | Official provider plugins | Custom / relay endpoints |
|---|---|---|
| Applicable to | Models with official plugins (DeepSeek, Qwen, GLM, Kimi, MiniMax, etc.) | Models without official plugins, OpenAI-compatible relay stations, local inference services |
| Need to write `models.providers` config? | **No**: install plugin + set auth + pick a model | **Yes**: baseUrl, apiKey, models list |
| See | 1.7–1.13 dedicated pages for each provider | [More domestic models and custom relay endpoints](/openclaw/1-start/13-custom-relay) |

**The provider family** (the official [Provider directory](https://docs.openclaw.ai/providers) lists 70+ entries):

| Family | Representatives | How to connect | Dedicated page in this tutorial |
|---|---|---|---|
| Major international vendors | OpenAI (`openai`), Anthropic (`anthropic`), Google (`google`) | Built-in plugins; onboarding is reusable Claude Code / Codex CLI login | Covered in Quick Start |
| Domestic models | DeepSeek, Tongyi Qianwen, Zhipu GLM, Kimi, MiniMax, Doubao/Volcano, Hunyuan, Qianfan, StepFun, Xiaomi MiMo, LongCat | Official plugin + API Key | 1.7–1.13 One page per provider |
| Aggregator routing | OpenRouter, LiteLLM, ClawRouter | One key unlocks models from many providers | [1.14 Relay and more domestic models](/openclaw/1-start/13-custom-relay) |
| Local models | Ollama, vLLM, SGLang, LM Studio, ds4 | Run on your own machine, zero API cost | [1.15 Local models](/openclaw/1-start/14-local-models) |

Good news for users in China: mainstream domestic models are all "first-class citizens"—each has an official provider plugin, and starting from 1.7 there is a hands-on page for every one of them.

## Follow Along {#跟我做}

### Step 1: Check the current model configuration—`openclaw models status` {#第-1-步-查看当前模型配置——openclaw-models-status}

**Why**: onboarding configured the model for you, but many people can't say exactly which one they are using. See the current state clearly first, so every later step has something to compare against.

```bash
openclaw models status
```

**You should see**: two blocks of information—the resolved **default model and fallback chain** (full `provider/model` references), plus each provider's **credentials overview** (Auth overview: environment variables, provider configuration, and credential sources found in auth storage). When OAuth credentials are close to expiring (by default within 24 hours), a warning also appears here.

Three additional points:

- Bare `openclaw models` is equivalent to `openclaw models status`; add `--json` to get a machine-readable format
- Without `--probe`, it **does not send real model requests**—credentials "appearing to be there" doesn't mean they work; to actually test, add `--probe` (this makes real model calls, may consume tokens, and may trigger rate limits)
- Temporary switches within a single session are not visible to the CLI's status; use `/model status` inside that session instead

- [ ] `openclaw models status` shows the full `provider/model` reference of the current default model

### Step 2: Browse the model catalog—`openclaw models list` (see here for which models OpenClaw supports) {#第-2-步-浏览模型目录——openclaw-models-list-openclaw-支持哪些模型在这里看}

**Why**: check the goods before switching models. Each provider has its own model catalog: context window, input types, whether it's a reasoning model—it's all in the table.

```bash
openclaw models list                      # 当前已装 provider 的可见模型
openclaw models list --all                # 完整发布目录
openclaw models list --provider deepseek  # 只看一家
```

**You should see**: one model reference per line (in `provider/model` form). After `--provider` comes the **provider id** (e.g. `deepseek`, `moonshot`), not the display name (e.g. `Moonshot AI`).

Four practical details:

- Forgot the provider id? Run `openclaw models list --all` first and find it in the full catalog
- An unknown provider id causes an error exit (non-zero exit code) and names the rejected id
- Newly released models may not be in the local catalog; add `--refresh` to trigger rediscovery
- Saving a provider's credentials brings its models into the selectable catalog—so after connecting a new provider in step 5, remember to come back and refresh

- [ ] `openclaw models list --provider <你已配好的 provider>` lists its model catalog

### Step 3: Set the default model — the core step of OpenClaw model configuration {#第-3-步-设默认模型——openclaw-模型配置的核心一步}

**Why**: the default model determines what new sessions and scheduled tasks use. One line of command, no need to edit config files by hand.

```bash
openclaw models set deepseek/deepseek-v4-pro
```

(The example uses DeepSeek; this assumes its provider plugin is installed—if not, see step 5 first, or go straight to [Connecting DeepSeek](/openclaw/1-start/06-deepseek).)

**You should see**: the command succeeds without errors; run `openclaw models status` again and the default model is the new value.

What it does: writes the config entry `agents.defaults.model.primary`. The equivalent config file looks like this:

```json5
{
  agents: { defaults: { model: { primary: "deepseek/deepseek-v4-pro" } } },
}
```

Two foolproof rules (from the official CLI docs):

- **Unknown providers are rejected outright**: non-zero exit, config untouched—the provider in the reference must be an installed plugin or a configured provider
- **A warning is shown if the model is not in the catalog**: it doesn't block the write (newly released or self-hosted models may not be in the catalog yet), but it's worth double-checking the spelling

::: tip 💡 Two other ways to change the default
`openclaw models auth login --provider <id> --set-default` adopts that provider's recommended default model at login time; for the default image model, use `openclaw models set-image <provider/model>` (writes `agents.defaults.imageModel.primary`).
:::

- [ ] `openclaw models set <provider/model>` executes successfully (or you understand why it rejected you)

### Step 4: Switch models in chat—the `/model` command family {#第-4-步-聊天里切换模型——-model-命令族}

**Why**: what you set in the terminal is the "default"; in chat you can switch anytime—temporarily switch to a stronger model, switch back when done, and the global config stays untouched.

```text
/model                              # See what the current session uses
/model list                         # Browse providers (/models also works)
/model deepseek/deepseek-v4-pro     # Switches only the current session (default behavior)
/model deepseek/deepseek-v4-pro -a  # Also updates this agent's default (requires owner/admin)
/model deepseek/deepseek-v4-pro -g  # Updates the global default (requires owner/admin)
/model default -s                   # Clears the session selection and falls back to the configured default
/model status                       # Credential candidates and baseUrl / api mode for each provider
```

**You should see**: the switch takes effect immediately—when the agent is idle, the next run uses the new model; if it is running, the switch is queued to the next safe switching point.`/models <provider>` lists all models of a given provider.

Three quirks to know about:

- **The in-session selection is "strict"**: if the selected model is unreachable, it errors out directly instead of silently falling through the fallback chain (only the configured default uses fallbacks)
- **Numeric selection is not supported** (`/model 3` is invalid); Discord / Telegram have a native picker interface
- When the model ID itself contains `/`, you must write the full prefix: `/model openrouter/moonshotai/kimi-k2`

Beyond `/model` there is a whole family of chat commands such as `/think` and `/new`; see [Chat Commands Crash Course](/openclaw/2-daily/02-chat-commands).

- [ ] After switching with `/model <provider/model>` in chat, the next reply comes from the new model

### Step 5: Connect a new provider—install the plugin, configure credentials, pick a model {#第-5-步-接入新-provider——装插件、配凭据、选模型}

**Why**: once you spot a model you like in the catalog, first let OpenClaw "get to know" it. Official provider plugins follow a fixed three steps:

```text
① Install the plugin (needed for some providers) → ② Configure credentials (openclaw onboard) → ③ Pick a model
```

Take DeepSeek as an example (it is an external official plugin and needs to be installed):

```bash
openclaw plugins install @openclaw/deepseek-provider
openclaw onboard --auth-choice deepseek-api-key
```

**You should see**: onboarding detects existing AI access → waits for you to choose a provider → **after the connection check passes, only usable routes are saved** → continues configuring the rest. After choosing `--auth-choice`, the default model picker is pre-filtered to that provider's models (sibling providers of the same plugin are also matched together, e.g. `volcengine` / `volcengine-plan`).

Three things to keep in mind:

- **Whether the plugin needs installing varies by provider**: MiniMax is a bundled plugin, so `openclaw plugins enable minimax` is enough; external plugins like DeepSeek, Qwen, GLM, and Kimi require `openclaw plugins install @openclaw/<名字>-provider`. Each provider's exact command is given at the start of its 1.7–1.13 dedicated page
- **Official plugins do not require a `models.providers` config entry**—install the plugin, set auth, pick a model, three steps and done; you only write one for custom endpoints or overriding baseUrl (see 1.14)
- **Re-running onboard does not wipe existing model configuration**; for changes to model providers or auth routing, the official recommendation is to run `openclaw onboard` (`openclaw configure` is reserved for non-inference settings)

For models without official plugins yet, such as 01.AI Yi, Baichuan, and iFlytek Spark, use a custom OpenAI-compatible endpoint or an aggregator; see [More Domestic Models and Custom Relay Endpoints](/openclaw/1-start/13-custom-relay). If you don't want to spend money on APIs, [Local Models](/openclaw/1-start/14-local-models) teaches you to run models locally with Ollama and vLLM.

- [ ] You can recite the three-step order for connecting a new provider off the top of your head: install the plugin → configure credentials → pick a model

## Checkpoint ✅ {#检查点-✅}

- [ ] `openclaw models status` can state the full `provider/model` reference of the current default model
- [ ] `openclaw models list --provider <id>` can list a provider's model catalog
- [ ] `openclaw models set <provider/model>` changing the default succeeds (or you understand why it refuses)
- [ ] switching with `/model <provider/model>` in chat takes effect, and `/model default -s` can switch back to the default
- [ ] you can state the three-step order for connecting a new provider: install the plugin → configure credentials → pick a model

## Pitfall Reminders {#踩坑提醒}

### ❌ Model reference missing the provider prefix {#❌-模型引用漏了-provider-前缀}

Cause: OpenClaw splits references at the "first `/`". When the provider is omitted, it first tries aliases, then a uniquely matching configured provider, and only last the default provider (already deprecated behavior)—one more model with the same name and the selection fails.

```text
/model kimi-k2                        # ❌ Fails to match in most cases
/model kimi/kimi-for-coding           # ✅ Include the provider prefix
/model openrouter/moonshotai/kimi-k2  # ✅ When the model ID contains /, the full prefix is required
```

Correct approach: always write references as full `provider/model`; if unsure, run `openclaw models list --provider <id>` first and copy exactly what the catalog shows (model IDs from MiniMax and similar vendors are case-sensitive).

### ❌ You configured a new provider's key and assumed the default model would switch automatically {#❌-配了新-provider-的-key-以为默认模型会自动换}

Cause: saving a new provider's credentials **does not** change the existing default model—in the official Quick rules' own words: "Adding provider auth does not change your primary model"; only an explicit `--set-default` switches it.

Correct approach: to change the default, run `openclaw models set <provider/model>`, or use `openclaw models auth login --provider <id> --set-default` when logging in. If the symptoms don't match, first run `openclaw models status` to see what the default actually is.

### ❌ After installing the Gateway as a daemon, the exported API key "doesn't take effect" {#❌-gateway-装成守护进程后-export-的-api-key「不生效」}

Cause: when the Gateway runs as a launchd / systemd service, it cannot see the environment variables from `export` in your interactive shell—every provider's documentation specifically calls this out.

Correct approach: put the key in `~/.openclaw/.env`, or provide it via `env.shellEnv` in the config; after changing the key, remember to restart the Gateway service.

### ❌ You used a retired old model ID {#❌-用了退役的旧模型-id}

Cause: models get retired. DeepSeek's `deepseek-chat` / `deepseek-reasoner` were retired on 2026-07-24; the old IDs are no longer usable.

Correct approach: run `openclaw models list --provider deepseek` to see the current catalog and use new IDs like `deepseek/deepseek-v4-pro` and `deepseek/deepseek-v4-flash`; for migration details see the next lesson [Connecting DeepSeek](/openclaw/1-start/06-deepseek).

## Advanced Tips (Optional) {#进阶技巧-可选}

**Configure a fallback chain for the default model.** Models in `agents.defaults.model.fallbacks` are tried in order; credential rotation happens within a provider before falling to the next fallback model. CLI management:

```bash
openclaw models fallbacks list
openclaw models fallbacks add deepseek/deepseek-v4-flash
openclaw models fallbacks remove <model-or-alias>
openclaw models fallbacks clear
```

**Let OpenClaw pick free fallbacks for you.** `openclaw models scan` reads OpenRouter's public `:free` catalog and ranks candidates by image support, tool latency, context, and so on. Two notes: the metadata scan needs no key, while live checks and `--set-default` require `OPENROUTER_API_KEY`; **a scan with probing writes to the config** (directly replacing fallbacks)—add `--no-probe` if you only want to look.

**Give a model an alias.** After `openclaw models aliases add Opus anthropic/claude-opus-5-5`, `/model Opus` selects it in chat. Aliases are stored in `agents.defaults.models.<key>.alias`; a model has only one alias at a time, and adding a new one replaces the old.

**Specify a model for a single run.** If you don't want to change any configuration and just want a one-off run:

```bash
openclaw agent --model deepseek/deepseek-v4-pro --message "..."
```

**You can also manage models in the Control UI.** The Gateway's Models page offers the same login flow as the CLI; Settings → Models → Set API key lets you swap the key directly, and once changed it clears that credential's cooldown and failure counters, so the next request can be attempted immediately.

**Update the hosted model catalog.** `openclaw models refresh` pulls the official hosted metadata catalog (new models enter the catalog through this); it requires the local Gateway to be stopped first (`openclaw gateway stop`), then restart it after the refresh.

## Lesson Summary {#本课小结}

✅ The three concepts of OpenClaw model configuration are clear: provider (plugin + credentials), `provider/model` references, default model and switching.

✅ The command chain of check → list → set → switch works: `models status` to see the current state, `models list` to see the catalog, `models set` to set the default, `/model` to switch in chat.

✅ The three steps for onboarding a new provider are settled: install the plugin (if needed) → `openclaw onboard --auth-choice <id>` to configure credentials → pick a model; official plugins don't require writing `models.providers`.

✅ Two behaviors to remember: in-session `/model` selection is a strict match with no fallback; in daemon mode the key must go into `~/.openclaw/.env`.

| Configuration field / command | Form / recommended value | Description |
|---|---|---|
| `agents.defaults.model.primary` | `"provider/model"` | Default model; `openclaw models set` writes it here |
| `agents.defaults.model.fallbacks` | Model reference list | Fallback chain, tried in order |
| `agents.defaults.models.<key>.alias` | Alias string | Quick entry for `/model <别名>` |
| `models.providers.<id>` | Only write for custom endpoints | Not needed for official plugins |
| `~/.openclaw/.env` | `PROVIDER_API_KEY=...` | Where the key lives in daemon mode |
| `openclaw onboard --auth-choice <id>` | See each provider's dedicated page for values | Configure / replace provider credentials |

See [CLI Commands and Configuration Cheat Sheet](/openclaw/reference/01-cli-config) for the complete command quick-reference list.

## Next Lesson Preview {#下一课预告}

Now that the system is clear, starting from the next lesson we'll go hands-on with each provider — the first one is DeepSeek, the most widely used. Next lesson: [Connecting to DeepSeek: V4 Series Model Configuration in Practice](/openclaw/1-start/06-deepseek).

You will learn:

- DeepSeek V4 series model catalog: `deepseek-v4-pro` / `deepseek-v4-flash` and how to choose
- `DEEPSEEK_API_KEY` full configuration walkthrough: plugin installation, onboarding, and three ways to write the configuration file
- Migration after the old IDs `deepseek-chat` / `deepseek-reasoner` are retired
- DeepSeek-specific capabilities: thinking levels, DSML tool recovery, web_search

## Related Tutorials {#相关教程}

- [More domestic models and custom relay endpoints](/openclaw/1-start/13-custom-relay)
- [Local models: Ollama, vLLM and ds4](/openclaw/1-start/14-local-models)
- [Chat commands crash course: /model, /think and slash commands](/openclaw/2-daily/02-chat-commands)
