OpenClaw Model Switch
Switch the default AI model used by OpenClaw by safely modifying openclaw.json.
Quick Start
Run the switch script:
python3 scripts/switch-model.py <model-id> --restart
Example — upgrade to K2.7:
python3 scripts/switch-model.py kimi-k2.7-code --restart
Example — roll back to K2.6:
python3 scripts/switch-model.py k2p6 --restart
What This Script Does
- Backs up the current
openclaw.jsonto~/.kimi_openclaw/config-backups/ - Adds the target model definition to the provider's
modelsarray (if missing) - Updates
agents.defaults.model.primaryto point to the new model - Restarts the OpenClaw gateway (with
--restartflag)
When to Use
- Upgrading to a newly released model (e.g., K2.6 → K2.7)
- Switching between models for different tasks
- Rolling back after testing a new model
- Adding a model definition that the user knows exists but isn't configured
Workflow
Manual Switch (if script unavailable)
- Read
~/.kimi_openclaw/openclaw.json - Back it up manually to
config-backups/ - Add model definition to
models.providers.kimi-coding.models(see references/kimi-models.md) - Set
agents.defaults.model.primarytokimi-coding/<model-id> - Save valid JSON
- Restart gateway:
openclaw gateway restart(or restart Kimi desktop)
Verification
After restart, confirm the active model via:
- System prompt metadata: check
model=anddefault_model=fields - Or run:
openclaw status(if available)
Safety Rules
- Always backup before editing
openclaw.json - Preserve existing
apiKey,headers, and plugin configurations - Validate JSON after manual edits (use
python3 -m json.tool openclaw.json) - Do not commit config files containing API keys to version control
Resources
- scripts/switch-model.py — Automated model switcher with backup and restart
- references/kimi-models.md — Model specs, config snippets, and troubleshooting