docs / api / chat-completions

POST /v1/chat/completions

OpenAI-compatible chat. Accepts the standard request schema, returns the standard response shape, adds `model` field showing which one it routed to.

POST/api/v1/chat/completions

Standard OpenAI-compatible completions with smart routing.

Parameters

NameTypeRequiredDescription
messagesarrayyesOpenAI-format message list
modelstringnoauto to let Soriku route, or a specific model id
streambooleannoStream tokens via SSE
temperaturenumbernoSampling temperature
max_tokensintegernoCap on response length
x_agent_idstringnoAttach an agent persona for this request

Example

curl -X POST http://localhost:8765/api/v1/chat/completions \
-H "Authorization: Bearer soriku-local" \
-H "Content-Type: application/json" \
-d '{"model":"auto","messages":[{"role":"user","content":"Hello"}]}'

Response

{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "qwen2.5-coder:7b",
"choices": [{
"message": {"role": "assistant", "content": "..."},
"finish_reason": "stop"
}]
}