Install
openclaw skills install @moonbird0423/claude-code-modelConfigure Claude Code to use custom models (DeepSeek, GLM, Qwen, etc.). Use when user wants to change Claude Code's model, switch API provider, or set up custom model endpoints. Triggers on phrases like "change claude model", "switch claude to deepseek", "configure claude code model", "claude用别的模型".
openclaw skills install @moonbird0423/claude-code-modelSwitch Claude Code to use custom model providers (DeepSeek, GLM, Qwen, OpenAI-compatible endpoints).
Claude Code reads config from multiple sources (in priority order):
~/.claude/config.json~/.claude/settings.jsonUser must provide:
https://api.deepseek.com/anthropic)deepseek-v4-flash, glm-5)Set user-level environment variables (persist across restarts):
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "<api_key>", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "<base_url>", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "<model>", "User")
Clear conflicting variables:
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "", "User")
Edit ~/.claude/config.json:
{
"env": {
"ANTHROPIC_API_KEY": "<api_key>",
"ANTHROPIC_BASE_URL": "<base_url>",
"ANTHROPIC_MODEL": "<model>"
}
}
Edit ~/.claude/settings.json, add/update:
{
"model": "<model>",
"env": {
"ANTHROPIC_BASE_URL": "<base_url>",
"ANTHROPIC_API_KEY": "<api_key>"
}
}
Test the configuration:
claude --print "hi, what model are you?"
ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY set → Clear ANTHROPIC_AUTH_TOKENconfig.json for stale ANTHROPIC_MODEL value| Provider | base_url | Models |
|---|---|---|
| DeepSeek | https://api.deepseek.com/anthropic | deepseek-v4-flash, deepseek-v4-pro |
| GLM (阿里云) | https://coding.dashscope.aliyuncs.com/apps/anthropic | glm-5 |
| Qwen | Same as GLM | qwen-* |
Use the bundled script for automated configuration:
python scripts/configure_model.py --base-url <url> --model <name> --api-key <key>