DeepSeek V4 - Responses API
- Call DeepSeek V4 models using the OpenAI Responses protocol
- Supports both
deepseek-v4-flash(fast general-purpose) anddeepseek-v4-pro(deep reasoning) - Input shapes:
inputcan be plain text or an array of input items (message, function call, function result, reasoning, search record) - System instructions: provided via
instructions, equivalent to a leading system message - Thinking mode: controlled by
reasoning.effort; thinking content is returned as areasoningoutput item - Streaming: semantic SSE events ending with
response.completed; no[DONE]is sent - Tool calling: supports Function Calling and the built-in
web_searchtool - Structured output: enabled via
text.formatfor JSON object or JSON Schema - Context caching: requests sharing a prefix hit the cache automatically, greatly reducing input cost
Streaming events: response.created, response.output_item.added, response.reasoning_text.delta, response.output_text.delta, with terminal events response.completed / response.incomplete / response.failed. Every event carries a sequence_number for ordering.
Fields with no effect: the following OpenAI fields can be sent without error, but produce no actual effect.
| Field | Behavior |
|---|---|
store | Always false; responses are not stored |
previous_response_id | Always null; resuming a conversation is not supported |
conversation | Not supported |
background / metadata / include | Ignored |
prompt / truncation / service_tier | Ignored |
safety_identifier / context_management | Ignored |
stream_options | Ignored |
parallel_tool_calls | Ignored; parallel tool calls are always enabled |
max_tool_calls | Ignored |
file_search / code_interpreter / mcp tools | Ignored |
Other limitations:
- Custom tools (
type: custom) supportapply_patchonly - The
web_searchtool ignoressearch_context_sizeanduser_location - Image and file content blocks are converted to placeholders; DeepSeek V4 is not a vision model
- Input exceeding the context window returns 400 directly, with no automatic truncation
https://direct.evolink.ai, which has better support for text models and long-lived connections. https://api.evolink.ai is the primary endpoint for multimodal services and serves as a fallback address for text models.Authorizations
##All APIs require Bearer Token authentication##
Get API Key:
Visit the API Key Management Page to obtain your API Key
Add to request header:
Body
Model ID
deepseek-v4-flash: fast and general-purpose, suited to everyday chat, summarization and extractiondeepseek-v4-pro: deep reasoning, suited to complex math, code and multi-step planning
deepseek-v4-flash, deepseek-v4-pro "deepseek-v4-flash"
Model input. At least one of input and instructions must be provided.
- String form: the whole text is treated as a single
usermessage - Array form: a list of input items supporting five types —
message,function_call,function_call_output,reasoning,web_search_call
Multi-turn conversations: the endpoint is stateless, so continuing a conversation requires putting the full history into the array.
"Introduce Hangzhou in one sentence."
System-level instructions, equivalent to a system message inserted at the very front; used to set the role, tone and output constraints.
"You are a meticulous technical writer. Keep answers concise."
Whether to stream the response
false(default): returns the complete response object at oncetrue: pushes semantic SSE events; the final event isresponse.completed/response.incomplete/response.failed, and no[DONE]is sent
false
Maximum number of output tokens for this generation (including thinking tokens). Range 1 to 393216 (384K). Leave empty to let the model decide.
1 <= x <= 3932164096
Sampling temperature; higher values make output more random. Has no effect in thinking mode.
0 <= x <= 21
Nucleus sampling threshold. Adjust either this or temperature, not both. Has no effect in thinking mode.
x <= 11
Return the most likely candidate tokens and their log probabilities at each position.
0 <= x <= 200
Thinking mode configuration. DeepSeek V4 enables thinking by default; thinking content is returned as a reasoning output item, and its tokens count toward output and are billed at the output rate.
Text output format configuration.
List of tools available to the model. Function tools are executed by the client, which returns the result as function_call_output; web_search is executed directly server-side with no client involvement.
Tool choice strategy
none: tool calling disabledauto(default): the model decidesrequired: at least one tool must be called{"type": "function", "name": "get_weather"}: force a specific function{"type": "web_search"}: force a web search
"auto"
Response
Generation successful
Response object of the Responses endpoint.
Unique identifier of this response
"resp_9f2c1a4b8e7d"
Object type, always response
"response"
Creation time as a Unix timestamp (seconds)
1755000000
Response status
completed: finished normallyin_progress: still generatingincomplete: truncated, e.g. by length; seeincomplete_detailsfailed: generation failed; seeerror
in_progress, completed, incomplete, failed "completed"
ID of the model that actually generated this response
"deepseek-v4-flash"
List of output items in generation order. Fields per type:
reasoning: the thinking process, withid,status,content(list ofreasoning_textblocks) andsummarymessage: the final answer, withid,status,roleandcontent(list ofoutput_textblocks)function_call: a function call from the model, withid,status,call_id,nameandarguments; the client executes it and returns the result asfunction_call_outputweb_search_call: a web search record executed server-side, withid,statusandaction(describing the search performed)
Failure reason; null on success
Truncation reason; null when not truncated
Token usage statistics (including cache and reasoning breakdowns)