
OpenClaw Model Switch
FreeEasily manage OpenClaw model configurations.
Free · Opens the source repo
What OpenClaw Model Switch does
OpenClaw Model Switch is a specialized tool designed for developers and engineers working with OpenClaw instances. It allows users to switch, upgrade, or rollback the model configuration of their OpenClaw setup, addressing common issues such as model misconfigurations and errors during LLM calls. This skill is particularly useful when users encounter problems like 'Invalid token' or 'No available channel/model not found', which can disrupt the functionality of the OpenClaw bot.
The skill operates by modifying the openclaw.json configuration file safely and efficiently. Before making any changes, users are advised to diagnose the underlying issues, as many model failures are not due to the model ID itself but rather due to environmental hijacking, provider-plugin restrictions, or endpoint mismatches. The included troubleshooting reference provides a comprehensive guide to identifying and resolving these issues, ensuring that users can effectively manage their OpenClaw configurations without unnecessary debugging sessions.
To switch models, users can utilize the provided Python script, switch-model.py, which automates the process of discovering configuration files, backing them up, and applying the necessary changes. The script also handles restarting the gateway to ensure that the new configuration takes effect. After making changes, it is crucial to verify the setup by running a test agent turn to confirm that the model is functioning correctly and that there are no fallback errors.
Overall, OpenClaw Model Switch is an essential tool for anyone managing OpenClaw instances, providing a structured approach to model configuration that minimizes downtime and maximizes efficiency.
When to use it
Use this skill when you need to change the model configuration of an OpenClaw instance or when you encounter errors related to model availability.
When not to use it
This skill is not suitable for users who do not have access to OpenClaw or those who are not familiar with model configurations and troubleshooting.
What you can build with it
Switching to a New Model
When a user wants to upgrade to a newer model version in their OpenClaw instance.
Resolving Configuration Errors
When the OpenClaw bot is returning errors related to model availability or configuration.
Testing Model Functionality
After making changes to the model configuration, users can verify the setup by running a test agent turn.
How to install OpenClaw Model Switch
View source1. Install with the skills CLI
npx skills add daymade/claude-code-skills/openclaw-model-switch --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by daymadeOpenClaw Model Switch
Switch or repair an OpenClaw instance's model configuration by safely editing openclaw.json.
Diagnose before you edit. Model failures on OpenClaw are usually NOT the model id — they are key routing (env hijack), provider-plugin restrictions, or endpoint/model mismatch. Changing the model id without checking these first is how a 5-minute fix becomes a 2-hour debugging session. The full trap catalog with discovery commands lives in references/troubleshooting-model-config.md — read it the moment anything errors.
Step 1 — Find the real config file(s)
Do NOT assume a hardcoded path. Candidate locations (check all, edit all that exist):
~/.openclaw/openclaw.json— the gateway's live config on most installs~/.kimi/kimi-claw/openclaw.json— Kimi Claw mirror, kept in sync on some installs~/.kimi_openclaw/openclaw.json— legacy desktop path
Confirm which one the gateway actually reads: openclaw gateway status prints
Config (service): <path>. If several exist, treat them as mirrors: edit all of them
identically, otherwise the next sync overwrites your fix.
Step 2 — Probe the endpoint + model BEFORE touching config
Never trust a relay's model listing (GET /v1/models on new-api style relays is frequently
incomplete — a model can be absent from the list yet serve fine). The only authority is a
real completion probe from the host that will run the bot:
curl -sS -o /tmp/probe.json -w "HTTP %{http_code}\n" \
-X POST "<baseUrl>/v1/messages" \
-H "Authorization: Bearer <apiKey>" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{"model":"<model-id>","max_tokens":16,"messages":[{"role":"user","content":"hi"}]}'
Expected: HTTP 200 and a content array in the body. 401 Invalid token with a token you
just verified works elsewhere → the wire key is being hijacked (see trap #1 in the
troubleshooting reference). 503 No available channel → the model is not served for this
token/group from this network (trap #3) — pick a served model or fix the relay, don't
blind-switch.
Step 3 — Switch the model
python3 scripts/switch-model.py <model-id> --restart
# target a specific provider instead of the guessed one:
python3 scripts/switch-model.py k3 --provider kimi-relay --restart
# explicit config path (skips discovery):
python3 scripts/switch-model.py k3 --config ~/.openclaw/openclaw.json --restart
The script: discovers and backs up every candidate config to <config-dir>/config-backups/,
adds the model definition if known, sets agents.defaults.model.primary, syncs mirror
files, and restarts the gateway with --restart.
Step 4 — Verify end-to-end (mandatory)
A restarted gateway proves nothing. Run one real agent turn and read the result metadata:
openclaw agent --local --json --agent main --session-id verify-$(date +%s) -m "ping"
Success looks like: "result": "success", "fallbackUsed": false, and the gateway log shows
agent model: <provider>/<model> (thinking=...). "result": "success" with
fallbackUsed: true means your target failed and a fallback saved the turn — the config is
still wrong.
Common failures → read the troubleshooting reference
| Symptom | Most likely trap |
|---|---|
LLM error new_api_error: Invalid token, but the token works in curl | Trap #1 — env KIMI_API_KEY hijacks the provider's wire key |
Thinking level "max" is not supported ... Use one of: off, on | Trap #2 — kimi-provider plugin hardcodes binary thinking; bypass with a custom provider |
Thinking level ... Use one of: off, minimal, low, medium, high | Trap #2 variant — anthropic-messages base profile; unlock via params.canonicalModelId |
503 No available channel for model X under group default | Trap #3 — model not served for this group/network; listing ≠ availability |
| Edit saved + gateway restarted, nothing changed | Trap #5 — edited the wrong file / mirror not synced |
Safety rules
- Always backup before editing (the script does this; manual edits: copy to
config-backups/first) - Preserve existing
apiKey,headers, plugin configs, andenvblocks — retype only the fields you mean to change - Validate JSON after manual edits:
python3 -m json.tool openclaw.json > /dev/null - Do not commit config files containing API keys to version control
- After changing anything, redo the Step-4 verification — and if it fails, restore the newest backup before trying something else
Resources
- scripts/switch-model.py — model switcher with config discovery, backup, mirror sync, and restart
- references/kimi-models.md — known model specs (k3, k2p6, kimi-k2.7-code) and config snippets
- references/troubleshooting-model-config.md — the trap catalog: env key hijack, plugin binary thinking, canonicalModelId, relay availability, config discovery. Read on any error.
Frequently asked questions about OpenClaw Model Switch
Similar skills
Arize Evaluator
Streamline LLM evaluation workflows on Arize.
Troubleshoot
Analyze logs to understand chat agent behavior.
Agentic Evaluation
Enhance AI outputs through iterative evaluation and refinement.
RAG Evaluation
Evaluate retrieval-augmented generation benchmarks efficiently.
NV-Reason-CXR
Run smoke tests for chest X-ray reasoning models.
Clinical ASR Evaluation
Score and evaluate clinical ASR manifests effectively.
