Skip to content

Chat Completions

The primary inference endpoint is Chat Completions, served at POST /api/v1/chat/completions. It follows the OpenAI Chat Completions wire format, so OpenAI SDKs and most OpenAI-compatible tooling work unchanged.

Field Type Notes
model string A model ID from the catalog.
messages array Conversation so far (role + content).
stream boolean Set true for server-sent token streaming.
temperature number Sampling temperature.
max_tokens integer Cap on generated tokens.
{
"model": "zai/glm-5.2",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Explain sovereign AI in one sentence." }
]
}

A standard chat.completion object; the reply is in choices[0].message.content, with token counts under usage.

Chat completions is the most used endpoint, but not the only one. The same API key and base URL also serve:

Endpoint Purpose
POST /embeddings Vector embeddings.
POST /rerank Reranking, Cohere-style (query + documents).
POST /reranking Reranking, NVIDIA NIM-style (query.text + passages).
POST /images/generations Image generation.
POST /audio/transcriptions Speech to text.
POST /audio/translations Speech to English text.
POST /completions Legacy (non-chat) text completion.
GET /models List the models available to you.

Which rerank endpoint to use is determined by the model, not by preference — each reranker supports one of the two schemas. See the API reference for the full schema of every endpoint.