Use DeepSeek with Claude Code
Claude Code doesn’t require a Claude model: it works with any backend that speaks the Anthropic Messages API. CheapestInference exposes DeepSeek V4 Flash through an Anthropic-compatible endpoint, so you can run Claude Code on DeepSeek with unlimited usage during your reserved time blocks — a flat monthly fee instead of per-token billing.
Setup (2 minutes)
Section titled “Setup (2 minutes)”- Subscribe to the Core Pool and copy
your subscriber key (
sk-...) from the dashboard. - Export these variables in your shell (or put them in your shell profile):
export ANTHROPIC_BASE_URL="https://api.cheapestinference.com/anthropic"export ANTHROPIC_AUTH_TOKEN="sk-..." # your subscriber keyexport ANTHROPIC_MODEL="deepseek-v4-flash"export ANTHROPIC_SMALL_FAST_MODEL="deepseek-v4-flash"export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000 # DeepSeek V4 Flash's 1M window- Start
claudeas usual. Every request now runs on DeepSeek.
Why DeepSeek V4 Flash for Claude Code
Section titled “Why DeepSeek V4 Flash for Claude Code”- 1M-token context: the whole repo fits. Setting
CLAUDE_CODE_AUTO_COMPACT_WINDOWto the full window means long sessions compact far less often than on a 200K model. - Fast: V4 Flash is DeepSeek’s speed-optimized line — agentic loops with many tool calls stay snappy.
- Flat price: coding agents are token-hungry; a long Claude Code session can burn millions of tokens. During your time blocks there is no per-token meter — see Unlimited Subscriptions.
- Thinking blocks: DeepSeek’s reasoning surfaces through standard Anthropic
thinkingcontent blocks, so Claude Code renders it natively. See Reasoning for toggling it.
Per-project configuration
Section titled “Per-project configuration”Pin one project to DeepSeek without touching your global shell profile with
.claude/settings.json in the project:
{ "env": { "ANTHROPIC_BASE_URL": "https://api.cheapestinference.com/anthropic", "ANTHROPIC_AUTH_TOKEN": "sk-...", "ANTHROPIC_MODEL": "deepseek-v4-flash", "ANTHROPIC_SMALL_FAST_MODEL": "deepseek-v4-flash", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000" }}Can Claude Code use DeepSeek?
Section titled “Can Claude Code use DeepSeek?”Yes. Claude Code talks to any endpoint that implements the Anthropic Messages
API. Point ANTHROPIC_BASE_URL at
https://api.cheapestinference.com/anthropic, set ANTHROPIC_MODEL to
deepseek-v4-flash, and Claude Code runs on DeepSeek — tool calls, streaming
and thinking blocks included. No plugin or proxy on your machine.
Is DeepSeek good enough for Claude Code?
Section titled “Is DeepSeek good enough for Claude Code?”For most day-to-day coding, yes: V4 Flash handles multi-file edits and tool loops well, and its 1M window holds far more of the repo than a 200K model. For the hardest refactors, flagship-class models like Kimi K3 leave a bigger quality margin — same setup, different model id.
What does it cost to run Claude Code on DeepSeek?
Section titled “What does it cost to run Claude Code on DeepSeek?”A flat monthly subscription to the Core Pool — see current prices. Usage during your reserved time blocks is unlimited, so a heavy Claude Code week costs the same as a light one. On per-token APIs the same agentic session bills every one of its millions of tokens.
Does /compact and auto-compaction work?
Section titled “Does /compact and auto-compaction work?”Yes. Set CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000 so Claude Code compacts
against DeepSeek’s real 1M window instead of assuming a Claude-sized one.
- Your Core Pool subscription also covers MiMo v2.5 —
switch models by changing
ANTHROPIC_MODEL, no new key needed. - Want a stronger model in the same setup? The same two variables work with GLM 5.2 (Frontier Pool) or Kimi K3 (Flagship Pool).
- General setup, model table and troubleshooting: the main Claude Code guide.