Use DeepSeek in Claude Code
Run DeepSeek V4.1 Flash or DeepSeek V4 Pro in Claude Code with a /model key: the settings, which model to pick, and what a session costs.
Checked November 28, 2026
/model serves DeepSeek V4.1 Flash and DeepSeek V4 Pro in Anthropic's Messages format, the one Claude Code speaks. Point Claude Code at /model, name a DeepSeek model, and its files, commands, tools and subagents work as they do with Claude.
Before you start
- A /model API key: create one on the API keys page and add credit on the credits page.
Set it up
For one terminal session, set these variables and start Claude Code:
export ANTHROPIC_BASE_URL="https://api.slashmodel.com"
export ANTHROPIC_AUTH_TOKEN="$SLASHMODEL_API_KEY"
export ANTHROPIC_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4.1-flash"
claudeANTHROPIC_MODELis the model Claude Code works with.ANTHROPIC_DEFAULT_HAIKU_MODELis the model for its small jobs in the background, andCLAUDE_CODE_SUBAGENT_MODELthe one its subagents use. With both set, every request stays on DeepSeek.- The base URL has no
/v1: Claude Code adds the path itself.
To keep them, put them in Claude Code's settings file, ~/.claude/settings.json, with your key:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.slashmodel.com",
"ANTHROPIC_AUTH_TOKEN": "sk-sm-…",
"ANTHROPIC_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash",
"CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4.1-flash"
}
}Pick a model
| Model | Model id | Use it for |
|---|---|---|
| DeepSeek V4.1 Flash | deepseek-v4.1-flash | Most work. It reads images, such as a screenshot you paste, and its cache cuts the cost of every turn. |
| DeepSeek V4 Pro | deepseek-v4-pro | Harder problems, at a higher price per turn. It takes text only, and its cache reads little of a repeated prompt. |
DeepSeek V4.1 Flash
- Model id
deepseek-v4.1-flash- Use it for
- Most work. It reads images, such as a screenshot you paste, and its cache cuts the cost of every turn.
DeepSeek V4 Pro
- Model id
deepseek-v4-pro- Use it for
- Harder problems, at a higher price per turn. It takes text only, and its cache reads little of a repeated prompt.
To work on DeepSeek V4 Pro, change the model and keep the other settings:
export ANTHROPIC_MODEL="deepseek-v4-pro"
claudeDeepSeek's own model names work too: deepseek-flash is DeepSeek V4.1 Flash, with or without [1m]. The pricing page has both models' prices.
What a session costs
- Claude Code sends its long prompt again with every request, over 10,000 tokens before your own files and messages. DeepSeek caches it by itself, and cached input costs far less than other input.
- DeepSeek V4.1 Flash caches well. In our runs, once a prompt had been sent, each later request read 92 to 99% of it from the cache.
- DeepSeek V4 Pro caches little. In our runs it read anything from none to about half of a repeated prompt, so most of each request is billed at the full input price.
- The price is the same at every hour, so a session costs the same whenever you run it.
- Claude Code's own cost figure isn't what you pay. It doesn't know DeepSeek's prices, and in our runs it showed many times the real cost. Usage shows each request with its tokens and what it cost.
- A key can cap what a session costs. Give Claude Code a key of its own with a daily or monthly limit: see key settings.
Good to know
- Claude Code prints a warning that it doesn't recognise the model name, then goes on.
- Both models think before they act, and the thinking is billed as output tokens.
- We ran these settings with Claude Code 2.1.332 on 28 Nov 2026: on each model a task that wrote a file and ran it, and on DeepSeek V4.1 Flash a task handed to a subagent.