Skip to content
Home

Chat Completions

POST {BASE_URL}/v1/chat/completions

This endpoint uses an OpenAI-compatible request body. Common fields include model, messages, temperature, max_tokens, and stream.

Terminal window
curl -sS "${BASE_URL}/v1/chat/completions" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are a concise technical assistant."
},
{
"role": "user",
"content": "Explain asynchronous billing."
}
],
"temperature": 0.3,
"max_tokens": 512
}'
{
"id": "chatcmpl_xxx",
"object": "chat.completion",
"created": 1770000000,
"model": "gpt-4.1",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Asynchronous billing means..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 42,
"total_tokens": 66
}
}