POST /chat/completions
The main chat endpoint, OpenAI protocol — streaming, tool calls and structured output.
On this page
POST https://api.apione.ai/v1/chat/completionsRequest parameters
messagesobject[]requiredConversation history. Each item has role (system / user / assistant / tool) and content.
streambooleanDefaults to false. true returns SSE.
max_tokensintegerMaximum tokens in this reply, capped by the model.
temperaturenumber0–2, default 1. Tune this or top_p, not both.
top_pnumber0–1 nucleus sampling threshold.
stopstring | string[]Up to four stop sequences; generation ends on a match.
toolsobject[]Callable function definitions in OpenAI format. Requires a model with function calling.
tool_choice"auto" | "none" | objectWhether — and which — tool to call.
response_formatobject{"type":"json_object"}, or a json_schema constraint.
seedintegerBest-effort reproducible sampling; not a guarantee.
userstringYour own end-user identifier, logged to help investigate abuse.
Example request
{
"model": "claude-sonnet-4-6",
"messages": [
{ "role": "system", "content": "Answer with JSON only." },
{ "role": "user", "content": "Classify the sentiment: today was productive" }
],
"temperature": 0,
"max_tokens": 200,
"response_format": { "type": "json_object" }
}Response
idstringThis completion's id. When troubleshooting, quote the X-Maxx-Request-ID response header instead.
modelstringThe model that actually answered.
choices[].messageobjectThe reply: role, content, plus tool_calls when tools are used.
choices[].finish_reasonstringstop / length / tool_calls / content_filter.
usageobjectprompt_tokens, completion_tokens, total_tokens, plus prompt_tokens_details.cached_tokens on cache hits.
{
"id": "chatcmpl-01J8ZQ7K3M",
"object": "chat.completion",
"created": 1771286400,
"model": "claude-sonnet-4-6",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "{\"sentiment\":\"positive\"}" },
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 38, "completion_tokens": 9, "total_tokens": 47 }
}Streaming
With stream: true the response is text/event-stream; chunk structure is documented in Streaming.
Contact us
Something unclear, or need a human? Pick the channel that fits your question.
Supportsupport@apione.ai
WeCom
Telegram
Communityhttps://t.me/apione
Support tickets
Billing & accountConsole › Feedback