AI Development

DeepSeek V4 Flash for Claude Code: Setup, Routing, and Real Costs

DeepSeek V4 Flash 0731, released July 31, 2026, is a 284B Mixture-of-Experts model with 13B active parameters that costs $0.14 input and $0.28 output per 1M tokens. It speaks the Anthropic API, so Claude Code can point at it with four environment variables. It wins on short-horizon tool use and loses on long-horizon agent work.

August 4, 2026
-
12 min read
-Last updated: 2026-08-04
DeepSeek V4 FlashAgentic CodingClaude CodeOpen WeightsModel RoutingAI Cost Optimization
TL;DR
  • Post-training only: same 284B architecture as the April preview, no new pretraining. DeepSWE went from 7.3 to 54.4 and Terminal Bench 2.1 from 61.8 to 82.7 on identical weights.
  • It beat its own flagship: Flash outscores V4-Pro-Preview on all nine published agent benchmarks, which is why the release took two Hacker News front pages in three days.
  • The price is real: $0.14/$0.28 per 1M tokens, and $0.0028 on cache hits. Artificial Analysis ran its full Intelligence Index suite for $72.02 and scored it 50, third of 101 models.
  • Route carefully: Flash beats GPT-5.6 Terra on Terminal Bench and Toolathlon, then loses Agents' Last Exam 25.2 to 50.4. It executes well. It doesn't plan.
  • My take: put it on search, grep, and subagent fan-out inside a stack you already trust. Keep Claude on the code that ships.

What Changed on July 31, 2026

DeepSeek shipped DeepSeek-V4-Flash-0731 on July 31, 2026, graduating Flash from preview to public beta and releasing the weights under the MIT license the same week. The interesting part isn't the release itself. It's that nothing about the model got bigger. Same 284B-parameter Mixture-of-Experts architecture, same 13B active parameters per token, same 1M-token context. Every gain came from a new post-training run.

That distinction matters more than the headline numbers. Post-training is the step that teaches a model strategy, planning, error-checking, and recovery - the behaviours an agent needs when a tool call fails and it has to decide what to do next. DeepSeek moved DeepSWE from 7.3 to 54.4 without touching the weights' capacity, which is a different and more transferable result than "we trained something larger."

One number needs clearing up before the tables make sense. The Hugging Face repo reports 304B total parameters while every write-up says 284B. Both are right. The repo total includes the attached DSpark speculative-decoding draft module; the model itself is 284B with 13B active. If you're sizing hardware, 284B is the number that matters.

Housekeeping before you write any config: the model ID is deepseek-v4-flash. The older deepseek-chat and deepseek-reasoner aliases are retired, so any guide published before July 31 will hand you a dead model name alongside stale benchmark numbers.

The Benchmarks: Where Flash Beats Pro

The story that carried this release is that the cheap model beat the expensive one. Flash-0731 outscores DeepSeek's own V4-Pro-Preview on all nine published agent benchmarks. Here is the full table from the model card, with DeepSeek's own comparison columns intact.

BenchmarkFlash 0731Flash PreviewV4-Pro-PreviewGLM-5.2Claude Opus 4.8
Terminal Bench 2.182.761.872.181.085.0
DeepSWE54.47.312.846.258.0
Cybergym76.738.752.7n/a83.1
Toolathlon-Verified70.349.755.959.976.2
NL2Repo54.239.438.548.969.7
DSBench-FullStack68.737.041.861.871.6
DSBench-Hard59.625.831.154.571.7
AutomationBench25.110.812.812.927.2
Agents' Last Exam25.215.816.523.825.7

The DeepSWE row is the one worth staring at. A jump from 7.3 to 54.4 on the same weights is roughly sevenfold, and DeepSWE measures end-to-end software engineering against real repositories. A preview model scoring 7.3 was effectively unusable for that work. At 54.4 it is in the conversation.

Now read the Opus column honestly, because most coverage skipped it. Flash trails Claude Opus 4.8 on every single benchmark in DeepSeek's own table. It's close on Terminal Bench (82.7 against 85.0) and near-identical on Agents' Last Exam (25.2 against 25.7). It's 15 points behind on NL2Repo and 12 behind on DSBench-Hard. So the pitch was never "as good as Opus." The pitch is 70 to 90 percent of Opus on tool-shaped work at roughly two percent of the price, and that ratio is interesting enough without inflating it.

