Docs/Getting started

Your first API call

Break down a chat completion to understand request fields, response shape and common mistakes. No live call is made.

On this page

The minimal request

A working request needs only two fields: model and messages.

json
{
  "model": "claude-sonnet-4-6",
  "messages": [
    { "role": "system", "content": "You are a concise technical assistant." },
    { "role": "user", "content": "What is the APIONE base_url?" }
  ]
}

The three message roles

systemstring

Sets behaviour and tone; put it first. Some vendors expect a separate field — the gateway converts it for you.

userstring | array

User input. Multimodal models accept an array mixing text and images.

assistantstring

The model's previous reply. Send history back verbatim — the server keeps no session.

Important

The API is stateless. Multi-turn conversations require you to resend the full messages array each time; longer context means more input tokens and higher cost.

Common optional parameters

ParameterTypeDefaultNotes
temperaturenumber10–2; lower is more deterministic. Use 0 for extraction.
max_tokensintegermodel maxCaps this reply — a safety net against runaway output.
streambooleanfalseSwitches to SSE streaming; see Streaming.
toolsarray—Function-calling definitions, OpenAI format.
response_formatobject—Constrain output to JSON or a schema.

Response shape

json
{
  "id": "chatcmpl-01J8ZQ7K3M",
  "object": "chat.completion",
  "created": 1771286400,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "https://api.apione.ai/v1" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 42, "completion_tokens": 12, "total_tokens": 54 }
}
  • id — identifies this completion. For support, the X-Maxx-Request-ID response header is more useful: search it in console › Usage › Request log to find the call.
  • finish_reason — stop completed, length hit max_tokens, tool_calls needs you to run a tool and send results back.
  • usage — the billing basis; cached input appears under prompt_tokens_details.

Four common mistakes

SymptomCauseFix
401 invalid API tokenWhitespace or newline copied with the keyRe-copy, or inject via environment variable
404 not_foundbase_url missing /v1Use https://api.apione.ai/v1
400 model_not_supportedModel ID misspelled or copied from elsewhereCheck the IDs from GET /v1/models
Truncated replymax_tokens too smallRaise it, and check finish_reason

Next

Contact us

Something unclear, or need a human? Pick the channel that fits your question.