Streaming
Set stream: true and the response arrives as standard server-sent events, exactly as OpenAI clients expect.
Request
curl -N https://api.openmayhem.ai/v1/chat/completions \
-H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "hauhaucs/qwen3.6-35b-a3b-uncensored",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 2000,
"stream": true,
"stream_options": {"include_usage": true}
}'The usage chunk
With stream_options.include_usage set, one extra chunk arrives after the last delta and before [DONE], carrying token counts for the whole response:
event stream (abridged)
data: {"choices":[{"delta":{"content":"Hello!"}}], ...}
data: {"choices":[{"delta":{},"finish_reason":"stop"}], ...}
data: {"choices":[],"usage":{"prompt_tokens":10,"completion_tokens":42,
"total_tokens":52,"completion_tokens_details":{"reasoning_tokens":30}}}
data: [DONE]Without the option the stream is byte-for-byte OpenAI-shaped and the usage chunk is omitted.
Disconnecting mid-stream
Closing the connection aborts generation upstream so you stop paying for tokens nobody will receive. Work the provider already completed is still billed, settled later from its receipt; the final amount appears on the usage page once reconciled.