deepseek-v4-flash Chat Completions
Invoke DeepSeek chat completions capability.
Supported models include deepseek-v4-flash.
Documented fields: model, messages, thinking, stream, stream_options.include_usage, max_tokens, stop, reasoning_effort, response_format, temperature, top_p, logprobs, top_logprobs, tools, tool_choice, user_id. messages[].content supports text content (string); assistant messages support reasoning_content and tool_calls.
Authorizations
Pass Authorization: Bearer <token> in the request header.
Body
DeepSeek chat completions request body.
The ID of the model to use. Supports deepseek-v4-flash.
deepseek-v4-flash "deepseek-v4-flash"
A list of messages comprising the conversation so far.
1A single message in the conversation. Depending on the role, it is divided into four message types: system, user, assistant, and tool.
- System message
- User message
- Assistant message
- Tool message
Controls the switch between thinking mode and non-thinking mode.
If set to true, the model will send message deltas as SSE (server-sent events). The message stream ends with data: [DONE].
Options for streaming output. This parameter can only be set when the stream parameter is true.
The maximum number of tokens the model can generate for the completion in a single request. The total length of input and output tokens is limited by the model's context length.
A string or a list of up to 16 strings. The API will stop generating further tokens when it encounters any of these strings.
Controls the reasoning effort of the model. For normal requests, the default is high. For some complex agent-style requests (e.g. Claude Code, OpenCode), it is automatically set to max. For compatibility, low and medium are mapped to high, and xhigh is mapped to max.
high, max An object specifying the format that the model must output. Setting to { "type": "json_object" } enables JSON Output, which guarantees the message the model generates is valid JSON.
Important: When using JSON Output, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.
Sampling temperature between 0 and 2. Higher values like 0.8 make the output more random, while lower values like 0.2 make it more focused and deterministic. We generally recommend altering this or top_p but not both.
0 <= x <= 2An alternative to sampling with temperature, the model considers the results of the tokens with top_p probability. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
0 <= x <= 1Whether to return the log probabilities of the output tokens. If true, the log probabilities of each output token are returned in the content of the message.
An integer N between 0 and 20 that specifies the top N tokens by probability to return at each output position, along with their log probabilities. When this parameter is specified, logprobs must be true.
0 <= x <= 20A list of tools the model may call. Currently, only function is supported as a tool. Use this parameter to provide a list of functions that take JSON as input. Up to 128 functions are supported.
Controls the model's tool calling behavior. none means the model will not call any tool and instead generates a message. auto means the model can choose to generate a message or call one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.
none, auto, required Your custom user_id, with the character set [a-zA-Z0-9-_] and a maximum length of 512. Do not include private user information in user_id. user_id can be used to distinguish user identities on your side to help us with content safety review. user_id can be used for KVCache isolation for privacy management. user_id can be used for scheduling isolation of users on your business side.
Response
Success. Returns JSON in non-streaming mode; returns an SSE event stream in streaming mode.
DeepSeek chat completions success response.
A unique identifier for the chat.
The type of the object, which is chat.completion.
The Unix timestamp (in seconds) when the chat completion was created.
The name of the model that generated the completion.
This fingerprint represents the backend configuration that the model runs with.
A list of completions generated by the model.
Usage information for this chat completion request.