Skip to main content
POST
deepseek-v4-pro

Authorizations

Authorization
string
header
required

Pass Authorization: Bearer <token> in the request header.

Body

application/json

DeepSeek chat completions request body.

model
enum<string>
required

The ID of the model to use. Supports deepseek-v4-pro.

Available options:
deepseek-v4-pro
Example:

"deepseek-v4-pro"

messages
(System message · object | User message · object | Assistant message · object | Tool message · object)[]
required

A list of messages comprising the conversation so far.

Minimum array length: 1

A single message in the conversation. Depending on the role, it is divided into four message types: system, user, assistant, and tool.

thinking
object

Controls the switch between thinking mode and non-thinking mode.

stream
boolean
default:false

If set to true, the model will send message deltas as SSE (server-sent events). The message stream ends with data: [DONE].

stream_options
object

Options for streaming output. This parameter can only be set when the stream parameter is true.

max_tokens
integer

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.

stop

A string or a list of up to 16 strings. The API will stop generating further tokens when it encounters any of these strings.

reasoning_effort
enum<string>

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.

Available options:
high,
max
response_format
object

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.

temperature
number
default:1

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.

Required range: 0 <= x <= 2
top_p
number
default:1

An 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.

Required range: 0 <= x <= 1
logprobs
boolean

Whether 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.

top_logprobs
integer

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.

Required range: 0 <= x <= 20
tools
object[]

A 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.

tool_choice

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.

Available options:
none,
auto,
required
user_id
string

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.

id
string

A unique identifier for the chat.

object
string

The type of the object, which is chat.completion.

created
integer

The Unix timestamp (in seconds) when the chat completion was created.

model
string

The name of the model that generated the completion.

system_fingerprint
string

This fingerprint represents the backend configuration that the model runs with.

choices
object[]

A list of completions generated by the model.

usage
object

Usage information for this chat completion request.