DeepSeek Responses API: How to Call It vs Chat
📑 Table of Contents
- Introduction
- I. What DeepSeek Responses API Is — vs Codex and Chat
- II. Minimal Call: Change the Method, Not the base_url
- III. Streaming: No data: [DONE] — Listen for Event Names
- IV. Stateless Traps: Do Not Rely on previous_response_id
- V. When to Use Responses vs Stay on Chat
- VI. FAQ
- Summary
- Further reading
Introduction
Search DeepSeek Responses API, and many people merge it with “Codex setup” or “a drop-in Chat Completions swap.” They are three different paths.
On the same base_url (https://api.deepseek.com), DeepSeek API natively supports the OpenAI-style Responses format: call client.responses.create, send instructions + input, and read a typed output item list. This site is an independent community; treat the official Using the Responses API guide as the compatibility source of truth. Below is how to call it from your own code, streaming differences, and when to keep Chat Completions / Codex — not another one-click script walkthrough.

I. What DeepSeek Responses API Is — vs Codex and Chat
| Path | What you are doing | Typical entry |
|---|---|---|
| Chat Completions | Your service / SDK with a messages array | client.chat.completions.create |
| Responses API | Your service / SDK with instructions + input | client.responses.create |
| Codex clients | CLI / desktop / VS Code via wire_api=responses | See DeepSeek Codex setup |
In one line: Responses is the protocol surface; Codex is a client that consumes it; Chat Completions remains the broadest compatibility default. DeepSeek added Responses for Codex first; current docs list deepseek-v4-flash / deepseek-v4-pro / deepseek-v4-flash-vision-exp. Thinking controls differ: Chat uses thinking + reasoning_effort; Responses uses reasoning.effort (none turns it off) — see DeepSeek thinking mode.
II. Minimal Call: Change the Method, Not the base_url
from openai import OpenAI
client = OpenAI(
api_key="YOUR_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)
Essentials:
- Pass at least one of
inputorinstructions.instructionsis inserted as the first system message. - Use
output_textfor the final answer shortcut; walkoutputitems when you need reasoning / tool rows (thinking mode often emitsreasoningthenmessage). - Keys still come from the official platform; overview: DeepSeek API.
III. Streaming: No data: [DONE] — Listen for Event Names
With stream=True, you get a semantic SSE event sequence (event + rising sequence_number), ending on response.completed / incomplete / failed — not the Chat Completions data: [DONE] trailer.
stream = client.responses.create(
model="deepseek-v4-flash",
instructions="You are a helpful assistant.",
input="Hi, how are you?",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="")
Practice: drive the typewriter UI from response.output_text.delta; wait for response.completed for the full object including usage. Reasoning deltas: response.reasoning_text.delta. Full event table: official guide.
IV. Stateless Traps: Do Not Rely on previous_response_id
DeepSeek’s Responses implementation is stateless:
| Habit from OpenAI Responses | On DeepSeek |
|---|---|
previous_response_id continuation | Unsupported; always null |
store / conversation | Unsupported; store is always false |
| Server remembers the last turn | No — put history into this request’s input |
| Unsupported parameters | Often silently ignored (no error) — HTTP 200 ≠ every field applied |
So multi-turn is a client job: resend the full input item list. Oversized input returns 400 (no auto-truncation). Cache still follows automatic prefix rules: context caching; rate limits: 429 guide.

V. When to Use Responses vs Stay on Chat
| Scenario | Pick |
|---|---|
Existing chat.completions stack; stability first | Keep Chat Completions |
| Codex, or an Agent loop already written for Responses | Responses (Codex wiring: Codex setup) |
Need typed output items (reasoning / function_call / web_search_call) | Responses fits better |
Only swapping base_url for OpenAI-compatible chat | Chat Completions is the shortest path |
| Image input | Responses: input_image + deepseek-v4-flash-vision-exp; same limits as Chat vision |
Tools: function and server-side web_search work; apply_patch is the Codex-compatible custom name. Other built-in tool types are often ignored. Trust the official compatibility table — do not assume 1:1 with OpenAI cloud.
VI. FAQ
Do I need a new SDK?
Usually no. Official OpenAI Python / Node SDKs work after you change base_url and the key, then call responses.create.
Is this the same as the Anthropic-compatible endpoint?
No. Anthropic-compatible traffic uses https://api.deepseek.com/anthropic; Responses stays on the OpenAI-compatible base_url. Do not mix field shapes.
How do I turn thinking off?
Responses: reasoning.effort = "none". Do not paste Chat’s extra_body.thinking shape.
Can production use Responses as the only entry?
Yes, if you accept statelessness and silent ignores. Cover streaming end events, client-held history, and tool round-trip shapes with integration tests.
Summary
Shortest DeepSeek Responses API path: same base_url → client.responses.create → stream by event name (no DONE) → resend input yourself for multi-turn. Use Codex client config for Codex; keep Chat Completions for the broadest everyday compatibility. Official docs own the matrix; this page is a chooser and foot-gun list.
Further reading
DeepSeek V4 Pro Team
DeepSeek V4 Pro technical team
Ready to experience DeepSeek V4?
Start chatting now and feel the power of 1M-token context.
🚀 Start ChattingFree · No sign-up required
🧭 In this series
Explore related guides and hub pages in this topic cluster.
Category hub
Tutorial →