{"slug": "deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json", "title": "DeepSeek V4 Flash API Cost: Thinking Mode Corrupts Strict JSON", "summary": "DeepSeek's V4 Flash 0731 build corrupts integer fields in strict JSON schema outputs when thinking mode is enabled, failing 8 of 13 runs across two request paths, while disabling thinking fixes all runs and reduces token usage by 7x. The corruption is silent, producing schema-valid but numerically wrong values, and also affects V4 Pro (2 of 4 corrupted) but not the preview build.", "body_md": "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`\n\n, 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](https://dev.to/models/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](https://dev.to/models/deepseek-v4-flash/) and [V4 Pro](https://dev.to/models/deepseek-v4-pro/).\n\n**TL;DR**\n\n`json_schema`\n\n, 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.`enable_thinking: false`\n\nfixed every structured run at a seventh of the tokens; for 2-hop math the safe thinking budget is 256.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](https://news.ycombinator.com/item?id=49120299) focus on benchmarks, so this is the operational half of the comparison:\n\n| Flash 0731 | Flash preview | V4 Pro | |\n|---|---|---|---|\n| List price, in / out per 1M | $0.14 / $0.28 | $0.14 / $0.28 | $0.435 / $0.87 |\n| Cache-hit input per 1M | $0.0028 | $0.0028 | $0.003625 |\n| Thinking default | on | on | on |\n| Strict JSON with thinking on |\n5/5 corrupted (our path) |\n4/4 clean | 2/4 corrupted |\n| 2-hop math with thinking off | 0/6 |\n2/6 | 4/4 |\n`thinking_budget` |\ntoken-exact | token-exact | honored (4/4 at 16) |\n| Cache pages | 1,024 tokens, hit at 0.3s | same | same |\n| Tokenizer and prompt overhead | identical, 5 tokens | same | same |\n| Needle recall probed to | 838K tokens | - | - |\n\nOn the 0731 build, yes, and the failure is quiet enough to reach production. A four-field invoice extraction under strict `json_schema`\n\n(vendor, date, total, line-item count) with default thinking returned schema-valid JSON whose numbers were wrong: `line_items`\n\ncame 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.\n\nThe fix is one line: `enable_thinking: false`\n\nproduced 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](https://dev.to/models/deepseek-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](https://github.com/vllm-project/vllm/issues/41132) 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.\n\nTwo off switches, an exact budget, and an effort dial with no off position. The surface we measured accepts `reasoning_effort`\n\nvalues low, medium, high, xhigh, and max; unlike [Qwen 3.8 Max](https://dev.to/models/qwen3-8-max/), `none`\n\nand `minimal`\n\nare rejected, so the dial alone cannot silence the model. Turning thinking off takes either `enable_thinking: false`\n\nor `thinking: {\"type\": \"disabled\"}`\n\n, which behave identically (9-token answers on a trivial question). `thinking_budget`\n\nis honored to the token, exactly as [we measured on Qwen 3.8](https://synthorai.io/blog/qwen3-8-max-cost/): request 16 and the meter reads 16. The full chain of thought comes back in `reasoning_content`\n\n, and the fixed prompt overhead is a lean 5 tokens per call.\n\nThe effort dial, meanwhile, did nothing we could measure. On a deep prime-counting task, `low`\n\nand `high`\n\nburned 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](https://synthorai.io/blog/qwen3-8-max-cost/) 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`\n\n; treat the dial as decoration. There is an irony here: [DeepSeek's own model card](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731) pins its agent benchmarks at \"max reasoning effort\", a setting that produced nothing distinguishable from the default on the surface we measured.\n\nMore 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:\n\n| Configuration | 0731 | Preview flash | V4 Pro |\n|---|---|---|---|\n| default (thinking on) | 6/6 | 6/6 | 4/4 |\n| thinking off | 0/6 |\n2/6 | 4/4 |\n`thinking_budget: 16` |\n2/6 | 5/6 | 4/4 |\n`thinking_budget: 64` |\n5/6 | - | - |\n`thinking_budget: 256` |\n6/6 |\n- | - |\n\nTwo 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](https://synthorai.io/blog/qwen3-8-max-cost/) 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.\n\n1,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](https://synthorai.io/blog/qwen3-8-max-cost/) 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](https://synthorai.io/blog/prompt-cache-write-cost/) applies: stable prefix first, volatile content after.\n\nThe 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`\n\nof 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.\n\nDeepSeek's pricing page now lists one SKU: `deepseek-v4-flash`\n\n, 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](https://dev.to/models/deepseek-v4-pro/) ($0.435/$0.87) shrugged off the math cliff but not the structured-output one.\n\nOne 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](https://synthorai.io/blog/cheapest-llm-by-language/), not just the rate card.\n\n**Is structured output safe on DeepSeek V4 Flash?**\n\nWith thinking off, yes: strict `json_schema`\n\nwas 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`\n\non structured-output routes until the defect is fixed.\n\n**Can you turn off thinking on DeepSeek V4 Flash?**\n\nYes, two spellings: `enable_thinking: false`\n\nor `thinking: {\"type\": \"disabled\"}`\n\n. But the 0731 retrain made the off state fragile on multi-step work (0/6 on 2-hop math); use a `thinking_budget`\n\nof 256 as the floor for anything beyond single-hop lookups, which measured both perfect and cheaper than the default.\n\n**What is the minimum prompt size for the V4 Flash cache?**\n\nJust 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.\n\n**Did prices change with the 0731 release?**\n\nNo. 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`\n\nname as its current model version. What changed is behavior, not price: sharper thinking dependence and the structured-output defect above.\n\n*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.*", "url": "https://wpnews.pro/news/deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json", "canonical_source": "https://dev.to/synthorai/deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json-31p8", "published_at": "2026-08-04 15:17:01+00:00", "updated_at": "2026-08-04 15:50:35.162717+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "ai-safety"], "entities": ["DeepSeek", "DeepSeek V4 Flash", "DeepSeek V4 Pro", "vLLM"], "alternates": {"html": "https://wpnews.pro/news/deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json", "markdown": "https://wpnews.pro/news/deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json.md", "text": "https://wpnews.pro/news/deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json.txt", "jsonld": "https://wpnews.pro/news/deepseek-v4-flash-api-cost-thinking-mode-corrupts-strict-json.jsonld"}}