Skip to main content
POST
Chat completion

Authorizations

Authorization
string
header
required

Authenticate with a Bearer token. After creating an API key in the Cube AI console, pass it as Bearer YOUR_API_KEY in the Authorization header.

Body

application/json
model
enum<string>
required

model ID

Available options:
deepseek-v4-pro
Example:

"deepseek-v4-pro"

messages
object[]
required

List of conversation messages.

Minimum array length: 1
Example:
thinking
object | null

Enable or disable thinking mode.

max_tokens
integer

Maximum number of tokens to generate.

Required range: x >= 1
response_format
object

Set {"type": "json_object"} to enable JSON mode.

stop

Sequences that stop generation. Up to 16.

stream
boolean
default:false

When true, results are streamed back via SSE.

stream_options
object

Streaming options. Only valid when stream is true.

temperature
number
default:1

Sampling temperature. Higher values make the output more random.

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

1

top_p
number
default:1

Nucleus sampling threshold.

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

A list of tools the model can call. Currently only function calling is supported.

tool_choice

Controls tool-calling behavior: none, auto, required, or a specific function.

Available options:
none,
auto,
required
frequency_penalty
number
default:0

Deprecated by DeepSeek. Passing this has no effect.

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

Deprecated by DeepSeek. Passing this has no effect.

Required range: -2 <= x <= 2
user_id
string

Custom user ID, used for content-safety processing and KVCache isolation.

Maximum string length: 512
Pattern: ^[a-zA-Z0-9\-_]+$

Response

Response generated successfully

id
string
Example:

"chatcmpl-abc123"

object
string
Example:

"chat.completion"

created
integer

Unix timestamp

model
string
Example:

"deepseek-v4-pro"

choices
object[]
usage
object
system_fingerprint
string | null

Backend configuration fingerprint.