What the Benchmarks Don't Show

Everything in the table above is DeepSeek reporting on DeepSeek. That doesn't make it wrong, but it changes which rows you can lean on. Three caveats are worth carrying into any decision.

DeepSeek ran its own harness. The model card notes that the official V4-Flash "natively supports the Responses API format and is specifically adapted for Codex," which means the cross-vendor comparisons aren't same-harness. Commenters on the launch thread caught this within hours and flagged that somebody will eventually produce a same-harness run.

It is not on the public leaderboard. I checked the Terminal-Bench 2.1 leaderboard on August 4 and there is no DeepSeek entry at all. The board is led by Claude Code with Fable 5 at 83.8 percent, Codex with GPT-5.5 at 83.1, Claude Code with Opus 4.8 at 78.9, and Codex with GPT-5.6 Terra at 78.4. Until a submission lands, 82.7 is a vendor number sitting next to a set of independently reproduced ones.

Independent scoring exists and is slightly lower. Artificial Analysis measured somewhat below DeepSeek's reported figures on its own suite, and still put the model at 50 on its Intelligence Index, ranking third out of 101 models against a median of 25. That is a strong independent result, and it is not the same as the vendor table.

The practical rule I'd take from this: trust the model-against-itself rows completely and treat the cross-vendor rows as directional. Flash-0731 against Flash-Preview is airtight - same weights, same harness, same evaluator, one variable changed. The Opus and GPT columns are two different harnesses being compared through a single lab's reporting. A useful framing surfaced in that HN thread is that harness quality is now part of the model, and the future is paired model-and-harness releases rather than plain weight dumps.

How to Use DeepSeek V4 Flash in Claude Code

DeepSeek runs an Anthropic-compatible endpoint that translates Anthropic message format, tool calls, and streaming into DeepSeek-native execution. You keep the Claude Code CLI you already use and repoint it. The official config lives in DeepSeek's coding-agents guide, and it looks like this.

bash~/.zshrc (or per-shell before launching claude)
# Point Claude Code at DeepSeek's Anthropic-compatible endpoint
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="YOUR_DEEPSEEK_API_KEY"

# The main loop runs on Pro
export ANTHROPIC_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro"

# Flash takes the cheap tier: background jobs and subagents
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_EFFORT_LEVEL="max"

Read that mapping again, because it is the whole argument of this post. DeepSeek's own recommended configuration does not put Flash in the main loop. Opus and Sonnet slots both get Pro. Flash gets the Haiku slot and the subagents. The vendor is telling you where its own model belongs, and it lines up exactly with the benchmark shape: Flash for file search, grep, title generation, and parallel fan-out; Pro for the code that ships. Community reports around the setup guides put the resulting spend split near 85 percent Pro and 15 percent Flash.

Two details that will bite you. Paste the DeepSeek key raw, with no Bearer prefix. And clear ANTHROPIC_API_KEY before launching, because when both it and ANTHROPIC_AUTH_TOKEN are set, Claude Code can pick the wrong credential and hand you an auth error that reads like a bad key.

bashterminal
unset ANTHROPIC_API_KEY   # avoid a credential conflict
claude                    # launch Claude Code
# then inside the session:
/status                   # base URL should show deepseek, model deepseek-v4-pro

If you want the OpenAI-shaped path instead - for Cline, Roo Code, OpenCode, or your own script - the base URL is https://api.deepseek.com with the same model IDs. The Anthropic API compatibility page documents full or partial support for max_tokens, system, stream, temperature, top_p, tool definitions, and thinking config. The model card recommends temperature 1.0 with top_p 0.95 for agentic work, and reasoning_effort accepts low, high, or max.

The honest caveat, up front

A developer on the August 3 analysis thread reported plainly that he tried DeepSeek with Claude Code and it underperformed - while separately praising the same model inside a product where he writes the prompts himself. Both can be true, and the gap between them is the actual finding. The compatibility layer translates the wire format, not the prompt engineering. Claude Code's harness, its system prompts, and its tool descriptions were all tuned against Anthropic models. Swapping the endpoint is possible. It isn't free.

