"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].
-N flag stops curl from buffering the events.
With the Python SDK:
Get the token counts
Morse sends a final chunk withusage 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-levelobfuscation 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 already200. Morse then sends one event with the error envelope and ends the stream without data: [DONE]:
data: [DONE] as incomplete.