Chat Completion
Create a synchronous or streaming chat completion.
Body
modelstringRequired
max_tokensintegerOptional
max_completion_tokensintegerOptional
temperaturenumber · max: 2Optional
top_pnumber · max: 1Optional
ninteger · min: 1Optional
streambooleanOptional
stopany ofOptional
stringOptional
string[]Optional
nullOptional
presence_penaltynumber · min: -2 · max: 2Optional
frequency_penaltynumber · min: -2 · max: 2Optional
seedintegerOptional
tool_choiceany ofOptional
string · enumOptionalPossible values:
or
nullOptional
logprobsbooleanOptional
top_logprobsinteger · max: 20Optional
reasoning_effortstring · enumOptionalPossible values:
Responses
200
Successful Response
application/json
400
Invalid Format
application/json
401
Authentication Fails
application/json
402
Insufficient Balance
application/json
422
Invalid Parameters
application/json
429
Rate Limit Reached
application/json
500
Server Error
application/json
503
Server Overloaded
application/json
post
POST /api/v1/chat/completions HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 800
{
"model": "text",
"messages": [
{
"role": "system",
"content": "text",
"name": "text",
"tool_calls": [
{
"id": "text",
"type": "function",
"function": {
"name": "text",
"arguments": "text"
}
}
],
"tool_call_id": "text"
}
],
"max_tokens": 1,
"max_completion_tokens": 1,
"temperature": 1,
"top_p": 1,
"n": 1,
"stream": true,
"stop": "text",
"presence_penalty": 1,
"frequency_penalty": 1,
"logit_bias": {
"ANY_ADDITIONAL_PROPERTY": 1
},
"seed": 1,
"tools": [
{
"type": "function",
"function": {
"name": "text",
"description": "text",
"parameters": {
"type": "object",
"properties": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"required": [
"text"
]
}
}
}
],
"tool_choice": "none",
"response_format": {
"type": "text",
"json_schema": {
"name": "text",
"description": "text",
"schema": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"strict": true
}
},
"logprobs": true,
"top_logprobs": 1,
"reasoning_effort": "minimal"
}
{
"id": "text",
"object": "chat.completion",
"created": 1,
"model": "text",
"choices": [
{
"index": 1,
"message": {
"role": "system",
"content": "text",
"name": "text",
"tool_calls": [
{
"id": "text",
"type": "function",
"function": {
"name": "text",
"arguments": "text"
}
}
],
"tool_call_id": "text"
},
"finish_reason": "text"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"system_fingerprint": "text"
}
Last updated