Buried in DeepSeek’s July 31 V4-Flash release announcement is a key integration detail: V4-Flash “natively supports the Responses API format and is fully adapted for Codex.” In practical terms, DeepSeek implemented OpenAI’s newer agent-oriented API format server-side so OpenAI-style tooling—including Codex—can target a DeepSeek model without an API translation proxy.
This guide shows how to call the endpoint, what compatibility gaps to account for, how to configure Codex, and how to validate the integration before using it on a production repository. For basic setup, see the V4-Flash public beta guide.
Why the Responses API matters
OpenAI introduced the Responses API as a successor to Chat Completions for agentic workloads. It supports reasoning items, tool calls, and semantic streaming events in one interface. See How to use the OpenAI Responses API for a format overview.
Codex speaks this API format natively. Previously, using a non-OpenAI model behind a Responses API client generally required a proxy layer. DeepSeek now supports the format directly at https://api.deepseek.com.
Use the official OpenAI Python SDK with a custom base URL:
# pip3 install openai
from openai import OpenAI
client = OpenAI(
api_key="<your DeepSeek API key>",
base_url="https://api.deepseek.com",
)
response = client.responses.create(
model="deepseek-v4-flash",
instructions="You are a helpful assistant.",
input="Hi, how are you?",
)
print(response.output_text)
Scope: The Responses API currently supports
deepseek-v4-flashonly. DeepSeek saysdeepseek-v4-prosupport is planned for early August 2026.
Check compatibility before migrating
DeepSeek publishes a Responses API compatibility matrix. Review it before assuming every OpenAI Responses API feature behaves identically.
Supported parameters and features
The following are documented as supported:
-
inputandinstructions, as strings or item lists -
streamwith semantic response events -
temperature,top_p,max_output_tokens, andtop_logprobs -
toolswithfunctionandweb_search -
tool_choice, including forcing a specific function reasoning.effort- Parallel tool calls
For example, send a function tool with a Responses API request:
response = client.responses.create(
model="deepseek-v4-flash",
input="What is the weather in Tokyo?",
tools=[
{
"type": "function",
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"},
},
"required": ["city"],
"additionalProperties": False,
},
}
],
)
Parameters accepted but ignored
DeepSeek accepts these parameters without returning an error, but they currently have no effect:
reasoning.summarytext.verbosityparallel_tool_calls
parallel_tool_calls is ignored because parallel tool calling is always enabled.
Features you must handle yourself
DeepSeek’s implementation is stateless. Do not rely on:
previous_response_idconversationstorebackgroundmetadataincludeservice_tier- Prompt caching keys
Every response returns store: false. To support multi-turn conversations, keep history in your own application and send it with each request.
history = [
{
"role": "user",
"content": [{"type": "input_text", "text": "Explain Python decorators."}],
},
{
"role": "assistant",
"content": [{"type": "output_text", "text": "A decorator wraps or modifies a function."}],
},
{
"role": "user",
"content": [{"type": "input_text", "text": "Show a small example."}],
},
]
response = client.responses.create(
model="deepseek-v4-flash",
input=history,
)
Also account for the context limit explicitly. Requests exceeding the 1M-token context window return HTTP 400; they are not automatically truncated.
Handle streaming events correctly
DeepSeek uses the Responses API event model:
response.created- Reasoning deltas such as
response.reasoning_text.delta - Output deltas such as
response.output_text.delta - Terminal events:
response.completed,response.incomplete, orresponse.failed
Do not wait for a data: [DONE] terminator. This stream does not use one. An SSE handler that waits for [DONE] can hang after the server has already finished the response.
A basic streaming pattern looks like this:
stream = client.responses.create(
model="deepseek-v4-flash",
input="Write a Python function that reverses a string.",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
elif event.type in {
"response.completed",
"response.incomplete",
"response.failed",
}:
break
For more defensive SSE handling patterns, see streaming API responses with server-sent events.
Set up Codex with DeepSeek-V4-Flash
Codex uses the Responses API, which is why this integration works. DeepSeek’s Codex integration guide provides setup options that configure the shared Codex configuration used by the CLI, ChatGPT desktop app, and VS Code extension.
Option 1: Run the setup script
First, install Codex CLI or the ChatGPT desktop app and run it at least once.
On macOS or Linux:
bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh)
On Windows PowerShell:
irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iex
On first run, the script asks for your DeepSeek API key. It then:
- Backs up
~/.codex/config.tomlto~/.codex/backup-deepseek/ - Writes a model catalog to
~/.codex/models.json - Adds a
[model_providers.deepseek]configuration section - Preserves MCP server and project trust settings
- Validates configuration syntax before writing changes
Run the script again to switch models or restore the previous configuration.
As with any curl | bash workflow, inspect the script before executing it if that is required by your security policy.
Confirm the Codex model requirements
The generated models.json documents the current model configuration:
- Context window: 1,048,576 tokens
- Reasoning levels:
low,high, andmax - Default reasoning level:
high - Parallel tool calls: supported
- Minimum Codex client version:
0.144.0
Currently, only deepseek-v4-flash works with this Responses API integration. The catalog also includes deepseek-v4-pro for the planned rollout.
Validate the endpoint before using it in an agent
Test a new endpoint independently before giving an agent access to a real repository. You can do this in Apidog in a few minutes.
- Create a
POSTrequest for:
https://api.deepseek.com/responses
Store your DeepSeek API key in an environment variable and add the authorization header.
Send a minimal request:
{
"model": "deepseek-v4-flash",
"instructions": "You are a concise coding assistant.",
"input": "Write a hello-world script in Python."
}
Confirm the response contains the output item types your application expects, such as
reasoningfollowed bymessage.Enable streaming:
{
"model": "deepseek-v4-flash",
"input": "Explain dependency injection in one paragraph.",
"stream": true
}
Verify your client processes
response.output_text.deltaand terminates onresponse.completed,response.incomplete, orresponse.failed.Save a request containing a
functiontool and verify that the returnedfunction_callformat matches your tool handler.
When V4-Pro Responses support arrives, reuse these saved requests against the new model name and compare the output and event behavior. Download Apidog to keep endpoint tests, environments, and examples in one project.
Cost and evaluation considerations
DeepSeek reports the following V4-Flash pricing:
- Input tokens, cache miss: $0.14 per million tokens
- Output tokens: $0.28 per million tokens
- Input tokens, cache hit: $0.0028 per million tokens
For the complete pricing table, see the V4-Flash beta guide pricing section.
DeepSeek also reports agent benchmark results for the 0731 re-post-training, including Terminal Bench 2.1, Cybergym, Toolathlon verified, and DeepSWE. Treat these as vendor-reported numbers until independent evaluations are available: they were produced using DeepSeek’s own harness at maximum effort, and two benchmarks in the announcement are internal test sets.
The practical test is your own repository:
- Run the same Codex task with your current model and V4-Flash.
- Measure task completion, test pass rate, tool-call reliability, latency, and token usage.
- Test failure paths, not just happy paths.
- Compare the results against cost for your actual workload.
If you are comparing the agent clients themselves, see Claude Code vs Codex CLI.
FAQ
Which DeepSeek models support the Responses API?
Only deepseek-v4-flash currently supports it. DeepSeek says deepseek-v4-pro support is scheduled for early August 2026.
Do I need a new SDK?
No. Use the official OpenAI SDK, point base_url to https://api.deepseek.com, and call client.responses.create. See the V4-Flash public beta guide for setup details.
Does multi-turn state work like OpenAI’s implementation?
No. DeepSeek’s Responses API implementation is stateless. previous_response_id, conversation, and store are unsupported. Send the complete relevant conversation history as input items on each call.
Can I use DeepSeek in Codex alongside an OpenAI account?
Yes. The setup adds DeepSeek as a model provider. The setup script can switch models, and it backs up the original configuration so you can restore it.
Is this the same as DeepSeek’s Anthropic compatibility endpoint?
No. DeepSeek also provides an Anthropic-format endpoint at https://api.deepseek.com/anthropic, which is used for Claude Code integrations. The Responses API endpoint is for OpenAI-format tooling such as Codex.
What to do next
The main value of this release is integration: DeepSeek implemented the API format used by OpenAI’s agent tooling and documented where behavior differs.
Before adopting it broadly:
- Use the Responses API directly with a small test request.
- Test SSE event handling without relying on
[DONE]. - Verify function-call payloads against your tool executor.
- Configure Codex and run a controlled repository evaluation.
- Compare results, reliability, and cost using your own tasks.
Connect the endpoint in Apidog, run the same test suite across models, and use those results—not a benchmark table alone—to decide whether V4-Flash fits your workflow.

Top comments (0)