Use DeepSeek V4.1 Flash in Claude Code and Codex: tested setup
How to run DeepSeek V4.1 Flash as the model in Claude Code and OpenAI Codex CLI through SeedRouter: environment variables, config.toml and our test results.
Read as MarkdownDeepSeek V4.1 Flash works as the model in Claude Code and in OpenAI's Codex CLI. Claude Code talks the Anthropic Messages format and Codex talks the Responses format, and SeedRouter serves DeepSeek V4.1 Flash in both. Set a base URL and a SeedRouter key, pick deepseek-v4.1-flash, and each request is billed per token from your balance. In our test runs on September 28, 2026, both tools created a file, ran it and reported the output, with DeepSeek V4.1 Flash doing the work.
How do I use DeepSeek V4.1 Flash in Claude Code?
Point Claude Code at SeedRouter with two environment variables, then choose the model:
export ANTHROPIC_BASE_URL=https://api.seedrouter.ai
export ANTHROPIC_API_KEY=sk-your-seedrouter-key
claude --model deepseek-v4.1-flashClaude Code also calls a smaller model in the background for some tasks. Point those at DeepSeek V4.1 Flash too, so every request goes to a model your key can call:
export ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-v4.1-flash
export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4.1-flash
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4.1-flashTo keep the setup across sessions, put the same variables in the env block of ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.seedrouter.ai",
"ANTHROPIC_API_KEY": "sk-your-seedrouter-key",
"ANTHROPIC_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash"
}
}Claude Code notes that deepseek-v4.1-flash is not one of its own model names. That is a notice, not an error: the session runs. The model's reasoning shows up as thinking blocks, as it does with Claude models.
How do I use DeepSeek V4.1 Flash in Codex?
Add SeedRouter to ~/.codex/config.toml:
model = "deepseek-v4.1-flash"
model_provider = "seedrouter"
model_context_window = 1048576
model_reasoning_effort = "high"
show_raw_agent_reasoning = true
[model_providers.seedrouter]
name = "SeedRouter"
base_url = "https://api.seedrouter.ai/v1"
env_key = "SEEDROUTER_API_KEY"
wire_api = "responses"Then export the key and start Codex:
export SEEDROUTER_API_KEY=sk-your-seedrouter-key
codexwire_api = "responses" and show_raw_agent_reasoning = true follow DeepSeek's own Codex guide. The second lets you see the model's reasoning in the Codex CLI with Ctrl + T. model_context_window tells Codex that DeepSeek V4.1 Flash reads up to 1,048,576 tokens.
What did we test?
We gave Claude Code a two-step task (create a small Python file, run it and report the output) and Codex a four-step one (create the file, run it, change it, run it again and report both outputs).
| Tool | Format | Result |
|---|---|---|
| Claude Code | Anthropic Messages | File created and run; output reported correctly |
| Codex CLI | Responses | Two edits and two runs; both outputs reported correctly |
In Codex, DeepSeek V4.1 Flash wrote and ran the file with Codex's shell tool across several turns. Its reasoning was carried from one turn to the next, which DeepSeek's thinking mode needs in tool-call conversations.
Which reasoning effort should a coding agent use?
DeepSeek V4.1 Flash defaults to high, which suits most coding work. Use max for the hardest problems and low for quick, mechanical steps. Codex's own effort names also work: medium and xhigh run as high, minimal as low.
Agents re-read the same files on every turn, so most of their input is served from the cache at about 2% of the fresh input rate. Output, including reasoning, is where the cost of an agent session goes, and every rate is half during off-peak hours.
Can I use DeepSeek V4.1 Flash in other coding tools?
Any tool that lets you set an OpenAI-compatible base URL and a model name can call DeepSeek V4.1 Flash the same way: base URL https://api.seedrouter.ai/v1, your SeedRouter key, model deepseek-v4.1-flash. We have tested Claude Code and Codex; check your tool's docs for where it takes a custom base URL.
Frequently asked questions
Do I need a Claude or ChatGPT subscription for this?
No. With a SeedRouter key, Claude Code and Codex send their requests to SeedRouter, and you pay per token from your SeedRouter balance.
Does DeepSeek V4.1 Flash support tool use in these agents?
Yes. Both tools rely on tool calls to read, write and run files, and DeepSeek V4.1 Flash handled them in our tests.
Can I send screenshots to DeepSeek V4.1 Flash from an agent?
Yes. DeepSeek V4.1 Flash reads images natively. Agents that attach screenshots encode them for you.
How much does an agent session cost?
It depends on the task. The DeepSeek V4.1 Flash pricing guide has the live rates, and the DeepSeek V4.1 Flash page shows them next to the list price.



