Chat completions
OpenAI-compatible chat completions, with streaming, images, tool calling and reasoning control.
POST /v1/chat/completions
curl https://api.unquant.io/v1/chat/completions \
-H "Authorization: Bearer $UNQUANT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3-flash",
"messages":[{"role":"user","content":"Hello!"}]}'Request fields
modelstringRequiredglm-5.3-flash or qwen-3.8-flash-next.
messagesarrayRequiredRoles system, user, assistant and tool. Content is a string or an array of text and image_url parts.
streambooleanStream the reply as server-sent events.
stream_optionsobject{"include_usage": true} adds a final chunk with token counts.
max_tokensintegerUpper bound on the reply length.
max_completion_tokensintegerSame as max_tokens.
temperaturenumberRandomness of sampling.
top_pnumberNucleus sampling.
top_kintegerSample from the k most likely tokens.
min_pnumberMinimum relative probability for a token.
seedintegerSeed for repeatable sampling.
stopstring or arrayStop sequences.
frequency_penaltynumberPenalise tokens by how often they appeared.
presence_penaltynumberPenalise tokens that appeared at all.
repetition_penaltynumberMultiplicative repetition penalty.
toolsarrayFunctions the model may call, in the OpenAI format.
tool_choicestring or objectauto, none, required or a named function.
parallel_tool_callsbooleanAllow several tool calls in one turn.
response_formatobjectJSON output.
logprobsbooleanReturn token log probabilities.
top_logprobsintegerHow many alternatives to return per token.
nintegerMust be 1: one completion per request.
reasoning_effortstringBoth models: none, low or high; GLM-5.3-Flash also takes max.
chat_template_kwargsobjectTemplate switches, such as {"enable_thinking": false}.
Other fields are ignored.
Response
response.choices[0].message.contentUsage counts are returned for your own monitoring; they are never billed.
Streaming
With "stream": true the reply arrives as server-sent events in the OpenAI chunk format, ending with data: [DONE]. Read the text from choices[0].delta.content.
Images
Both models accept images as image_url parts holding a base64 data URL (data:image/png;base64,..., JPEG or WebP). Image links by URL are not fetched and return 400.
{"role": "user", "content": [
{"type": "text", "text": "Describe this image."},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQ..."}}
]}Tool calling
Pass tools as in the OpenAI API. When the model calls a tool, the reply has finish_reason: "tool_calls" and message.tool_calls; run the tool, append a tool message with its result and the matching tool_call_id, and call again.
Reasoning
Both models reason before answering, and both take reasoning_effort: none for direct answers, low for light reasoning or high for harder problems; GLM-5.3-Flash also has max and defaults to high. The thinking is returned separately in reasoning_content, never mixed into content. "thinking": {"type": "disabled"} and "chat_template_kwargs": {"enable_thinking": false} also turn it off.
Concurrency
Your plan sets how many requests can run at once across all your keys. A request beyond that limit returns 429 straight away and is not queued; running requests are unaffected.