Skip to main content
Set "stream": true to receive the reply as the model writes it. Morse answers with Content-Type: text/event-stream. Each event is a line data: <json> with one chat.completion.chunk, and the stream ends with data: [DONE].
The -N flag stops curl from buffering the events. With the Python SDK:

Get the token counts

Morse sends a final chunk with usage only when the request sets stream_options.include_usage to true. No other chunk carries usage. The final chunk has an empty choices list.

Ignore the padding

Each chunk has a top-level obfuscation field, a random string of 16 to 64 characters that pads the chunk. It holds no data. Ignore it. On some reasoning models, Morse also sends a : keepalive comment every 25 seconds while the model thinks. Clients that follow the server-sent events specification ignore comments.

Handle an error mid-stream

If the model fails after the stream starts, the status is already 200. Morse then sends one event with the error envelope and ends the stream without data: [DONE]:
Treat a stream that ends without data: [DONE] as incomplete.