Cheaper Models for Claude Code: GLM vs DeepSeek vs Kimi
The short answer
If Claude feels too expensive, you can keep the Claude Code tool and swap the model behind it. Four vendors document official Anthropic-compatible endpoints for exactly this. Prices per million tokens, read from each vendor’s page on December 5, 2026:
| Model | Endpoint (ANTHROPIC_BASE_URL) | Input | Cache hit | Output | Best for |
|---|---|---|---|---|---|
DeepSeek V4.1 Flash (deepseek-flash) | https://api.deepseek.com/anthropic | $0.15 off-peak / $0.30 peak | $0.003 | $0.60 / $1.20 | Lowest cost per token |
| MiniMax-M4 | https://api.minimax.io/anthropic | $0.80 | $0.05 | $3.10 | Cheap, M Plan subscription option |
| GLM-5.4 (Z.ai) | https://api.z.ai/api/anthropic | $1.40 | $0.26 | $4.40 | Flat-rate GLM Coding Plan from $18/month |
| Kimi K3.1 Pro | https://api.moonshot.ai/anthropic | $2.00 | $0.20 | $10.00 | Strongest open-weight option, 1M context |
| Claude Sonnet 5.5 (reference) | Anthropic | $2.00 | $0.10 | $10.00 | — |
| Claude Opus 5.5 (reference) | Anthropic | $4.00 | $0.20 | $20.00 | — |
Picks: DeepSeek for the smallest bill, GLM Coding Plan for a fixed monthly cost, Kimi K3.1 Pro when you want a near-Sonnet price with open weights and long context, MiniMax-M4 for a middle ground. For all Claude prices, see our current API prices.
Why Claude Code gets expensive
Claude Code re-reads files, tool output and conversation history on almost every step, so input tokens dominate. Caching helps (Opus 5.5 cache hits are $0.20), but a long session on Opus still adds up, and subagents multiply it. Two levers cut the bill: a cheaper model per token, or a flat-rate plan. For the Claude-side levers (effort, caching, per-developer caps), see why Claude is so expensive and how to cap Claude Code spend per developer.
How the swap works
Every vendor’s guide uses the same Claude Code settings. Put them in the env block of ~/.claude/settings.json (or export them):
ANTHROPIC_BASE_URL— the vendor endpoint from the table.ANTHROPIC_AUTH_TOKEN— the vendor’s API key (never commit this file).ANTHROPIC_MODEL,ANTHROPIC_DEFAULT_OPUS_MODEL,ANTHROPIC_DEFAULT_SONNET_MODEL,ANTHROPIC_DEFAULT_HAIKU_MODELandCLAUDE_CODE_SUBAGENT_MODEL— the vendor model name.- Optional:
CLAUDE_CODE_AUTO_COMPACT_WINDOWto match the model’s context, andCLAUDE_CODE_EFFORT_LEVEL.
Kimi’s guide is blunt about step 3: configure only some tiers and “the corresponding scenarios fail silently”. MiniMax’s guide adds a second gotcha: exported ANTHROPIC_BASE_URL or ANTHROPIC_AUTH_TOKEN variables in your shell profile override the settings file, so remove stale ones.
The four options
DeepSeek V4.1 Flash. DeepSeek’s Claude Code guide sets every tier to deepseek-flash[1m] (Haiku and subagents to deepseek-flash), effort max and a 786,432-token compaction window. It is the cheapest serious coding model with an official Claude Code path. Two traps: peak hours (01:00–04:00 and 06:00–10:00 UTC on weekdays) double the price, and a claude-opus* model name is silently mapped to deepseek-v4-pro at $0.66/$1.98 off-peak — so set the variables rather than relying on defaults.
MiniMax-M4. MiniMax’s setup wizard (npx -y mmx-cli@latest agent setup) writes the settings for you, using MiniMax-M4[1m] for every tier and a recommended 512K auto-compaction window. Pay-as-you-go is $0.80/$3.10; the M Plan subscription is the alternative. Thinking is always on.
GLM-5.4 (Z.ai). Z.ai’s API price is $1.40/$4.40, but most Claude Code users take the GLM Coding Plan, which “starts at 18 USD per month” and works in Claude Code, Codex, OpenCode and 20+ other tools. Plans are metered in credits with a 5-hour and a weekly limit (Lite 2,000 / 10,000, Pro 12,000 / 60,000, Max 28,000 / 140,000). Z.ai’s guide maps all tiers to glm-5.4[1m] for 1M context. This is the closest thing to Claude Pro/Max-style predictability at a lower price.
Kimi K3.1 Pro. Moonshot’s flagship costs exactly what Sonnet 5.5 does per token ($2/$10), so it saves money only versus Opus — choose it for open weights, a 1M-token context and strong coding, not for the lowest bill. Kimi’s guide uses https://api.moonshot.ai/anthropic and also sets ANTHROPIC_DEFAULT_FABLE_MODEL. For a full walkthrough see how to use Kimi K3.1 Pro in Claude Code.
What you give up
- Anthropic-only features. Compatible endpoints ignore some fields; DeepSeek’s docs list
containerandmcp_serversas ignored. Local MCP servers configured in Claude Code still work, because Claude Code runs them. - Consistency on long tasks. Claude models are tuned for Claude Code’s harness; other models may need more steering.
- Data handling. Your code goes to the new vendor. Read its retention terms before using it on private repositories.
A common hybrid: Claude Opus or Sonnet for planning and debugging, a cheap model for subagents via CLAUDE_CODE_SUBAGENT_MODEL. To route between vendors without editing settings, see Together Link vs FireRouter vs OpenRouter for Claude Code.
Last verified: December 5, 2026.