Pricing: Cheap Per Token, Cheap Per Task

I've written before about cheap models that are only cheap per token and turn expensive per task. This one holds up on both, which is rare enough to say plainly.

ModelInput ($/1M)Output ($/1M)Cached input ($/1M)
DeepSeek V4 Flash$0.14$0.28$0.0028
DeepSeek V4 Pro$0.435$0.87$0.0036
Claude Haiku 4.5$1.00$5.00-
Claude Sonnet 5$3.00$15.00$0.30
Claude Opus 5 / 4.8$5.00$25.00$0.50

Blend those at a three-to-one input-to-output mix, which is roughly what an agent loop looks like, and Flash lands near $0.175 per 1M against Opus 4.8's $10. Call it 57 times cheaper, with the mix stated so you can redo the math for your own workload. A naive one-to-one blend gives you 71 times, which is why bare multiples in launch coverage are worth ignoring.

Cost per task is the number that actually decides routing, and there is an independent one. Artificial Analysis puts Flash at max effort around $0.03 per task at index 50, against OpenAI Luna at $0.03, $0.04 and $0.07 for index 46, 49 and 51. Comparable intelligence at two to three times lower cost, and two to five times slower inference. The blunt summary from the thread is the right one: it's cheaper if you don't value your time.

The sleeper number is cache-hit input at $0.0028 per 1M, a 98 percent discount that Artificial Analysis ranks first across all models. If you're running an agent loop that resends a large stable prefix every turn, that's where your real saving lives, not in the headline input price. Worth pairing with actual measurement - see my Claude Code cost tracking guide for getting per-session numbers you can trust.

Two costs nobody is writing about. First, verbosity: Artificial Analysis flags Flash as very verbose, burning 210M output tokens during evaluation against a 100M median. Output costs double the input rate, so a model that talks twice as much eats part of its own advantage. Second, and more consequential, DeepSeek's pricing page announces a peak/off-peak policy charging 2x during 09:00-12:00 and 14:00-18:00 Beijing Time, with the effective date still pending. From India that's roughly 06:30-09:30 and 11:30-15:30 IST, squarely inside a working day. Build the multiplier into any projection now rather than discovering it in a bill.

One more spec that matters for routing: Flash allows 2,500 concurrent requests against Pro's 500. If your plan involves fanning out parallel subagents rather than running one long session, that ceiling is the reason Flash belongs in the subagent slot.

When to Route to Flash and When Not To

The benchmark table has a shape, and once you see it the routing decision writes itself. Benchmarks that measure "call tools correctly across a handful of steps" are where Flash wins. Benchmarks that measure "stay coherent across a long autonomous run" are where it falls apart. Here are both vendors' self-reported numbers side by side.

BenchmarkV4 Flash 0731GPT-5.6 TerraWhat it measures
Terminal Bench 2.182.778.4Short-horizon terminal tool use
Toolathlon70.353.1Multi-tool orchestration
DeepSWE54.469.6Real repository engineering
Agents' Last Exam25.250.4Long-horizon agentic reasoning

Flash executes. It doesn't plan. Give it the step, not the goal. That single sentence turns the table into a routing rule, and every recommendation below follows from it.

TaskRoute toWhy
Search, grep, file discovery, title generationV4 FlashPure tool dispatch, 70.3 Toolathlon, $0.14 input
Parallel subagent fan-outV4 Flash2,500 concurrent ceiling, negligible per-call cost
Log triage, lint fixes, mechanical refactorsV4 FlashWell-specified and short; cheap to re-run on failure
Multi-file feature work in a real repoClaude CodeFlash gives up 15 points on both DeepSWE and NL2Repo
Overnight autonomous runsClaude CodeAgents' Last Exam 25.2 against 50.4; coherence drops
Anything where a missed defensive check is expensiveClaude CodeCheaper models need more correcting, and that time is real
High-volume product features you prompt yourselfV4 FlashThe one place practitioners consistently report it shining

