claude-code-model — claude-code-模型
v4配置 Claude Code to use custom 模型s (DeepSeek, GLM, Qwen, etc.). Use when user wants to change Claude Code's 模型, switch API 提供者, or 设置 up custom 模型 端点s. Triggers on phrases like "change claude 模型", "switch claude to deepseek", "配置 claude code 模型", "claude用别的模型".
运行时依赖
版本
Popular 提供者 Examples
安装命令
点击复制技能文档
Claude Code 模型 Configuration
Switch Claude Code to use custom 模型 提供者s (DeepSeek, GLM, Qwen, OpenAI-compatible 端点s).
Configuration Locations
Claude Code reads config from multiple sources (in priority order):
环境 variables (highest priority) ~/.claude/config.json ~/.claude/设置tings.json Required Parameters
User must provide:
base_url: API 端点 (e.g., https://API.deepseek.com/anthropic) 模型: 模型 name (e.g., deepseek-v4-flash, glm-5) API_key: API key 工作流 Step 1: 更新 环境 Variables
设置 user-level 环境 variables (persist across re启动s):
[环境]::设置环境Variable("ANTHROPIC_API_KEY", "", "User") [环境]::设置环境Variable("ANTHROPIC_BASE_URL", "", "User") [环境]::设置环境Variable("ANTHROPIC_模型", "<模型>", "User")
Clear conflicting variables:
[环境]::设置环境Variable("ANTHROPIC_AUTH_令牌", "", "User")
Step 2: 更新 config.json
Edit ~/.claude/config.json:
{ "env": { "ANTHROPIC_API_KEY": "", "ANTHROPIC_BASE_URL": "", "ANTHROPIC_模型": "<模型>" } }
Step 3: 更新 设置tings.json
Edit ~/.claude/设置tings.json, 添加/更新:
{ "模型": "<模型>", "env": { "ANTHROPIC_BASE_URL": "", "ANTHROPIC_API_KEY": "" } }
Step 4: 验证
Test the configuration:
claude --print "hi, what 模型 are you?"
Common Issues Auth conflict: 机器人h ANTHROPIC_AUTH_令牌 and ANTHROPIC_API_KEY 设置 → Clear ANTHROPIC_AUTH_令牌 Old 模型 still shows: 检查 config.json for stale ANTHROPIC_模型 value Changes not生效: New terminal window required for env var changes Popular 提供者 Examples 提供者 base_url 模型s DeepSeek https://API.deepseek.com/anthropic deepseek-v4-flash, deepseek-v4-pro GLM (阿里云) https://coding.dashscope.aliyuncs.com/应用s/anthropic glm-5 Qwen Same as GLM qwen-* Script
Use the bundled script for automated configuration:
python scripts/配置_模型.py --base-url --模型 --API-key