v1

latestOpenAPI 3.1.02026-07-2219165126.1 KB
Chat Completions

Create a chat completion

Generate an OpenAI-compatible chat completion from conversation messages. Supports streaming, multimodal content, structured outputs, and tool calling.

post/v1/chat/completions

Request body

modelstring required

Model identifier to route the request to.

temperaturenumber nullable
top_pnumber nullable
streamboolean nullable
max_completion_tokensinteger nullable
reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'
presence_penaltynumber nullable
frequency_penaltynumber nullable
logit_biasobject
parallel_tool_callsboolean
web_search_optionsobject

Example request

{
  "messages": [
    {
      "content": "You are a concise assistant.",
      "role": "system"
    },
    {
      "content": "Summarize vector databases in 2 sentences.",
      "role": "user"
    }
  ],
  "model": "gpt-4o-mini",
  "temperature": 0.3
}

Response

JSON response when stream=false, or Server-Sent Events when stream=true.

idstring required
object'chat.completion'
createdinteger required
modelstring required

Example response

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Tokyo is Japan's capital and one of the world's largest metropolitan areas. It blends dense modern districts with historic neighborhoods, food, and culture.",
        "role": "assistant"
      }
    }
  ],
  "created": 1743393600,
  "id": "chatcmpl_123",
  "model": "gpt-4o-mini",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 30,
    "completion_tokens_details": {
      "image_tokens": 0
    },
    "prompt_tokens": 15,
    "total_tokens": 45
  }
}