Create a chat completion
Create a chat completion
POST/api/v1/chat/completions
OpenAI-compatible Chat Completions. Supports streaming, function tools, structured output, and image and file input.
Body ParametersJSON
max_tokens: optional number
Do not send together with max_completion_tokens.
minimum1
maximum2147483647
max_completion_tokens: optional number
Output token limit, reasoning included. Do not send together with max_tokens.
minimum1
maximum2147483647
metadata: optional map[string]
Up to 16 string pairs (keys up to 64 characters). Kept with a stored completion; never sent to the model provider.
Create a chat completion
curl https://api.prod.adaptionlabs.ai/api/v1/chat/completions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ADAPTION_API_KEY" \
-d '{
"model": "glm-5.2",
"messages": [
{
"role": "system",
"content": "string"
}
]
}'{
"id": "id",
"object": "chat.completion",
"created": 0,
"model": "model",
"system_fingerprint": "system_fingerprint",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "content",
"refusal": "refusal",
"reasoning_content": "reasoning_content",
"tool_calls": [
{
"id": "id",
"type": "function",
"function": {
"name": "name",
"arguments": "arguments"
}
}
]
}
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}
}Returns Examples
{
"id": "id",
"object": "chat.completion",
"created": 0,
"model": "model",
"system_fingerprint": "system_fingerprint",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "content",
"refusal": "refusal",
"reasoning_content": "reasoning_content",
"tool_calls": [
{
"id": "id",
"type": "function",
"function": {
"name": "name",
"arguments": "arguments"
}
}
]
}
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}
}