Notice that this is the same conclusion DeepSeek's own Claude Code config already encodes. Pro in the Opus and Sonnet slots, Flash in Haiku and subagents. When the vendor's defaults agree with the benchmark shape and with independent measurement, that's about as much corroboration as you get before running it yourself. If you're building the fan-out side of this, my dynamic workflows guide covers the orchestration mechanics.

Can You Run DeepSeek V4 Flash Locally?

Yes, and the active-parameter count is why. You need memory for 284B parameters but compute for only the 13B active per token, which is a very different hardware problem from a dense model of the same size. The weights are MIT-licensed and downloadable, so there's no license friction for commercial use either.

The model card documents vLLM with --speculative-config and SGLang with --speculative-algorithm DSPARK, using the DSpark draft module that ships attached to the weights. A representative SGLang launch looks like this.

bashterminal (SGLang, multi-GPU)
python -m sglang.launch_server \
  --model-path deepseek-ai/DeepSeek-V4-Flash-0731 \
  --tp 4 \
  --moe-runner-backend flashinfer_mxfp4 \
  --speculative-algorithm DSPARK

Real numbers reported by people who actually did it: two NVIDIA DGX Sparks run it at roughly 60 tokens per second at full context for around 8,200 euros. Two RTX PRO 6000s in a workstation get you faster for about $20,000. A Mac Studio M3 Ultra with 256GB is both slower and more expensive at around 12,000 euros. Quantized GGUF builds exist for people who want to try it on less.

The honest conclusion is the one from that same thread: even for mid-level projects the API is orders of magnitude cheaper, because you skip the setup and the maintenance. At $0.14 per 1M input tokens you can burn an enormous amount of inference before 8,200 euros of hardware breaks even. Local makes sense for data residency, for a hard no-training guarantee, and for air-gapped work. It doesn't make sense as a cost optimization. If self-hosting is your real goal, my GLM-5.2 local guide covers a model that fits on hardware you more likely already own.

Limitations and Gotchas

Every recap I read skipped this section, so here it is with sources attached.

  • No training opt-out. Raised directly in the launch discussion and unanswered. For client work under an NDA that's a blocker, not a preference. Self-hosting the MIT weights is the only workaround.
  • No multimodal. Text only, which rules it out for screenshot-driven or document-heavy agent work.
  • Vendor-harness benchmarks. Still absent from the public Terminal-Bench leaderboard as of August 4.
  • Very verbose. 210M output tokens in the Artificial Analysis eval against a 100M median, on a model where output costs double the input rate.
  • Slower than the frontier. 122.7 tokens per second and 1.31 seconds to first token. Fine for background work, noticeable in an interactive loop.
  • Peak-hour 2x pricing is announced but undated. Plan for it before it lands.
  • The harness is tuned for Anthropic models. Expect to re-tune your CLAUDE.md and subagent prompts, and expect the first session to feel worse than the benchmarks promised.

One more thing about cost visibility. Claude Code's /cost command prices tokens against Anthropic's rates, so pointed at DeepSeek it will report numbers that are wrong by roughly two orders of magnitude. Read usage from the DeepSeek platform dashboard, or pull token counts out of the session JSONL and apply DeepSeek's rates yourself. Don't trust the in-session figure after you've swapped the endpoint.

Frequently Asked Questions

Related Reading

Related reading

Kimi K3 for Agentic Coding: Claude Code + CLI Setup Guide

Moonshot’s 2.8T open-weight model runs for agentic coding two ways: routed into Claude Code via one env block, or the native Kimi Code CLI. Pricing, benchmarks, local-run reality, and an honest hybrid verdict.

11 min read
Read Article →
GPT-5.6 Sol Ultra Mode: How Cooperative Subagents Actually Work

Sol Ultra puts subagent orchestration inside the model. What cooperative subagents are, GPT-5.6 pricing and Codex availability, the METR cheating flag, and how it compares to Claude Code dynamic workflows.

11 min read
Read Article →
How to Run GLM-5.2 Locally for AI Coding (2026 Guide)

GLM-5.2 is 2026’s top open-weight coding model. Run it with llama.cpp and Unsloth quants - the hardware you need, the right quant for coding, and when a cloud API still makes more sense.

12 min read
Read Article →

Get new posts in your inbox

Practical guides on AI agents, automation, and DevOps. No spam — unsubscribe anytime.