Bearer Auth (In: header)Authorization: Bearer <YOUR_API_KEY>Bearer <YOUR_API_KEY>. Format: Authorization: Bearer sk-xxxxxx.| Field | Type | Range | Description |
|---|---|---|---|
id | string | - | The current chat task id. |
object | string | - | The type of object returned by the API. In this case it is always task. |
status | string | pending processing success failed | Current status of the task. |
created_at | number | - | Unix timestamp (in seconds) indicating when the task was created. |
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | ✅ | - | The model ID to use for this request. |
messages | array<object> | ✅ | - | An array of message objects representing the conversation history. See Messages Structure. |
max_tokens | integer | ✅ | 4096 | The maximum number of tokens the model can generate in the response. Range 1-32000 |
async | boolean | - | false | Whether to return an asynchronous response. Only supported for non-streaming requests. |
stream | boolean | - | false | If true, returns a stream of server-sent events (SSE) as the response is generated. |
system | string | array<object> | - | - | System prompt that sets the behavior and context for the assistant. |
temperature | number | - | 1.0 | Controls the randomness of the output. Lower values produce more focused responses, higher values produce more creative outputs. Range 0.0-1.0 |
top_p | number | - | 1.0 | Nucleus sampling parameter. The model considers tokens with top_p cumulative probability mass. Range 0.0-1.0 |
top_k | integer | - | - | Limits token selection to the K most probable tokens at each step. |
stop_sequences | array<string> | - | - | An array of strings that will stop generation when encountered. |
| Field | Type | Required | Description |
|---|---|---|---|
role | string | ✅ | The role of the message. Can be: user or assistant |
content | string | array<object> | ✅ | The content of the message. Can be a simple string for text-only messages, or an array of content blocks for multimodal content. |
>content.type | string | ✅ | The type of the content block. Detail see Content.Type |
>content.text | string | ✅ if type=text | The text content of the message. |
>content.source | object | ✅ if type not text | The source of the document or image. see Multimodal input |
>>content.source.type | string | ✅ | The source type. Supported values: base64, url |
>>content.source.media_type | string | ✅ if source.type=base64 | MIME type of the file. Supported values: application/pdf, text/plain, text/markdown, text/csv, image/png, image/jpeg, image/gif, image/webp |
>>content.source.data | string | ✅ if source.type=base64 | The base64-encoded file data. |
>>content.source.url | string | ✅ if source.type=url | The URL of the file to analyze. |
| Field | Description |
|---|---|
text | Plain text content for the user message or assistant response. Use with the text field. |
image | Image content provided via source. Supports base64-encoded data or a URL. |
document | Document file provided via source. Use for processing PDF, plain text, Markdown, or CSV files. Supports base64-encoded data or a URL. |
file | General file content provided via source. Automatically determines handling based on the media_type. Supports base64-encoded data or a URL. |
file_data | Inline file data using base64 encoding. Provide the file content directly via data and media_type fields without a source wrapper. |