Skip to main content
POST
Create chat completion
Creates a model response for a conversation. This is the only inference endpoint: every workload goes through it, distinguished by its scope.

Protégé parameters

string
Alias for the workload name, for clients where a body field is easier than a header. Must match ^[a-z0-9_-]{1,63}$.x-protege-workload wins when both are present. Omitting both attributes the call to the main workload of the default project. See Projects and workloads.
string
default:"default"
Project slug, ^[a-z0-9-]{1,63}$. Provisioned on first use.
string
default:"main"
Workload name, ^[a-z0-9_-]{1,63}$. Provisioned on first use.
string
required
A model id from the catalog, for example deepseek-v4-flash. The provider-pinned form (alibaba/qwen-flash) is accepted and normalises to the same canonical id, which is what comes back in the response.

Standard parameters

array
required
The conversation so far. Each message has a role of system, user, assistant or tool, and content.
boolean
default:"false"
Stream partial deltas as server-sent events. See Streaming.
integer
Upper bound on generated tokens. Output bills at several times input on most models, so this is the highest-leverage cost control you have before any routing decision.
number
default:"1"
Sampling temperature between 0 and 2. Lower is more deterministic.
number
default:"1"
Nucleus sampling. Set this or temperature, not both.
string | array
Up to four sequences that halt generation.
object
Set {"type": "json_object"} to constrain output to valid JSON. Schema-shaped output is usually cheaper and more reliably scored than free text, which is why it often clears an eval on a smaller model.
array
Tool definitions the model may call, in OpenAI function-calling format.
string | object
auto, none, required, or a specific tool.
integer
Best-effort determinism for repeated identical requests.
string
Stable end-user or tenant identifier. Use this to separate tenants within one task rather than encoding the tenant into the task name.
object
Up to 16 string key-value pairs echoed back on the response. Useful for carrying your own request or trace IDs.

Request

Response

string
Unique identifier for the completion.
string
Always chat.completion.
string
The model that actually served the call. With model: "deepseek-v4-flash" this is the resolved route, not the string you sent.
array
object
prompt_tokens, completion_tokens and total_tokens.

Response headers

Log the first two. Seeing default and main when you expected otherwise means the header was dropped or task was stripped by your SDK.
Response

Streaming

Set stream: true to receive chat.completion.chunk events as server-sent events, terminated by data: [DONE].
Scope and rate-limit headers arrive with the response head, before the first chunk.

Errors

Status codes, error shapes, and which are worth retrying.