Use DeepSeek, Qwen, Kimi, GLM in Claude Code: config guide
Claude Code reads ANTHROPIC_BASE_URL (endpoint override), ANTHROPIC_AUTH_TOKEN (sent as Bearer) or ANTHROPIC_API_KEY (X-Api-Key), and ANTHROPIC_MODEL; they can also go in the env block of ~/.claude/settings.json. Live-tested: DeepSeek (Claude Code 2.1.302, text + tool calls pass). (source · verified )
Reference price via DeepSeek: DeepSeek V4.1 Flash 1017: blended $0.524 per 1M tokens (official China site). (source · verified )
One-line install (optional)
The script installs Claude Code / Codex (your choice), writes DeepSeek into settings.json / config.toml, and runs one short live request with your key. The key is never a CLI argument (stays out of shell history); type it hidden, or set APIPRICE_API_KEY.
macOS / Linux:
curl -fsSL https://apiprice.app/install.sh | bash -s -- --tool claude-code
Windows (PowerShell 5.1 or 7):
& ([scriptblock]::Create((irm https://apiprice.app/install.ps1))) -Tool claude-code
Undo: curl -fsSL https://apiprice.app/install.sh | bash -s -- --uninstall --tool claude-code · & ([scriptblock]::Create((irm https://apiprice.app/install.ps1))) -Uninstall -Tool claude-code
Assets: install.sh ·
install.ps1 ·
codex-models.json
Tested
- Linux x86_64 (local): binary / npm install, config merge + uninstall restore, Claude Code and Codex text + tool calls (Codex with -s workspace-write, sandbox on).
- macOS ARM64 (GitHub Actions macos-latest, bash and zsh): same, including Claude Code and Codex tool calls (sandbox on).
- Windows x64 (GitHub Actions windows-latest, PowerShell 5.1 and pwsh 7): binary / npm install, PATH registry restore, Claude Code text + tool calls (Write+Read), Codex text call.
Uncovered / unverified
- Windows Codex tool calls with sandbox on: not verified. The script does not pass -s danger-full-access on Windows (sandbox stays on); the deep tool-call test is skipped on Windows. A prior path that used danger-full-access is not treated as verified.
- ARM Windows: not tested.
- Intel Mac (x86_64): not tested (CI is ARM64).
- Claude Code Bash tool on Windows (needs Git for Windows): not tested; without Git the script warns that PowerShell is used as the shell tool.
- PowerShell ExecutionPolicy = Restricted: full install flow not run under Restricted; the script detects it and suggests RemoteSigned, or running the .cmd shim.
- macOS Gatekeeper quarantine on browser downloads (com.apple.quarantine): not tested (CI / curl pipe are unaffected).
- npmmirror.com: deliberately checked on the Linux local path only; Windows / macOS CI may auto-select it, but it is not claimed as a verified mirror there.
Claude Code reads ANTHROPIC_BASE_URL (endpoint override), ANTHROPIC_AUTH_TOKEN (sent as Bearer) or ANTHROPIC_API_KEY (X-Api-Key), and ANTHROPIC_MODEL; they can also go in the env block of ~/.claude/settings.json. Official docs
DeepSeek
shell
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_API_KEY=${YOUR_API_KEY}
export ANTHROPIC_MODEL=deepseek-flash Text call passes Tool call passes Tested 2026-10-17 with Claude Code 2.1.302: text OK; Write+Read tool calls passed on Linux local, macOS ARM CI, Windows x64 CI. Claude Bash tool on Windows (needs Git for Windows) not tested.
Model names are matched by prefix: only names starting with claude-opus (e.g. claude-opus-4-1) map to deepseek-v4-pro and bill at the V4 Pro price; claude-sonnet*, claude-haiku*, older names such as claude-3-opus-* and any other claude* name map to deepseek-flash under the official prefix rule and bill at the Flash price. DeepSeek Anthropic API guide
Alibaba Qwen
~/.claude/settings.json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/apps/anthropic",
"ANTHROPIC_MODEL": "qwen3.7-plus"
}
} Pay-as-you-go uses a Model Studio API key (sk-…); Coding Plan uses https://coding.dashscope.aliyuncs.com/apps/anthropic
Moonshot AI Kimi
No officially documented setup for this tool yet.
Kimi also offers an Anthropic-compatible Messages API (URL not on this page; unverified)
Zhipu GLM
~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2[1m]"
}
} Official route: run Coding Tool Helper; for GLM-5.2 1M context add the env above to ~/.claude/settings.json
Field names come from the linked official docs; replace placeholders with your key. Examples marked “to be verified” combine the tool’s documented fields with the provider’s OpenAI-compatible endpoint and were not run.