中文

Guides

Use DeepSeek, Qwen, Kimi, GLM in Claude Code: config guide

Answer

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: blended $0.523 per 1M tokens (official China site). (source · verified)

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 using the config above: text reply OK; Write created a file in a temp dir and Read returned the same content.

Provider docs · Pricing

Alibaba Qwen (Model Studio)

~/.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 Bailian API key (sk-…); Coding Plan uses https://coding.dashscope.aliyuncs.com/apps/anthropic

Provider docs · Pricing

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)

Provider docs · Pricing

Zhipu GLM (Z.ai)

~/.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

Provider docs · Pricing

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.