Dev.to · 9 min read

DeepSeek V4 Flash API Cost: Thinking Mode Corrupts Strict JSON

DeepSeek V4 Flash API Cost: Thinking Mode Corrupts Strict JSON

DeepSeek V4 Flash costs $0.14 per million input tokens and $0.28 per million output, with cache hits at $0.0028, and the retrained 0731 build that now ships under that name has a defect you need to route around: with thinking on (the default) and a strict json_schema, integer fields came back corrupted in 8 of 13 default-thinking runs across two independent request paths. Turning thinking off fixed every run and cut the extraction to a seventh of the tokens. We measured deepseek-v4-flash-0731 on day one: the corruption, the sharper off-switch cliff the retrain introduced, the budget floor that rescues it, the 1,024-token cache pages, and what still separates the preview build and V4 Pro. TL;DR With default thinking plus strict json_schema, deepseek-v4-flash-0731 corrupted integer fields in 8 of 13 runs on two request paths; V4 Pro corrupted 2 of 4, and only the preview stayed clean. The 0731 retrain sharpened the off-switch cliff: 2-hop math fell 6/6 to 0/6. The cache serves 1,024-token pages from roughly a 1.1K-token floor, hits 0.3 seconds after priming, and entries outlive 45 minutes. enable_thinking: false fixed every structured run at a seventh of the tokens; for 2-hop math the safe thinking budget is 256. How do the three V4 builds compare on paper and on the meter? Same tokenizer, same cache, same thinking machinery; different prices, different failure modes. Everything measured below comes from identical probes run against all three (a dash means we did not probe that cell); the day-one analysis threads focus on benchmarks, so this is the operational half of the comparison: Flash 0731 Flash preview V4 Pro List price, in / out per 1M $0.14 / $0.28 $0.14 / $0.28 $0.435 / $0.87 Cache-hit input per 1M $0.0028 $0.0028 $0.003625 Thinking default on on on Strict JSON with thinking on 5/5 corrupted (our path) 4/4 clean 2/4 corrupted 2-hop math with thinking off 0/6 2/6 4/4 thinking_budget token-exact token-exact honored (4/4 at 16) Cache pages 1,024 tokens, hit at 0.3s same same Tokenizer and prompt overhead identical, 5 tokens same same Needle recall probed to 838K tokens - - Does thinking mode corrupt structured output on V4 Flash? On the 0731 build, yes, and the failure is quiet enough to reach production. A four-field invoice extraction under strict json_schema (vendor, date, total, line-item count) with default thinking returned schema-valid JSON whose numbers were wrong: line_items came back as -1, 1, -1, and -19 against a document that plainly lists three items, 0 of 5 default-thinking runs correct through our gateway. Capping the budget does not dodge it: a 64-token-budget run corrupted the same way, and even at a 256-token budget 1 of 3 runs returned a line-item count of 670. The corruption follows the presence of thinking, not its size. On a second, independent request path the same probe corrupted 3 of 8 runs across two batches, once returning a total of 519.95 against the document's $520.00 and once a line-item count of 22; that path kept reasoning on even when asked to disable it, so the clean fix below is verified on the primary path. The JSON always parses and always passes the schema; only the values are wrong, which is the worst possible failure mode for a pipeline that trusts validation. The fix is one line: enable_thinking: false produced correct, valid JSON in every run, in about 44 completion tokens against the default's 328. The spread across the family is telling: the preview build, probed identically with thinking on, went 4/4 clean, while V4 Pro corrupted 2 of 4, so the failure spans the V4 thinking line and hits the retrained flash hardest. It is also not the thinking-plus-schema bug already on record: vLLM fixed a plumbing issue last April where DeepSeek JSON landed in the reasoning field with empty content; here the plumbing is fine and the values are wrong, a strictly nastier failure. Until DeepSeek addresses it, treat thinking and strict structured output as mutually exclusive on these models, which costs you nothing: single-step extraction is exactly the workload where thinking off is safe and 7x cheaper. Which thinking controls does the API accept? Two off switches, an exact budget, and an effort dial with no off position. The surface we measured accepts reasoning_effort values low, medium, high, xhigh, and max; unlike Qwen 3.8 Max, none and minimal are rejected, so the dial alone cannot silence the model. Turning thinking off takes either enable_thinking: false or thinking: {"type": "disabled"}, which behave identically (9-token answers on a trivial question). thinking_budget is honored to the token, exactly as we measured on Qwen 3.8: request 16 and the meter reads 16. The full chain of thought comes back in reasoning_content, and the fixed prompt overhead is a lean 5 tokens per call. The effort dial, meanwhile, did nothing we could measure. On a deep prime-counting task, low and high burned 31,374 and 31,370 reasoning tokens against the default's 26,897, all three correct: ordinary variance, no cap in sight. Where Qwen 3.8's levels are hidden budget caps that bind on deep work, V4 Flash's levels changed nothing at any depth we probed. On this model the two controls that matter are the off switch and thinking_budget; treat the dial as decoration. There is an irony here: DeepSeek's own model card pins its agent benchmarks at "max reasoning effort", a setting that produced nothing distinguishable from the default on the surface we measured. How much thinking does two-hop math actually need? More than before the retrain, which inverts the cheap-mode advice we gave for other models. On our quotable 2-hop arithmetic batch (1850 crates times 24 parts, 75% shipped, 3,120 arrive), the three V4 builds behave like three different models: Configuration 0731 Preview flash V4 Pro default (thinking on) 6/6 6/6 4/4 thinking off 0/6 2/6 4/4 thinking_budget: 16 2/6 5/6 4/4 thinking_budget: 64 5/6 - - thinking_budget: 256 6/6 - - Two lessons. First, the agent retrain moved arithmetic into the thinking channel: the preview build limps through with thinking off, 0731 collapses outright, and Pro does not care at all. Second, the budget floor is model-specific: 16 thinking tokens fully rescue Qwen 3.8 Max on this same batch, but 0731 needs 256, at which point it is both perfect and cheaper than the default (completion totals of 53-188 against the default's 100-200). If you port a thinking-budget config between models, re-run the accuracy check; the lever is universal, the threshold is not. What does the implicit cache deliver? 1,024-token pages behind a low floor, served fast and held long. Salted prefix pairs produced hits of exactly 1,024, 2,048, 4,096, and 7,168 tokens as the prompt grew: page-aligned quantization at 1,024. The floor sits just above one page (a 704-token prompt never hit; 1,166 tokens hit 1,024). A hit landed 0.3 seconds after priming, so there is no build lag to engineer around, and the entry was still serving at +45 minutes, the longest-lived implicit cache we have probed at this tier; Qwen 3.8 Max's entry died between 15 and 45 minutes and its floor is near 4.3K tokens. DeepSeek lists cache-hit input at $0.0028 per million, 2% of the miss price, with no write premium; the usual layering discipline applies: stable prefix first, volatile content after. Are the 1M context and 384K output caps real? The window held everywhere we probed it: planted override codes came back verbatim at 137,638, 465,238, and 838,198 prompt tokens, in 7 to 20 seconds, the fastest long-context recall we have measured at this price tier. The output side is looser than documented: DeepSeek's published maximum output is 384K tokens, but requests with max_tokens of 393,217 and even 524,288 were accepted in both thinking and non-thinking modes, so the cap is not enforced at request time and an oversized budget will not fail loudly. Set your own ceiling if you depend on one. Preview, 0731, and Pro: which build answers your calls? DeepSeek's pricing page now lists one SKU: deepseek-v4-flash, model version DeepSeek-V4-Flash-0731, at unchanged prices. In practice, the preview build is still being served under its own name on some routes, and the two are easy to tell apart from the outside even though they share a tokenizer (identical counts on English, Chinese, and code corpora, so budgets port). The cleanest fingerprint is the off-switch probe: thinking off on 2-hop math scores about 2/6 on preview and 0/6 on 0731 in our batches, and the preview is the only build that passed the structured-output probe clean (4/4, against 0731's 5/5 corrupted and Pro's 2/4). If your traffic depends on either behavior, probe the endpoint you actually call rather than trusting the name; V4 Pro ($0.435/$0.87) shrugged off the math cliff but not the structured-output one. One planning note: the trio's shared tokenizer runs about 6-9% more tokens than Qwen 3.8 on identical corpora, so cross-vendor budget comparisons need the per-language density numbers, not just the rate card. FAQ Is structured output safe on DeepSeek V4 Flash? With thinking off, yes: strict json_schema was enforced and every extraction in our batch was correct. With default thinking on the 0731 build, integer fields came back corrupted in 8 of 13 runs across two request paths while still passing schema validation. V4 Pro corrupted 2 of 4 on the same probe; only the preview build stayed clean. Pin enable_thinking: false on structured-output routes until the defect is fixed. Can you turn off thinking on DeepSeek V4 Flash? Yes, two spellings: enable_thinking: false or thinking: {"type": "disabled"}. But the 0731 retrain made the off state fragile on multi-step work (0/6 on 2-hop math); use a thinking_budget of 256 as the floor for anything beyond single-hop lookups, which measured both perfect and cheaper than the default. What is the minimum prompt size for the V4 Flash cache? Just over 1,024 tokens: a 704-token prompt never cached, an 1,166-token one hit exactly 1,024. Hits quantize in 1,024-token pages, arrive 0.3 seconds after priming, and survive past 45 minutes; cache-hit input is listed at $0.0028 per million, 2% of the miss price. Did prices change with the 0731 release? No. DeepSeek kept $0.14 per million input (cache miss), $0.0028 (cache hit), and $0.28 output, and folded 0731 into the existing deepseek-v4-flash name as its current model version. What changed is behavior, not price: sharper thinking dependence and the structured-output defect above. Measured 2026-08-04 through the Synthorai gateway against deepseek-v4-flash-0731 (contrast arms on deepseek-v4-flash preview and deepseek-v4-pro): strict-schema extraction batches with per-run payload logging, verified on a second independent request path; dial-acceptance and garbage-value probes; the 2-hop accuracy batch (n=4-6 per arm, salted) with a thinking-budget rescue ladder; salted cache pairs at 2.5s pacing with floor, page, lag, and gap probes; max_tokens boundary probes in both modes; and identical three-corpus tokenizer counts across the trio plus Qwen 3.8 Max. Dollar figures are DeepSeek's published list rates at publication time; verify against your own provider's meter. Behavior may change as DeepSeek iterates on the 0731 build.

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More AI & Machine Learning News