DeepSeek V4.1 Flash runs a sample agent workload for this much off-peak, versus $7.40 on Claude Sonnet 5.5.
Workload: 1M uncached input, 4M cache-read and 0.5M output tokens. Peak hours double DeepSeek prices.
How to use DeepSeek in Codex
- Create an API key on the DeepSeek platform and add credit.
- Run DeepSeek’s setup script. It asks for your key and writes the Codex config.
macOS and Linux:bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh)
Windows PowerShell:irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iex - Start Codex. The model is
deepseek-flash; switch todeepseek-v4-profor harder tasks. The same config works in the Codex CLI, the IDE extension and the ChatGPT desktop app.
To configure by hand, DeepSeek’s Codex guide adds a deepseek provider to ~/.codex/config.toml with base_url = "https://api.deepseek.com/" and wire_api = "responses", plus a model catalog file. Read what a script does before running it.
How to use DeepSeek in Claude Code
Set these before starting claude (from DeepSeek’s Claude Code guide):
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API key>
export ANTHROPIC_MODEL=deepseek-flash[1m]
export ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-flash[1m]
export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-flash[1m]
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-flash
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-flash
For several providers with routing rules, see Claude Code Router.
What does a coding agent cost on DeepSeek?
| Model | Sample workload |
|---|---|
| DeepSeek V4.1 Flash (off-peak) | $0.46 |
| DeepSeek V4.1 Flash (peak) | $0.92 |
| DeepSeek V4 Pro (off-peak) | $1.74 |
| Claude Sonnet 5.5 | $7.40 |
| GPT-6.2 Sol | $7.40 |
Token use is held constant here. A model that needs more attempts or misses the cache costs more than the table suggests.
Questions
Can I use DeepSeek in Codex?
Yes. DeepSeek documents a Codex setup for the Codex CLI, the Codex IDE extension and the ChatGPT desktop app. It adds DeepSeek as a model provider using the Responses API, and you need your own DeepSeek API key.
Does DeepSeek work with Claude Code?
Yes. DeepSeek provides an Anthropic-compatible endpoint at https://api.deepseek.com/anthropic. Point ANTHROPIC_BASE_URL at it and set ANTHROPIC_AUTH_TOKEN to your DeepSeek API key.
Is DeepSeek cheaper than Claude or GPT in a coding agent?
For the same token workload, yes by a wide margin: about $0.46 on V4.1 Flash off-peak versus $7.40 on Claude Sonnet 5.5 at API prices. Quality differs by task, so compare on your own work.
Sources
Model facts and setup steps reviewed on .