Streaming

Set stream: true to receive Server-Sent Events, same shape as OpenAI.

Request

Terminal
curl -N https://api.llmstudio.dev/v1/chat/completions \
  -H "Authorization: Bearer $LLM_STUDIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "studio/qwen3-0.6b", "messages": [{"role":"user","content":"count to 3"}], "stream": true}'

Response

Each event is a `chat.completion.chunk`. The stream ends with a literal `data: [DONE]` line.

Terminal
data: {"id":"chatcmpl_...","object":"chat.completion.chunk","created":1735689600,"model":"studio/qwen3-0.6b","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]}

data: {"id":"chatcmpl_...","object":"chat.completion.chunk","created":1735689600,"model":"studio/qwen3-0.6b","choices":[{"index":0,"delta":{"content":", 2, 3"},"finish_reason":null}]}

data: {"id":"chatcmpl_...","object":"chat.completion.chunk","created":1735689600,"model":"studio/qwen3-0.6b","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":12,"completion_tokens":6,"total_tokens":18}}

data: [DONE]

Stopping generation

There's no separate cancel endpoint -- close the HTTP connection (abort the fetch) and the server stops the upstream generation too, whether it's a hosted worker or a BYOK provider call.