ApiX Docs
Docs / Chat Completions
·View as Markdown

Chat Completions

POST /v1/chat/completions is the OpenAI Chat Completions API, with the same request and response shapes.

FieldNotes
modelrequired, public id
messagessystem, user, assistant, tool
streamtrue for Server-Sent Events
max_tokens / max_completion_tokens / max_output_tokensany of the three
temperature, top_p, seed, stopforwarded when the model supports them
tools, tool_choice, parallel_tool_callssee Tools
response_format{"type":"json_object"} or a JSON schema
reasoning_effortlow, medium, high on reasoning models
stream_options.include_usageadds a final chunk with usage
bash
curl "$APIX_BASE/v1/chat/completions" \
  -H "Authorization: Bearer $APIX_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "4/glm-5.3-flash",
    "messages": [
      {"role": "system", "content": "Answer in one sentence."},
      {"role": "user", "content": "What is a gateway?"}
    ],
    "max_tokens": 200
  }'

A JSON reply carries x-apix-input-tokens, x-apix-output-tokens, x-apix-total-tokens and x-apix-spend-usd. In streaming those headers cannot be sent (usage is known at the end): read the final : apix {...} comment instead.

If a model does not support a parameter the provider may reject it with 400. The catalog lists what each model accepts in supported_parameters.