DeepSeek V4 API Guide: Pro 0813, V4.1 Flash, Agents & Codex
Practical DeepSeek V4 API guide covering deepseek-v4-pro 0813, deepseek-v4.1-flash, Responses API limits, Codex setup, and TokLab pricing.
Read as MarkdownDeepSeek's V4 family went through two quiet but consequential shifts between August and November 2026. First, on August 13, 2026, deepseek-v4-pro moved behind the scenes to the DeepSeek-V4-Pro-0813 build without changing its callable model alias. That update brought stronger agent reliability, native Responses API support, and an official Codex configuration path. Second, on September 10, 2026, DeepSeek shipped V4.1 Flash, forwarding direct-API Flash traffic to the newer fast tier while introducing peak and off-peak pricing windows on its own billing page.
On TokLab, both production lanes stay explicit, predictable, and free of peak-hour surcharges. deepseek-v4.1-flash bills at $0.24 input / $0.96 output per million tokens, and deepseek-v4-pro bills at $1.056 input / $3.168 output per million tokens. Both are callable through https://api.toklab.ai/v1 with one TOKLAB_API_KEY.
The trap for engineering teams is assuming that an unchanged model alias, or the label "Responses-compatible," means zero migration work. When the weights behind deepseek-v4-pro change, tool-call frequency, reasoning-token volume, tail latency, and edge-case failure modes change with them. This guide breaks down what actually changed in the DeepSeek V4 API lineup, where the partial Responses API contract silently ignores parameters, how to budget around the 384K output ceiling, and how to wire and test both models safely in production.
Quick answer: what is live in the DeepSeek V4 API lineup?
Before changing any production config, separate the documented build version, the callable model ID, and the live gateway billing contract.
| Question | Verified status (November 23, 2026) | Production implication |
|---|---|---|
| Fast V4 route on TokLab | deepseek-v4.1-flash ($0.24 / $0.96 per 1M) | High-volume coding, unit tests, triage, and summaries |
| Reasoning / agent Pro route on TokLab | deepseek-v4-pro ($1.056 / $3.168 per 1M, 0813 build lineage) | Repository-scale debugging, multi-file refactors, deep tool loops |
| Context & maximum output | 1M-token context, up to 384K output tokens | Huge output headroom; cap max_tokens to prevent runaway bills |
| Native Responses API support | Supported upstream on DeepSeek for Flash and Pro | Partial compatibility only; several OpenAI fields are silently ignored |
| Direct Codex CLI / VS Code support | Official shared config path via Responses interface | Removes legacy Responses-to-Chat translation proxy on direct routes |
| Image and file inputs | Not supported on text-only Responses contract | Preprocess screenshots or PDFs before sending to V4 Pro |
| What teams must retest | Agent completion, tool replay, streaming, token spend, fallbacks | Stable alias does not guarantee identical behavior after a build refresh |
Look closely at that 384K maximum output ceiling. That is triple the 128K output cap on GPT-6.2 Astra and Claude Opus 5.5. In practice, 384K output headroom makes deepseek-v4-pro unusually capable when generating large database migrations, full-file rewrites, or long multi-step reasoning traces. It is also an easy way to blow through a daily budget if a coding agent gets caught in a repetitive retry loop without a strict max_tokens ceiling.
Why the stable alias matters more than the dated build name
DeepSeek maintains two identifiers with distinct jobs:
DeepSeek-V4-Pro-0813identifies the underlying build documented in DeepSeek's August release notes.deepseek-v4-prois the callable API model name.
Never hardcode a guessed dated string like deepseek-v4-pro-0813 into production config unless your specific gateway explicitly lists that dated ID in /v1/models. Guessing a provider-internal build tag is one of the fastest ways to trigger 404 model-not-found errors during a deploy.
At the same time, a stable alias creates a subtle operational obligation: record the evaluation date and observed metrics alongside the alias. Because an upstream build refresh swaps the model behind deepseek-v4-pro with zero code changes on your side, a prompt that passed 92% of tool-use checks in July can quietly shift in latency, verbosity, or JSON discipline after an August or September backend update. Treat every documented refresh behind a stable alias as a controlled model migration rather than a silent patch.
Why Responses API and Codex support change the agent workflow
OpenAI's Codex CLI, desktop app, and VS Code extension communicate with custom model providers over a Responses-style protocol. Before DeepSeek's August update, teams trying to run DeepSeek V4 inside Codex had to maintain a fragile local translation proxy converting Responses payloads into Chat Completions calls and stitching streamed tool deltas back together. Whenever Codex updated its tool schema or streaming event format, those local bridges broke.
DeepSeek's native Responses API layer, paired with its shared configuration file covering Codex CLI, Desktop, and VS Code, removes that proxy tax on direct connections. However, "Responses-compatible" does not mean full OpenAI Responses parity. DeepSeek explicitly documents a partial compatibility contract, and unsupported fields may be silently ignored instead of returning an HTTP 400.
| Capability | DeepSeek Responses API status | Production implication |
|---|---|---|
| Text input, system instructions, SSE streaming | Supported | Works cleanly for standard text-based coding sessions |
| Function tools & server-side web search | Supported | Validate complex nested schemas and multi-turn tool replay |
apply_patch custom tool | Supported | Covers Codex's core unified-diff file editing loop |
reasoning_effort control | Supported | Sweep quality, latency, and token volume at each level |
| Image and file inputs | Not supported | Image parts may be stripped or replaced with placeholders; do not route multimodal repo tasks here |
file_search, code_interpreter, computer_use, MCP built-ins | Ignored | Never assume built-in tool parity just because the endpoint accepts the request |
previous_response_id, conversations, server storage | Not supported | The API is strictly stateless; your client must resend required context |
| Background mode & service tiers | Not supported | Long-running agents need your own queue, checkpointing, and retry orchestrator |
That silent-ignore behavior is why a 200 OK smoke test proves almost nothing. If your agent sends previous_response_id expecting server-side state, or attaches a UI screenshot expecting multimodal debugging, the request can return HTTP 200 while producing useless output. Every feature your workflow depends on needs an integration assertion that verifies the effect in the response, not just the HTTP status code.
In Codex workflows specifically, test apply_patch on real multi-hunk diffs before rolling out to a team. Common failure modes show up on files with long repeating boilerplate (such as generated TypeScript types or SQL migrations), where context lines around a patch hunk drift slightly and cause the local patch applier to reject the edit. Logging patch-apply failure rates per model gives you a much cleaner signal than reading chat transcripts.
Understanding pricing: direct peak windows vs flat TokLab rates
DeepSeek's direct-provider pricing shifted in mid-August 2026 from flat introductory rates ($0.435 cache-miss input / $0.87 output on Pro) to a peak and off-peak dual-rate schedule. On direct billing, peak hours run 01:00–04:00 UTC and 06:00–10:00 UTC, doubling Pro from $0.66/$1.98 off-peak to $1.32/$3.96 peak, alongside aggressive cache-hit discounts of roughly 1/30.
On TokLab, billing stays predictable around the clock with no UTC peak-hour cliffs:
| Model on TokLab | TokLab Input (per 1M) | TokLab Output (per 1M) | Best production workload |
|---|---|---|---|
deepseek-v4.1-flash | $0.24 | $0.96 | High-volume classification, unit-test generation, boilerplate edits, log triage |
deepseek-v4-pro | $1.056 | $3.168 | Repository-scale debugging, architecture refactors, deep multi-step tool agents |
| GPT-6.2 Sol (comparison) | $0.20 | $1.00 | Multimodal + fast OpenAI baseline |
| GPT-6.2 Astra (comparison) | $0.80 | $4.00 | Frontier OpenAI coding & full Responses parity |
Look at how tight the economics are between deepseek-v4.1-flash ($0.24/$0.96) and GPT-6.2 Sol ($0.20/$1.00), and between deepseek-v4-pro ($1.056/$3.168) and GPT-6.2 Astra ($0.80/$4.00). On output-heavy coding sessions where the model writes thousands of lines of code or long reasoning chains, deepseek-v4-pro's $3.168 output rate undercuts Astra's $4.00 output rate by more than 20%, while avoiding Astra's 272K long-context 2x input surcharge.
To put real invoice numbers on that difference, consider a heavy repository-debugging trace: 350K total input tokens across a large monorepo context and 24K total output tokens (including reasoning). On TokLab, deepseek-v4-pro bills $0.3696 for input plus $0.0760 for output, totaling $0.4456 with no long-context cliff. By contrast, sending a single 350K-token prompt to an OpenAI GPT-6.2 route crosses the 272K threshold, triggering the 2x input and 1.5x output multiplier across the entire request. On short prompts under 200K tokens, however, GPT-6.2 Astra's lower $0.80 input rate often wins on input-heavy, short-output tasks.
Still, list price is only step one. Always track cost per accepted task: input tokens, reasoning tokens, output tokens, tool-loop turns, retries, and failed runs divided by tasks that pass CI.
Context and output budgeting: how Flash and Pro split the workload
The cleanest production pattern is a two-lane DeepSeek split behind one gateway key, paired with strict token guards:
- Send routine jobs to
deepseek-v4.1-flash($0.24/$0.96): PR descriptions, lint-fix loops, unit-test scaffolding, log clustering, and single-file edits where the problem is already localized. At roughly 4.4x lower input cost and 3.3x lower output cost than Pro, Flash absorbs 70% to 80% of developer-tool volume cheaply. - Reserve
deepseek-v4-pro($1.056/$3.168) for hard traces: multi-file root-cause debugging, flaky concurrency bugs, architectural migrations, and long-context repository forensics past 272K tokens. - Enforce
max_tokensper lane: Set a tight cap (2K to 4K) on Flash extraction calls and a bounded cap (8K to 16K) on Pro coding turns unless a specific migration task explicitly needs larger generation. Uncapped 384K output limits invite runaway loops when a tool keeps returning stderr.
Runnable setup on TokLab (https://api.toklab.ai/v1)
Both deepseek-v4.1-flash and deepseek-v4-pro work out of the box with the standard OpenAI SDK pointed at TokLab. The example below implements a two-tier coding router: it runs a fast first pass on deepseek-v4.1-flash with strict function-calling schemas, and escalates to deepseek-v4-pro if the output fails validation or skips the required tool call.
import json
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.toklab.ai/v1",
api_key=os.environ["TOKLAB_API_KEY"],
)
TOOLS = [
{
"type": "function",
"function": {
"name": "propose_patch",
"description": "Return a unified diff and verification command.",
"parameters": {
"type": "object",
"properties": {
"summary": {"type": "string"},
"diff": {"type": "string"},
"test_command": {"type": "string"},
},
"required": ["summary", "diff", "test_command"],
},
},
}
]
def run_coding_task(prompt: str, escalate: bool = False):
model = "deepseek-v4-pro" if escalate else "deepseek-v4.1-flash"
resp = client.chat.completions.create(
model=model,
messages=[
{
"role": "system",
"content": "You are a senior systems engineer. Always call propose_patch.",
},
{"role": "user", "content": prompt},
],
tools=TOOLS,
tool_choice="auto",
max_tokens=8192,
)
msg = resp.choices[0].message
usage = resp.usage
return {
"model": resp.model,
"tool_calls": msg.tool_calls or [],
"content": msg.content,
"prompt_tokens": usage.prompt_tokens,
"completion_tokens": usage.completion_tokens,
}
prompt = "Fix the deadlock in worker_pool.py when shutdown() races with submit()."
result = run_coding_task(prompt)
if not result["tool_calls"]:
result = run_coding_task(prompt, escalate=True)
print(json.dumps({
"served_by": result["model"],
"calls": len(result["tool_calls"]),
"in": result["prompt_tokens"],
"out": result["completion_tokens"],
}, indent=2))Notice two practical safeguards in that snippet:
max_tokens=8192puts a hard ceiling on output spend so a stuck reasoning trace cannot burn through 100K+ tokens unattended.- Explicit
tool_callsverification checks whether the model actually emitted a structured call before accepting the turn, escalating cleanly todeepseek-v4-prowhen Flash falls back to plain prose.
What production teams should retest now
Treat both the deepseek-v4-pro 0813 build lineage and deepseek-v4.1-flash as controlled rollouts with six clear release gates:
| Stage | What to test | Release gate |
|---|---|---|
| 1. Identity | Log requested alias, returned resp.model, eval date, and route | Zero guessed dated IDs in application code |
| 2. Offline eval | Replay 30–50 real repo debugging, refactoring, and tool-use traces | Zero material regression on critical CI tasks |
| 3. Protocol eval | Test SSE streaming, function calls, apply_patch, and ignored fields | Required tools fire and parse cleanly every run |
| 4. Budget eval | Measure input, reasoning, output, retries, and cost per accepted task | Accepted-task cost stays inside workload budget |
| 5. Canary | Route 5–10% of one task class to Pro while keeping Flash/Astra fallback | Error rate and p95 latency stay within SLOs |
| 6. Rollout | Expand class by class rather than blanket-replacing every endpoint | One-line config rollback stays verified |
Good first candidates for deepseek-v4-pro are repository-scale root-cause analysis, cross-module refactors, long-context log forensics above 272K tokens, and tool-heavy investigations. Keep deepseek-v4.1-flash as the high-throughput lane for routine transformations, PR summaries, unit-test scaffolding, and structured extraction.
What remains unverified and why honesty matters
Official documentation confirms the 0813 Pro build lineage, stable aliases, 1M context, 384K output ceiling, partial Responses API contract, and Codex configuration path. What it does not prove is that DeepSeek V4 Pro beats every frontier model on every coding benchmark.
Circulating community numbers for the 0813 build cite sharp gains on agent suites such as Terminal-Bench 2.1, DeepSWE, and CyberGym, yet formal third-party benchmark replication across every suite remains uneven compared to older Preview numbers. Treat circulating benchmark screenshots as directional signals rather than deployment approval, and keep a verified cross-vendor fallback (such as GPT-6.2 Astra or claude-opus-5-5 on TokLab) wired behind the same TOKLAB_API_KEY for workloads where tool reliability matters more than unit token cost.
FAQ
Is DeepSeek V4 Pro 0813 a separate API model name?
No. DeepSeek-V4-Pro-0813 is the documented underlying build version, while the callable API model name remains deepseek-v4-pro. Do not invent a dated model string in your client code.
Do I need to rewrite existing deepseek-v4-pro requests?
Your model parameter string stays identical. You should still rerun your regression suite, because the underlying build behind that stable alias changed and can shift tool-call habits, reasoning length, and latency.
What is the difference between deepseek-v4.1-flash and deepseek-v4-pro on TokLab?
deepseek-v4.1-flash ($0.24/$0.96 per 1M tokens) is the fast, low-cost tier for high-volume text, summaries, and straightforward coding edits. deepseek-v4-pro ($1.056/$3.168 per 1M tokens) is the heavy reasoning and agent tier built for multi-file debugging, long-horizon refactoring, and complex tool loops.
Does one Codex setup cover Codex CLI, Desktop, and VS Code?
Yes on DeepSeek's documented native Responses route. Those three Codex clients share the same configuration file, so adding the custom provider block once exposes the models across all three surfaces. When routing through any unified gateway, verify whether your integration targets /v1/chat/completions or /v1/responses before cutting over Codex clients.
Which built-in tools work on DeepSeek's Responses compatibility layer?
Function tools, server-side web search, and Codex's apply_patch custom tool are supported. Built-in file_search, code_interpreter, computer_use, and hosted MCP tools are ignored rather than executed.
Are images or PDFs supported in DeepSeek V4 Pro API calls?
No. DeepSeek's V4 Responses contract is text-only; image inputs are unsupported and may be replaced with placeholder text. For multimodal repository tasks (such as UI bug screenshots or diagram-heavy specs), route to a multimodal model like GPT-6.2 Sol or GPT-6.2 Astra.
Is the DeepSeek Responses API stateful?
No. previous_response_id, server-side conversations, storage, and background mode are not supported. Your application or agent harness must store and resend all required conversation history and tool outputs.
Where are the official DeepSeek V4 Pro 0813 benchmarks?
Official-channel notes for the 0813 build highlight large jumps on agent-focused suites (Terminal-Bench 2.1, DeepSWE, CyberGym), while many public third-party leaderboards still mix Preview and updated checkpoints. Treat circulating 0813 scores as provisional until you verify them against your own repository eval suite.
Does TokLab apply DeepSeek's UTC peak-hour 2x surcharge?
No. TokLab bills flat, transparent rates around the clock: $0.24/$0.96 for deepseek-v4.1-flash and $1.056/$3.168 for deepseek-v4-pro. Check TokLab Pricing for the latest rate table before finalizing production budgets.


