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 or deepseek-v4.1-flash-1017.
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_effortstringEvery model: low or high; GLM-5.3-Flash and DeepSeek V4.1 Flash 1017 also take max. Qwen 3.8 Flash Next and DeepSeek V4.1 Flash 1017 also take none (thinking off); GLM-5.3-Flash always thinks and refuses it.
chat_template_kwargsobjectTemplate switches, such as {"enable_thinking": false} (Qwen 3.8 Flash Next and DeepSeek V4.1 Flash 1017; GLM-5.3-Flash always thinks).
prompt_cache_keystringOne stable value per conversation keeps its turns on the server that holds its cached prompt. Without it, a conversation is recognised by its system prompt and first message, so set it if your system prompt changes between turns.
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
Every model accepts 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
Every model reasons before answering and takes reasoning_effort: low for light reasoning or high for harder problems; GLM-5.3-Flash and DeepSeek V4.1 Flash 1017 also have max and default to high. The thinking is returned separately in reasoning_content, never mixed into content.
GLM-5.3-Flash always thinks: its reasoning cannot be turned off, and a request that asks for that is refused with a 400 error. Qwen 3.8 Flash Next and DeepSeek V4.1 Flash 1017 can also answer directly: send none, or "thinking": {"type": "disabled"} or "chat_template_kwargs": {"enable_thinking": false}.
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.