A comprehensive reference guide for developers looking to use Claude Code with cost-effective alternative AI providers. Includes up-to-date pricing, detailed setup instructions, and configuration examples for Anthropic, Alibaba Qwen, DeepSeek, MiniMax, Moonshot AI (Kimi K2), and Zhipu GLM models.
| Provider | Model | Input $/1M tok | Output $/1M tok | Notes |
|---|---|---|---|---|
| Anthropic | Haiku 4.5 | $1.00 | $5.00 | Official API pricing. |
| Anthropic | Opus 4.1 | $15.00 | $75.00 | Official API pricing. |
| Anthropic | Sonnet 4.5 | $3.00 | $15.00 | Official API pricing. |
| Alibaba | Qwen3 Coder | $0.22 | $0.95 | Uses Anthropic-compatible endpoint. |
| DeepSeek | deepseek-chat | $0.28 | $0.42 | Context caching enabled by default. |
| MiniMax | MiniMax-M2 | $0.30 | $1.20 | Has Coding Plan from $10/mo. |
| Moonshot AI | Kimi K2 | $0.14 | $2.49 | Automatic prompt caching (beta). |
| Zhipu (ZAI) | GLM 4.6 | $0.60 | $2.20 | Has GLM Coding Plan from $3/mo. |
Installation:
npm install -g @anthropic-ai/claude-code
# or on Unix systems:
curl -fsSL https://claude.ai/install.sh | bashAuthentication:
There are two main options:
-
Claude Console (OAuth): Requires active billing at console.anthropic.com. A "Claude Code" workspace is automatically created for usage tracking.
-
Claude.ai Subscription: Subscribe to Claude Pro or Max plan and log in with your Claude.ai account.
Enterprise Options:
- Configure Claude Code to use Amazon Bedrock or Google Vertex AI with your existing cloud infrastructure.
Documentation: https://docs.claude.com/en/docs/claude-code/setup
Getting API Key:
- Visit Alibaba Cloud Model Studio
- Create an account and generate a DashScope API key
Configuration:
Edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://dashscope-intl.aliyuncs.com/apps/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_DASHSCOPE_API_KEY",
"ANTHROPIC_MODEL": "qwen-plus",
"ANTHROPIC_SMALL_FAST_MODEL": "qwen-flash"
}
}Recommended Model Combinations:
- Main Model (
ANTHROPIC_MODEL):qwen-max,qwen-plus, or Qwen-Coder series for complex tasks - Fast Model (
ANTHROPIC_SMALL_FAST_MODEL):qwen-flashorqwen-turbofor simple jobs
Launch:
cd your-project-directory
claudeDocumentation: https://www.alibabacloud.com/help/en/model-studio/claude-code
Getting API Key: Visit DeepSeek Platform to obtain your API key.
Configuration:
Edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_DEEPSEEK_API_KEY",
"API_TIMEOUT_MS": "600000",
"ANTHROPIC_MODEL": "deepseek-chat",
"ANTHROPIC_SMALL_FAST_MODEL": "deepseek-chat",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}Using DeepSeek Reasoner (R1):
Replace deepseek-chat with deepseek-reasoner in the configuration above.
Launch:
cd your-project-directory
claudeTroubleshooting:
- Invalid token error: Verify
ANTHROPIC_AUTH_TOKENis set to your real DeepSeek API key - No response: Confirm
ANTHROPIC_BASE_URLis correct:https://api.deepseek.com/anthropic
Documentation: https://api-docs.deepseek.com/guides/anthropic_api
Getting API Key:
- Visit MiniMax Developer Platform
- Navigate to the interface key section
- Create a new secret key with a project name
- Copy and save the key securely (shown only once)
Configuration:
Edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_MINIMAX_API_KEY",
"API_TIMEOUT_MS": "3000000",
"ANTHROPIC_MODEL": "MiniMax-M2",
"ANTHROPIC_SMALL_FAST_MODEL": "MiniMax-M2",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M2",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M2",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M2",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}Launch:
cd your-project-directory
claudeDocumentation: https://platform.minimax.io/docs/guides/text-ai-coding-tools
Getting API Key:
- Visit Moonshot Platform
- Create an account and generate an API key
Configuration:
Edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_MOONSHOT_API_KEY",
"ANTHROPIC_MODEL": "kimi-k2-turbo-preview",
"ANTHROPIC_SMALL_FAST_MODEL": "kimi-k2-turbo-preview"
}
}Launch:
cd your-project-directory
claudeFeatures:
- 256K context length for handling complex codebases
- Seamless Claude Code compatibility with agentic tool use
- Automatic prompt caching (currently in 3-month public beta)
Documentation: https://platform.moonshot.ai/docs/guide/agent-support
Getting API Key:
- Visit Z.AI Platform (Mainland China) or api.z.ai (International)
- Create an account and generate an API key
Configuration:
Edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_ZAI_API_KEY",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6"
}
}For Mainland China:
Replace base URL with: https://open.bigmodel.cn/api/anthropic
Launch:
cd your-project-directory
claudeDocumentation: https://docs.z.ai/scenario-example/develop-tools/claude
Several providers offer subscription-based coding plans that provide generous limits for development work, often at 3-10x better value than pay-per-token pricing. These are perfect for intensive coding sessions or professional development work.
Plans:
- Starter: $10/mo (100 prompts/5h) | $100/yr
- Plus: $20/mo (300 prompts/5h) | $200/yr
- Max: $50/mo (1000 prompts/5h) | $500/yr
Benefits:
- 1 prompt ≈ 15 model requests
- 1/10th the cost of comparable plans (Claude, etc.)
- No unpredictable bills - fixed subscription
- Powered by MiniMax-M2 (230B MoE, 10B active)
- 204K context window
Subscribe: https://platform.minimax.io/subscribe/coding-plan
Plans:
- Lite: $3/mo (~120 prompts/5h)
- Pro: $15/mo (~600 prompts/5h)
- Max: Price varies (~2400 prompts/5h)
Benefits:
- 3x more usage than comparable plans
- 1 prompt = ~15-20 model calls
- Over 55 tokens/second generation speed
- No network restrictions or account bans
- Vision & Web Search (Pro+)
- Compatible with Claude Code, Cline, Cursor, etc.
Features:
- Text generation, Vision, Video generation
- Model mapping: Opus/Sonnet/Haiku all default to GLM models
- Singapore-based services with privacy protection
Subscribe: https://z.ai/subscribe
-
Version Check: Ensure Claude Code is up to date with
claude --versionand update withclaude update -
Timeout Settings: Some providers require higher timeout values (especially for complex reasoning tasks). The
API_TIMEOUT_MSsetting helps prevent premature timeouts. -
Model Selection: Most providers support automatic model selection based on task complexity using
ANTHROPIC_MODEL(main) andANTHROPIC_SMALL_FAST_MODEL(quick tasks). -
Regional Considerations: China-based providers often have separate endpoints for mainland China vs. international users.
-
Testing Configuration: After setup, run
claudein a test directory and verify the model responds correctly. -
Cost Optimization:
- Use cache-enabled providers (Anthropic, DeepSeek, Kimi) for repetitive tasks
- Select appropriate model sizes for the task complexity
- Consider batch processing for non-urgent workloads