Skip to main content
POST
Chat Completion

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

Model ID to use for completion.

Available options:
deepseek-v4-pro,
deepseek-v4-flash
Example:

"deepseek-v4-pro"

messages
object[]
required

A list of messages comprising the conversation so far.

Minimum array length: 1
Example:
max_tokens
integer

The maximum number of tokens to generate in the chat completion.

Required range: x >= 1
temperature
number
default:1

Sampling temperature between 0 and 2. Higher values make output more random, lower values more deterministic.

Required range: 0 <= x <= 2
Example:

1

top_p
number

Nucleus sampling threshold. An alternative to temperature.

Required range: 0 <= x <= 1
frequency_penalty
number
default:0

Penalizes new tokens based on their existing frequency in the text so far.

Required range: -2 <= x <= 2
presence_penalty
number
default:0

Penalizes new tokens based on whether they appear in the text so far.

Required range: -2 <= x <= 2
stream
boolean
default:false

If true, partial message deltas will be sent as server-sent events.

stop

Up to 4 sequences where the API will stop generating further tokens.

n
integer
default:1

How many chat completion choices to generate for each input message.

Required range: x >= 1
response_format
object

An object specifying the format that the model must output. Setting to {"type": "json_object"} enables JSON mode.

tools
object[]

A list of tools the model may call. Currently, only functions are supported as a tool.

tool_choice

Controls which (if any) tool is called by the model.

user
string

A unique identifier representing your end-user.

Response

Completion generated successfully

id
string
required
Example:

"chatcmpl-abc123"

object
string
required
Example:

"chat.completion"

created
integer
required

Unix timestamp of when the completion was created.

model
string
required
Example:

"deepseek-v4-pro"

choices
object[]
required
usage
object