POST/v1/chat/completions

/v1/chat/completions

Use this endpoint with any OpenAI SDK client. The request body follows OpenAI's chat completions schema unchanged. The model field must be a value returned by GET /v1/models.

Request#

Replace MODEL_ID with a model id from GET /v1/models.

Try in Studio
curl https://api.atptoken.ai/v1/chat/completions \
  -H "Authorization: Bearer $ATP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "messages": [{"role": "user", "content": "hi"}]
  }'

Parameters#

FieldTypeDescription
modelstring · requiredA model id from GET /v1/models.
messagesarray · requiredChat messages, each { role, content }.
max_tokensintegerMax output tokens. Reasoning models spend their thinking inside this budget — set it too low and you get a 200 with empty content (see Errors).
temperaturenumberSampling temperature, 0–2.
streambooleanStream the response as SSE chunks.
toolsarrayTool/function definitions (OpenAI tool schema).

Response#

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "<model>",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}
Was this page helpful?