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, worker:<id> (for example worker:sora) to address a Worker, 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"
}]
}

Workers and response headers

Address a Worker as a model: worker:sora, worker:tomo, or the URL-safe name of a Worker you made yourself. The Worker's instructions and data zone apply to the request. A Worker that does not exist or is switched off gives a 404 model_not_found. GET /api/v1/models lists the Workers you can use.

Every response carries X-Soriku-Model (the model that answered), X-Soriku-Decision, X-Soriku-Worker (the Worker, or none) and X-Soriku-Route: local on your own hardware, eu at an EU-hosted provider, keys at another provider through API keys. Send X-Soriku-Zone: local, eu or any to tighten the data zone for one request. It can never loosen it.