Endpoint
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model to use: pro, fast, or default. |
messages | array | Yes | A list of message objects representing the conversation. |
stream | boolean | No | If true, tokens will be sent as data-only server-sent events. Default: false. |
temperature | number | No | Sampling temperature between 0 and 2. Default: 1. |
max_tokens | integer | No | The maximum number of tokens to generate in the completion. |
response_format | object | No | Set to { "type": "json_object" } to enable JSON mode. |
Message Format
Each message object consists of arole and content.
| Role | Description |
|---|---|
system | Sets the behavior or persona of the assistant. |
user | The input message from the end user. |
assistant | Previous responses from the model used for context. |
Example Message Array
Streaming Responses
For low-latency applications, enable streaming to receive tokens as they are generated.Python