Streaming

stream: true turns a chat answer into a stream of SSE chunks — the same wire format as OpenAI, down to the final data: [DONE].

Turning it on

Add stream: true to the /v1/chat/completions body. The response arrives with Content-Type: text/event-stream and a sequence of data: lines carrying chat.completion.chunk objects.

curl -N https://mintform.app/v1/chat/completions \
  -H "Authorization: Bearer mf_live_…" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-5-mini",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about failover"
    }
  ],
  "stream": true
}'

What comes over the wire

Assemble the text from choices[0].delta.content. The stream ends with the sentinel data: [DONE].

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant"}}]}

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"delta":{"content":"Req"}}]}

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"delta":{"content":"uests"}}]}

data: [DONE]

Clients

The OpenAI SDK handles this natively — just iterate the response. With curl, pass -N or the output will be buffered.

Things to plan for

  • A failure before the first byte arrives as ordinary JSON with a 4xx/5xx status — the stream may never start.
  • If a provider dies mid-stream the connection ends: handle a partial answer on your side.
  • Your plan concurrency slot is held for the whole life of the stream, not just the request moment.
  • Intermediate proxies and CDNs can buffer SSE — test streaming over the same path you use in production.

Images do not stream