View as Markdown

Chat completions

text
POST https://api.continuumlabs.ai/v1/chat/completions

Send a conversation and get the model's next message. This is the same format as OpenAI's chat completions endpoint.

Request

bash
curl https://api.continuumlabs.ai/v1/chat/completions \
  -H "Authorization: Bearer cl-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [
      {"role": "system", "content": "You are a careful assistant. Use Australian English."},
      {"role": "user", "content": "Summarise the Notifiable Data Breaches scheme in two sentences."}
    ],
    "temperature": 0.2,
    "max_tokens": 300
  }'

Parameters

ParameterTypeWhat it does
modelstring, requiredWhich model to use. See models.
messagesarray, requiredThe conversation so far. Each message has a role (system, user, assistant or tool) and content.
temperaturenumberRandomness, from 0 to 2. Use 0 to 0.3 for extraction and analysis, higher for drafting.
max_tokensintegerThe most tokens the model may write in its reply. Defaults to 4,096, up to 32,768. Also sets the most a request can cost, which is set aside from your credit until it finishes.
top_pnumberAn alternative to temperature. Change one or the other, not both.
stopstring or arrayText that ends the reply when the model writes it.
streambooleanSend the reply as it is written. See streaming.
toolsarrayFunctions the model may call. See tool calling.
tool_choicestring or objectauto, none, required, or a specific function.
response_formatobject{"type": "json_object"} for JSON. See JSON output.

Other OpenAI parameters are passed to the model unchanged. Whether a model honours them depends on the model.

Response

json
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "glm-5.2",
  "choices": [
    {
      "index": 0,
      "message": {"role": "assistant", "content": "The scheme requires..."},
      "finish_reason": "stop"
    }
  ],
  "usage": {"prompt_tokens": 41, "completion_tokens": 58, "total_tokens": 99}
}
FieldWhat it means
choices[0].message.contentThe model's reply.
choices[0].message.tool_callsFunctions the model wants to call, if you sent tools.
choices[0].finish_reasonstop when the model finished, length when it hit max_tokens, tool_calls when it wants to call a function.
usageTokens used. This is what your account is charged for.

Some models reason before they answer and return their working in message.reasoning_content. Those reasoning tokens are counted in completion_tokens.

Limits

  • A request can be up to 4 MB.
  • The whole conversation, plus the reply, must fit in the model's context. See models.
  • Requests that run longer than five minutes are stopped. Use streaming for long replies.

Response headers

HeaderWhat it means
x-continuum-regionThe region the gateway ran in for this request, as reported by our host, for example syd1 for Sydney.