DeepSeek Agent Cost: V4 Flash and V4 Pro API Pricing for Loops
What DeepSeek V4.1 Flash (the replacement for V4 Flash) and V4 Pro cost on a real 12-step agent run against Claude Sonnet 5, GPT-5.4 and Gemini 3.8 Flash, where DeepSeek tool calling holds up, where it does not, and a hybrid pattern that keeps a flagship for the last step.
The article text carries the review date. The rate table below is rebuilt from the live catalogue on every deploy.
Fastest win
DeepSeek V4.1 Flash lists at $0.30 per million input and $1.20 per million output at peak hours, half that off-peak. On the reference 12-step agent run that is about $0.058 at peak, against $0.39 on Claude Sonnet 5, $0.50 on GPT-5.4 and $0.15 on Gemini 3.8 Flash. Claude Haiku 5.5, released in October at $0.10 / $0.50, now undercuts it at about $0.020, even below V4.1 Flash off-peak. Run the loop on V4.1 Flash and hand the final verification step to Sonnet 5 and the whole run costs about $0.11, 71% less than all-Sonnet, with a flagship checking the answer.
The short answer on DeepSeek agent cost
DeepSeek retired V4 Flash. Its replacement is DeepSeek V4.1 Flash, called deepseek-flash in the API; the old name deepseek-v4-flash still works and bills at the same Flash price.
V4.1 Flash costs $0.30 per million input tokens and $1.20 per million output at peak hours. Peak is 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays; every other hour costs half. This page uses peak rates for the math. On the reference 12-step agent run, which reads 172,800 input tokens and writes 4,800 output tokens, that is 172,800 × $0.30 + 4,800 × $1.20 = about $0.058. DeepSeek V4 Pro at $1.32 / $3.96 peak runs the same loop for about $0.25. Claude Sonnet 5 costs $0.39, GPT-5.4 $0.50 and Gemini 3.8 Flash $0.15. Claude Haiku 5.5 costs 172,800 × $0.10 + 4,800 × $0.50 = about $0.020, less than V4.1 Flash even off-peak.
| Model | $/1M input | $/1M output | Context | 12-step run |
|---|---|---|---|---|
| Claude Haiku 5.5 | $0.10 | $0.50 | 1M | 172,800 × $0.10 + 4,800 × $0.50 = $0.020 |
| DeepSeek V4.1 Flash, off-peak | $0.15 | $0.60 | 1M | 172,800 × $0.15 + 4,800 × $0.60 = $0.029 |
| DeepSeek V4.1 Flash, peak | $0.30 | $1.20 | 1M | 172,800 × $0.30 + 4,800 × $1.20 = $0.058 |
| DeepSeek V4 Pro, off-peak | $0.66 | $1.98 | 1M | 172,800 × $0.66 + 4,800 × $1.98 = $0.124 |
| Gemini 3.8 Flash | $0.75 | $3.75 | 1M | 172,800 × $0.75 + 4,800 × $3.75 = $0.148 |
| DeepSeek V4 Pro, peak | $1.32 | $3.96 | 1M | 172,800 × $1.32 + 4,800 × $3.96 = $0.247 |
| Claude Sonnet 5 | $2 | $10 | 1M | 172,800 × $2 + 4,800 × $10 = $0.394 |
| GPT-5.4 | $2.50 | $15 | 1M | 172,800 × $2.50 + 4,800 × $15 = $0.504 |
The trace behind that column: a 4,000-token system prompt plus tools, a 500-token task, and twelve steps each adding a 300-token tool call and a 1,500-token result. The per-step re-send of everything before it is what makes the input column dominate; see [how much an AI agent costs to run](/guides/how-much-does-an-ai-agent-cost-to-run). DeepSeek pricing checked 2026-10-27 at api-docs.deepseek.com. Claude Haiku 5.5 checked 2026-11-03 on Anthropic's pricing page; its rate applies to prompts up to 100,000 tokens, and the largest call in this trace is 24,300. It replaced Claude Haiku 4.5, now a legacy model at $1 / $5 ($0.197 on this run).
DeepSeek V4 pricing, in agent terms
Three things about the price list matter for loops specifically.
Input is where agents spend. V4.1 Flash's $0.30 peak input rate is about 7 times below Sonnet 5 ($2) and about 8 times below GPT-5.4 ($2.50). Output is a minor share of an agent bill, so the input rate is the one to compare.
Context is 1M tokens on both V4.1 Flash and V4 Pro, with up to 384K output, so a long loop will not hit a window limit before your step cap does; a 200-step run of the reference trace ends at 362,700 tokens of context. Whether the model uses that much history well is a separate question, covered below.
Caching exists on DeepSeek's own endpoint and bills repeated prefix hits at a far lower input rate: $0.006 per million on V4.1 Flash and $0.044 on V4 Pro at peak. This article prices everything uncached, so a loop with a large stable prefix will cost less than the tables show. If your loop re-sends a large stable prefix, the [prompt caching for AI agents](/guides/prompt-caching-for-ai-agents) rules apply to DeepSeek as well.
Where DeepSeek V4 is reliable
In our experience and in the reports we see from teams running it, V4 Flash held up in three situations. We have not yet re-tested them on V4.1 Flash:
- Structured tool calls on well-specified tasks: a clear system prompt, tools with tight schemas and descriptive names, and a task that says what "done" looks like. Read-file, query-database, call-this-API loops fall here.
- Long-context reads: summarising or extracting from a few hundred thousand tokens of retrieved material, where the 1M window and the $0.30 rate make a 300,000-token pass cost about $0.09.
- High-volume, low-stakes loops: classification pipelines, log triage, first-pass code review, anything where a wrong answer is cheap to detect and rerun.
V4 Pro is the same shape with more headroom on judgement, at about 4 times the Flash price, for when you want one vendor and one endpoint but a stronger planning step.
Where it fails
The same reports and our own use point to three weak spots. We describe them as observations, not benchmark results, because we cannot cite a benchmark that isolates them:
- Ambiguous tasks. When the brief leaves room to infer intent, V4 Flash tended to pick a literal reading and run with it, and by step 6 it has done a lot of confident work on the wrong problem.
- Long multi-turn planning. Past roughly ten steps with branching decisions, it loses track of what it has already tried and repeats tool calls. The window is large; the planning is not.
- Strict JSON edge cases. Nested optional fields, arrays of objects, unusual escaping and enum values with near-duplicates are where argument JSON comes back subtly wrong. Validate every tool call against the schema before executing it, and treat a validation failure as a signal to escalate, not to retry on the same model.
These weak spots define the boundary of the hybrid pattern below.
Direct API or OpenRouter: data residency and price
DeepSeek's direct API is operated by DeepSeek, and requests are processed on its infrastructure under its data policy. For some organisations that is a non-starter regardless of price, and the model's weights being open does not change where your prompts go when you call the hosted endpoint.
OpenRouter routes DeepSeek models to third-party hosting providers and lets you restrict which providers or regions serve a request, which is the practical answer to residency requirements. The trade-off is that each host sets its own rate, so an OpenRouter row for the same model can list above the direct price; the [model catalogue](/models) shows the current rows side by side. The full comparison, including caching and reliability differences, is in [OpenRouter vs direct API](/compare/openrouter-vs-direct-api).
The hybrid pattern: V4.1 Flash for the loop, a flagship for the last step
Run the tool loop on V4.1 Flash and send the finished transcript to a stronger model once, to verify the work and write the final answer. The flagship reads the whole context one time instead of twelve, so its cost is bounded and small.
Reference run, eleven loop steps on V4.1 Flash at peak: input 11 × 4,500 + 1,800 × 55 = 148,500 tokens, output 3,300 tokens. 148,500 × $0.30 + 3,300 × $1.20 = $0.049. Verification step, one call reading the full 24,300-token transcript and writing 1,500 tokens:
| Verifier ($/1M in / out) | Verification step | Loop on V4.1 Flash | Total | vs all-verifier loop |
|---|---|---|---|---|
| Claude Sonnet 5 ($2 / $10) | 24,300 × $2 + 1,500 × $10 = $0.064 | $0.049 | $0.11 | $0.39, 71% less |
| GPT-5.4 ($2.50 / $15) | 24,300 × $2.50 + 1,500 × $15 = $0.083 | $0.049 | $0.13 | $0.50, 74% less |
| Claude Opus 5 ($5 / $25) | 24,300 × $5 + 1,500 × $25 = $0.159 | $0.049 | $0.21 | $0.98, 79% less |
| DeepSeek V4 Pro ($1.32 / $3.96) | 24,300 × $1.32 + 1,500 × $3.96 = $0.038 | $0.049 | $0.09 | $0.25, 65% less |
The verifier's job is narrow: check that the tool results support the conclusion and produce the final output. Give it a tool to reject the run and route rejections to a full flagship rerun; if fewer than one in ten runs is rejected, the hybrid stays far cheaper than the flagship alone. The same split scales up into the planner-and-workers layout in [multi-agent system cost](/guides/multi-agent-system-cost).
An OpenAI-compatible loop against the DeepSeek endpoint
DeepSeek's API is OpenAI-compatible, so the official openai package works with a different base URL. This loop runs the tool steps on V4.1 Flash and computes cost from usage on every response:
import json, os
from openai import OpenAI
client = OpenAI(api_key=os.environ["DEEPSEEK_API_KEY"], base_url="https://api.deepseek.com")
MODEL = "deepseek-flash" # V4.1 Flash; the old "deepseek-v4-flash" name bills the same
spent = 0.0
messages = [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": task}]
for step in range(11):
resp = client.chat.completions.create(model=MODEL, messages=messages, tools=TOOLS, max_tokens=1024)
u = resp.usage
spent += (u.prompt_tokens * 0.30 + u.completion_tokens * 1.20) / 1e6 # V4.1 Flash peak rates per 1M
msg = resp.choices[0].message
messages.append(msg)
if not msg.tool_calls:
break
for call in msg.tool_calls:
args = json.loads(call.function.arguments) # validate before executing
messages.append({"role": "tool", "tool_call_id": call.id,
"content": run_tool(call.function.name, args)[:6000]})
# hand `messages` to the verifier model; step 12 on Sonnet 5 ≈ 24,300 × $2 + 1,500 × $10 = $0.064Truncating tool results at 6,000 characters (roughly 1,500 tokens) keeps the trace matching the table. The [DeepSeek 101 course](/tutorials/deepseek-101) covers the endpoint basics.
Cheapest model that still does this, and when to pay for the flagship
Claude Haiku 5.5 is now the cheapest row on this page, at $0.020 for the reference run, below V4.1 Flash even off-peak ($0.029). We have not yet run it on these loops, so test it on your own tasks before switching. For well-specified tool loops, V4.1 Flash is the cheapest model on this page that we have seen hold up in production, at $0.058 at peak. Gemini 3.8 Flash at $0.15 is the next step up with a different failure profile; the ranking across all of them is in [cheapest LLM for AI agents](/guides/cheapest-llm-for-ai-agents).
Pay for a flagship on the whole loop, not just the last step, when the task is ambiguous from step one, when the loop needs more than ten steps of real planning, or when a wrong answer costs more than the $0.34 you save. Claude Opus 5 at $0.98 or GPT-5.5 at $1.01 for the reference run is still cheap next to one bad decision.
How to cap spend on a DeepSeek loop
Cheap loops run unwatched, which is how a 200-step loop happens. At V4.1 Flash peak rates a 200-step runaway is 36.72M input × $0.30 + 80,000 output × $1.20 = about $11.11. That is small enough that nobody notices until it runs on ten thousand tasks. Keep the same four controls you would use on Sonnet 5:
max_tokensper call, 1,024 for tool steps- A step cap, 12 to 25, enforced in the loop
- A stop condition: end on a response with no
tool_calls, and abort on a repeated identical call - A per-run dollar budget summed from
usage.prompt_tokensandusage.completion_tokens, plus the verifier's usage
The runner in [token budget guardrails](/guides/ai-agent-token-budget-guardrails) does this for Anthropic and ports to this endpoint by swapping the usage field names. Price your own trace across vendors in the [calculator](/calculator).
Key Takeaways
- →DeepSeek V4.1 Flash (API name deepseek-flash, replaced V4 Flash): $0.30 / $1.20 per 1M at peak; V4 Pro: $1.32 / $3.96 at peak; both half price off-peak, 1M context
- →Reference 12-step run at peak: Claude Haiku 5.5 $0.020, V4.1 Flash $0.058, Gemini 3.8 Flash $0.15, V4 Pro $0.25, Claude Sonnet 5 $0.39, GPT-5.4 $0.50; V4.1 Flash off-peak is $0.029
- →Reliable in our experience for structured tool calls on well-specified tasks and for long-context reads; weaker on ambiguous tasks, long multi-turn planning and strict JSON edge cases
- →Hybrid loop: 11 steps on V4.1 Flash plus one Sonnet 5 verification step costs about $0.11; with Opus 5 verifying, about $0.21
- →Direct API means DeepSeek's own servers and data policy; OpenRouter lets you pick a hosting region at a different listed rate
- →Same guardrails apply: a 200-step V4.1 Flash loop is about $11, cheap enough that teams forget to cap it
Editorial context
Who is this for?
Developers choosing a model for tool-calling loops who want to know whether DeepSeek's prices hold up on real agent traces.
When NOT to use this
Regulated workloads that cannot send data to DeepSeek's servers and cannot use a pinned-region host, or tasks that are ambiguous from the first step.
Pricing insights
V4.1 Flash is about 7 times cheaper per input token than Claude Sonnet 5 and about 8 times cheaper than GPT-5.4 at peak; on a 12-step loop that is $0.058 against $0.39 and $0.50.
Alternatives to consider
Claude Haiku 5.5 at $0.10 / $0.50 (prompts up to 100K tokens), which is cheaper than V4.1 Flash, and Gemini 3.8 Flash at $0.75 / $3.75 for cheap loops with different failure profiles; a flagship for planning-heavy runs.
Final verdict
Use V4.1 Flash for the loop when the task is well specified, verify with a flagship, and cap the run. That combination is the cheapest agent configuration we have seen hold up; Claude Haiku 5.5 is cheaper per run but not yet tested on these loops.
Frequently Asked Questions
How much does DeepSeek V4 cost for an AI agent?
DeepSeek V4.1 Flash, which replaced V4 Flash, lists at $0.30 per million input tokens and $1.20 per million output at peak; V4 Pro at $1.32 and $3.96. Off-peak hours cost half. A 12-step tool loop that reads 172,800 input tokens and writes 4,800 output tokens costs about $0.058 on V4.1 Flash and about $0.25 on V4 Pro at peak, against about $0.39 on Claude Sonnet 5 and $0.50 on GPT-5.4.
Does DeepSeek support tool calling?
Yes. The DeepSeek API is OpenAI-compatible, so you pass a tools array to chat.completions.create and receive tool_calls on the response the same way you would with the OpenAI SDK. In our experience V4 Flash made correct structured calls on well-specified tasks; check argument JSON before executing, because strict-schema edge cases are where it slips.
Where does DeepSeek V4 fail in agents?
Reports and our own use point to three areas: ambiguous tasks where the model must infer intent, long multi-turn planning where it loses track of what it has already done, and strict JSON edge cases such as nested optional fields or unusual escaping. For those, route the planning or the final step to Claude Sonnet 5, GPT-5.4 or a flagship.
Should I use DeepSeek direct or through OpenRouter?
Direct gives you DeepSeek's own list price and its own servers and data policy, which some organisations cannot accept. OpenRouter routes to third-party hosts, lets you restrict which providers or regions serve the request, and lists the same model at whatever rate the host sets, which can differ from the direct price. Compare the catalogue rows before choosing.
What is the hybrid DeepSeek plus flagship pattern?
Run the tool loop on DeepSeek V4.1 Flash and send the complete transcript to a flagship for one verification and final-answer step. For the reference run that is about $0.049 for eleven V4.1 Flash steps at peak plus $0.064 for a Claude Sonnet 5 final step, about $0.11 total, which is 71% cheaper than running the whole loop on Sonnet 5.
Is DeepSeek V4 Pro worth 4 times the price of V4.1 Flash?
For most tool loops, no. V4 Pro at $1.32 per million input costs about $0.25 on the reference run at peak, more than Gemini 3.8 Flash ($0.15) and over twelve times Claude Haiku 5.5 ($0.020). V4 Pro earns its place when you want a stronger model from the same vendor for the planning step without changing endpoints.
Related
Free courses · no sign-up
Still deciding? Learn the basics first, then come back to the prices.