ChatCompletionsFormat
POST /v1/chat/completions
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model ID |
messages | array<object> | Required | Conversation message list |
messages[].role | string | Required | Message role |
messages[].content | string | array<object> | Required | Message content |
messages[].name | string | Optional | Sender name |
messages[].tool_calls | array<object> | Optional | - |
messages[].tool_calls[].id | string | Optional | - |
messages[].tool_calls[].type | string | Optional | - |
messages[].tool_calls[].function | object | Optional | - |
messages[].tool_call_id | string | Optional | Tool call ID (for tool role messages) |
messages[].reasoning_content | string | Optional | Reasoning content |
temperature | number | Optional | Sampling temperature |
top_p | number | Optional | Top-p sampling parameter |
n | integer | Optional | Number of completions to generate |
stream | boolean | Optional | Whether to stream the response |
stream_options | object | Optional | - |
stream_options.include_usage | boolean | Optional | - |
stop | string | array<string> | Optional | Stop sequences |
max_tokens | integer | Optional | Maximum tokens to generate |
max_completion_tokens | integer | Optional | Maximum completion tokens |
presence_penalty | number | Optional | - |
frequency_penalty | number | Optional | - |
logit_bias | object | Optional | - |
user | string | Optional | - |
tools | array<object> | Optional | - |
tools[].type | string | Optional | - |
tools[].function | object | Optional | - |
tools[].function.name | string | Optional | - |
tools[].function.description | string | Optional | - |
tools[].function.parameters | object | Optional | Parameter definitions in JSON Schema format |
tool_choice | string | object | Optional | - |
response_format | object | Optional | - |
response_format.type | string | Optional | - |
response_format.json_schema | object | Optional | JSON Schema definition |
seed | integer | Optional | - |
reasoning_effort | string | Optional | Reasoning effort (for models that support reasoning) |
modalities | array<string> | Optional | - |
audio | object | Optional | - |
audio.voice | string | Optional | - |
audio.format | string | Optional | - |
Request Example
{
"body": {
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "string"
}
]
}
}
Response Fields(200)
| Field Name | Type | Description |
|---|---|---|
model | string | p p-0 Model ID |
messages | array<object> | p p-0 Conversation message list |
messages[].role | string | p p-0 Message role |
messages[].content | string | array<object> | p p-0 Message content |
messages[].name | string | p p-0 Sender name |
messages[].tool_calls | array<object> | - |
messages[].tool_calls[].id | string | - |
messages[].tool_calls[].type | string | - |
messages[].tool_calls[].function | object | - |
messages[].tool_call_id | string | p p-0 Tool call ID (for tool role messages) |
messages[].reasoning_content | string | p p-0 Reasoning content |
temperature | number | p p-0 Sampling temperature |
top_p | number | p p-0 Top-p sampling parameter |
n | integer | p p-0 Number of completions to generate |
stream | boolean | p p-0 Whether to stream the response |
stream_options | object | - |
stream_options.include_usage | boolean | - |
stop | string | array<string> | p p-0 Stop sequences |
max_tokens | integer | p p-0 Maximum tokens to generate |
max_completion_tokens | integer | p p-0 Maximum completion tokens |
presence_penalty | number | - |
frequency_penalty | number | - |
logit_bias | object | - |
logit_bias.[key: string] | number | - |
user | string | - |
tools | array<object> | - |
tools[].type | string | - |
tools[].function | object | - |
tools[].function.name | string | - |
tools[].function.description | string | - |
tools[].function.parameters | object | p p-0 Parameter definitions in JSON Schema format |
tool_choice | string | object | - |
response_format | object | - |
response_format.type | string | - |
response_format.json_schema | object | p p-0 JSON Schema definition |
seed | integer | - |
reasoning_effort | string | p p-0 Reasoning effort (for models that support reasoning) |
modalities | array<string> | - |
audio | object | - |
audio.voice | string | - |
audio.format | string | - |