POST /v1/chat/completions is the OpenAI Chat Completions API, with the same request and response shapes.
| Field | Notes |
|---|---|
model | required, public id |
messages | system, user, assistant, tool |
stream | true for Server-Sent Events |
max_tokens / max_completion_tokens / max_output_tokens | any of the three |
temperature, top_p, seed, stop | forwarded when the model supports them |
tools, tool_choice, parallel_tool_calls | see Tools |
response_format | {"type":"json_object"} or a JSON schema |
reasoning_effort | low, medium, high on reasoning models |
stream_options.include_usage | adds a final chunk with usage |
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.