Accepted and ignored: a server runs the model selected at startup.
Appearance
Appearance
Text models expose an OpenAI-compatible chat completions endpoint. The server runs one selected model per process. Vision-capable text models also accept image content parts.
Health, model metadata and the error format are shared by all modalities; see the API overview.
POST /v1/chat/completionsself serve qwen3.5:9bPOST /v1/chat/completions modelstringoptionalAccepted and ignored: a server runs the model selected at startup.
messagesarrayrequiredMessages in conversation order. Each item has role and content. role is system, developer, user, or assistant; developer is treated as system. Tool and function roles are unsupported.
content is a string or an array of text parts. Vision models also accept user-only image_url parts with an HTTPS URL or image data URL.
max_tokensintegeroptionalMaximum generated tokens. Must be at least 1. max_completion_tokens takes precedence when both are present.
max_completion_tokensintegeroptionalAlias for max_tokens; must be at least 1.
temperaturenumberoptionalSampling temperature from 0 through 2.
top_pnumberoptionalNucleus sampling value from 0 through 1.
nintegeroptionalOnly 1 is supported.
streambooleanoptionalDefaults to false. With true, the response is server-sent events ending in data: [DONE].
stream_optionsobjectoptionalOnly valid with stream: true. include_usage: true adds a final usage-only chunk. include_obfuscation is accepted but has no effect.
stopstring | array of stringsoptionalOne stop sequence or up to four sequences. Empty sequences are ignored.
presence_penaltynumberoptionalSampling penalty from -2 through 2.
frequency_penaltynumberoptionalSampling penalty from -2 through 2.
seedintegeroptionalSeed passed to the runtime when supported by the loaded engine.
response_formatobjectoptionaltype is text, json_object, or json_schema. For json_schema, provide json_schema.schema as a JSON schema object. name, description, and strict are accepted inside json_schema.
reasoning_effortstringoptionalnone disables reasoning. minimal, low, medium, high, and xhigh enable it.
chat_template_kwargsobjectoptionalOnly enable_thinking: true|false is supported.
user, store, metadata, service_tier, prompt_cache_key, prompt_cache_retention, safety_identifier, parallel_tool_callsanyoptionalAccepted for client compatibility and ignored. Tool calling, logprobs, audio, prediction, web search, and non-text modalities return 422 unsupported_capability when non-empty. tool_choice: "auto" is accepted but does not enable tools.
curl http://localhost:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "text-model",
"messages": [
{"role": "system", "content": "Answer briefly."},
{"role": "user", "content": "Explain embeddings in one sentence."}
],
"max_tokens": 64,
"reasoning_effort": "none"
}'import requests
response = requests.post(
"http://localhost:8080/v1/chat/completions",
json={
"model": "text-model",
"messages": [
{"role": "user", "content": "Explain embeddings in one sentence."}
],
"max_tokens": 64,
"reasoning_effort": "none",
},
timeout=60,
)
response.raise_for_status()
print(response.json())const response = await fetch('http://localhost:8080/v1/chat/completions', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
model: 'text-model',
messages: [{ role: 'user', content: 'Explain embeddings in one sentence.' }],
max_tokens: 64,
reasoning_effort: 'none'
})
})
if (!response.ok) throw new Error(await response.text())
console.log(await response.json()){
"id": "chatcmpl-7f3d...",
"object": "chat.completion",
"created": 1760000000,
"model": "text-model",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Embeddings are numeric vectors that represent meaning."},
"finish_reason": "stop",
"logprobs": null
}],
"usage": {"prompt_tokens": 18, "completion_tokens": 10, "total_tokens": 28}
}idstringUnique completion ID beginning with chatcmpl-.
objectstringAlways chat.completion for a non-streaming response.
createdintegerUnix timestamp in seconds.
modelstringID of the loaded model.
choicesarrayOne choice with index: 0, message, finish_reason (stop or length), and logprobs: null.
choices[0].messageobjectrole is assistant, content is generated text, and reasoning-capable models may include separate reasoning_content.
usageobjectprompt_tokens, completion_tokens, and total_tokens are integer token counts. total_tokens is their sum.
curl -N http://localhost:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages":[{"role":"user","content":"Count to three."}],"stream":true,"stream_options":{"include_usage":true}}'import requests
with requests.post(
"http://localhost:8080/v1/chat/completions",
json={"messages": [{"role": "user", "content": "Count to three."}], "stream": True},
stream=True,
timeout=60,
) as response:
response.raise_for_status()
for line in response.iter_lines(decode_unicode=True):
if line:
print(line)const response = await fetch('http://localhost:8080/v1/chat/completions', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
messages: [{ role: 'user', content: 'Count to three.' }],
stream: true
})
})
if (!response.ok) throw new Error(await response.text())
console.log(await response.text())Each event is a chat.completion.chunk. Deltas contain content or reasoning_content; the final chunk contains finish_reason, followed by data: [DONE]. include_usage adds a final usage-only chunk.
Vision models accept an image in a user message as an HTTPS URL or a supported data URL. Check /v1/model for capabilities.input and max_images.
typestringrequiredMust be image_url.
image_url.urlstringrequiredHTTPS URL or a JPEG, PNG, or WebP data URL.
curl http://localhost:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "vision-model",
"messages": [{"role": "user", "content": [
{"type": "text", "text": "What color is the car?"},
{"type": "image_url", "image_url": {"url": "https://example.com/car.jpg"}}
]}],
"max_tokens": 32,
"temperature": 0
}'{
"object": "chat.completion",
"model": "vision-model",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "Red."}, "finish_reason": "stop", "logprobs": null}],
"usage": {"prompt_tokens": 120, "completion_tokens": 2, "total_tokens": 122}
}Besides the shared errors, text requests return 400 invalid_request for malformed fields, 413 request_too_large for bodies over 32 MiB, 422 unsupported_capability for unsupported features, 429 queue_full, and runtime 503 or 504 errors. A streaming error after the first event is written in-band as an error object.