DeepSeek shipped the official DeepSeek-V4-Flash API this morning. The announcement landed on July 31, 2026, and the release notes highlight three changes: stronger agent capabilities, native OpenAI Responses API support, and Codex compatibility from day one.
If you have been calling deepseek-v4-flash since April, you were using the preview. The official release is DeepSeek-V4-Flash-0731, but the model ID remains deepseek-v4-flash, so existing integrations upgrade without code changes.
This guide shows how to get an API key, make a request, configure thinking mode, stream responses, and test requests before shipping. For an overview of the model family, see What Is DeepSeek V4?.
π‘ Use Apidog to send DeepSeek requests, inspect streaming events, and save working requests as reusable tests before you integrate them into your application.
What shipped on July 31
According to the official change log, this release applies to the API only. The DeepSeek app, web models, and V4-Pro API are unchanged.
- DeepSeek-V4-Flash-0731 is the official public-beta release of the V4-Flash API.
- It uses the same architecture and size as V4-Flash-Preview. DeepSeek says the improvement comes from re-post-training rather than a larger network.
- Agent benchmark scores exceed V4-Pro-Preview in DeepSeek's published results: Terminal Bench 2.1 at 82.7, Cybergym at 76.7, Toolathlon verified at 70.3, and DeepSWE at 54.4. These are DeepSeek-reported results using its maximum-effort harness.
- Responses API support and Codex integration are now available. See DeepSeek-V4-Flash now supports the Responses API and Codex for implementation details.
- DeepSeek says the official V4-Pro release will follow soon, with Responses API and Codex support expected in early August 2026.
Treat benchmark claims as vendor-reported until independent evaluations are available. DeepSeek also lists DSBench-FullStack and DSBench-Hard, which are internal test sets.
Step 1: Create and store an API key
Open the DeepSeek Platform, sign in, and create a key from the API Keys page. Keys begin with sk-.
Store the key in an environment variable instead of committing it to source control:
export DEEPSEEK_API_KEY="sk-your-key-here"
DeepSeek supports OpenAI-compatible and Anthropic-compatible API formats, so you can use existing SDKs.
| Format | Base URL |
|---|---|
| OpenAI-compatible | https://api.deepseek.com |
| Anthropic-compatible | https://api.deepseek.com/anthropic |
Step 2: Send a first request
Start with curl to validate your key, base URL, and model ID:
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Summarize what changed in DeepSeek-V4-Flash-0731."}
],
"stream": false
}'
Python with the OpenAI SDK
Point the OpenAI SDK at DeepSeek's base URL:
# pip3 install openai
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("DEEPSEEK_API_KEY"),
base_url="https://api.deepseek.com"
)
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "Write a Python function that validates an email address."
}
],
stream=False
)
print(response.choices[0].message.content)
Node.js with the OpenAI SDK
// npm install openai
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://api.deepseek.com",
apiKey: process.env.DEEPSEEK_API_KEY,
});
const completion = await openai.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(completion.choices[0].message.content);
Because deepseek-v4-flash now resolves to the 0731 release, preview integrations receive the official model automatically. There is no migration step.
Step 3: Configure thinking mode and reasoning effort
V4-Flash supports thinking and non-thinking modes. Thinking is enabled by default.
Use thinking to enable it explicitly, and use reasoning_effort to control how much effort the model spends on a task:
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{
"role": "user",
"content": "Plan a database migration from MySQL to Postgres."
}
],
reasoning_effort="high",
extra_body={"thinking": {"type": "enabled"}}
)
Keep these constraints in mind:
-
temperatureandtop_phave no effect when thinking mode is enabled. - FIM completion (fill-in-the-middle), which is still beta, works only in non-thinking mode.
Use non-thinking mode for latency-sensitive tasks such as autocomplete. Keep thinking enabled for agent loops, planning, debugging, and other complex tasks.
Step 4: Stream the response
Set stream=True to receive server-sent events (SSE). For a deeper breakdown of the event format, see streaming LLM responses with server-sent events.
stream = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "user", "content": "Explain connection pooling."}
],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
For production code, also handle connection failures, partial streams, request timeouts, and client disconnects.
Pricing during the public beta
The official Models & Pricing page lists the following rates:
| Item | deepseek-v4-flash |
deepseek-v4-pro |
|---|---|---|
| Input, cache hit (per 1M tokens) | $0.0028 | $0.003625 |
| Input, cache miss (per 1M tokens) | $0.14 | $0.435 |
| Output (per 1M tokens) | $0.28 | $0.87 |
| Context length | 1M tokens | 1M tokens |
| Max output | 384K | 384K |
| Concurrency limit | 2,500 | 500 |
Implementation considerations:
- Context caching is automatic. A cache hit costs 50x less than a cache miss, so reuse stable system prompts and shared context in long-running agent sessions.
- DeepSeek has announced peak/off-peak billing. Peak hours are 9:00β12:00 and 14:00β18:00 Beijing time, at 2x regular pricing. As of July 31, the documentation says the effective date is subject to an official announcement.
- The 2,500-request concurrency limit for Flash, compared with 500 for Pro, is useful for high-throughput agent workloads.
For pricing across the V4 family, including the V4-Pro permanent price cut, see the DeepSeek V4 API pricing breakdown.
Test and debug the API in Apidog
curl is enough for a smoke test. For comparing thinking modes, debugging streams, and regression-testing prompts after model updates, use Apidog.
Create a project and define the endpoint. Add
POST https://api.deepseek.com/chat/completions, or import an OpenAI-compatible API specification.Store your key in an environment. Add
DEEPSEEK_API_KEYto an Apidog environment and set the Authorization header to:
Bearer {{DEEPSEEK_API_KEY}}
This lets you switch between test and production credentials without editing requests.
Send requests and inspect results. For streaming requests, inspect SSE events as they arrive instead of manually parsing raw
data:lines.Save request variants as test cases. Save separate requests for thinking-enabled and non-thinking mode. Re-run both after model updates to detect output or behavior changes.
Download Apidog for free; this workflow works on the free plan.
FAQ
Do I need to change my code to use the official model?
No. deepseek-v4-flash now serves DeepSeek-V4-Flash-0731, so existing integrations upgrade automatically.
Is this the same model as the DeepSeek app?
No. The July 31 update applies to the API only. DeepSeek's app and web models are unchanged.
What happened to deepseek-chat and deepseek-reasoner?
Those legacy names were scheduled for discontinuation on July 24, 2026. Use deepseek-v4-flash or deepseek-v4-pro. See how to use the DeepSeek V4 API for migration guidance.
Can I use it for free?
DeepSeek's API is pay-as-you-go and does not have a permanent free tier. Cache-hit pricing can make experimentation inexpensive. See how to use the DeepSeek V4 API for free for current options.
Does V4-Flash support Codex and the Responses API?
Yes. V4-Flash supports both, and is currently the only DeepSeek model with both capabilities. V4-Pro support is expected in early August 2026. See the Responses API and Codex guide.
Bottom line
DeepSeek-V4-Flash-0731 keeps the same model ID, pricing, and architecture while improving agent-focused performance according to DeepSeek's published evaluations. Its native Responses API support and Codex compatibility make it practical for high-concurrency agent workloads.
Start by pointing your OpenAI SDK to https://api.deepseek.com, then run your own prompt and tool-use test suite before relying on benchmark results. Apidog can speed up that loop: save prompts as test cases, compare thinking modes, inspect streams, and rerun the suite after every model update.


Top comments (0)