Stop empty streams from reaching your users
A streamed request whose first route answered empty used to hand your caller an empty stream; now it is retried on another route before any output reaches you, and only the attempt that answers is billed.
We built a retry for a streamed request whose first route answers 200, then has nothing to say. Until now your caller read an empty stream. Now an empty or broken first answer is retried on another route before any output reaches your caller, and your caller reads the stream of the route that answers. Apertis does this on Chat Completions, Messages and Responses, and only the attempt that answers is billed.

Nothing to change in your request
Send the same streamed request as before. The retry happens before any of the first route's stream reaches you, so the stream you read is the answering route's:
curl -N https://api.apertis.ai/v1/chat/completions \
-H "Authorization: Bearer $APERTIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5.5","stream":true,"messages":[{"role":"user","content":"Say hello."}]}'data: {"id":"<id>","object":"chat.completion.chunk","created":<ts>,"model":"claude-sonnet-5.5","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]}
data: {"id":"<id>","object":"chat.completion.chunk","created":<ts>,"model":"claude-sonnet-5.5","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":"stop"}]}
data: [DONE]/v1/messages and /v1/responses behave the same way with their own stream events.

What counts as empty or broken
A route's first answer is retried when, before any output reaches you, it does one of these:
- The stream ends with no output.
- It sends an event that cannot be parsed.
- It closes without a terminal event.
- It sends an error event that is not about your request itself.
When it applies
| Your request | What you get |
|---|---|
A stream on /v1/chat/completions, /v1/messages or /v1/responses whose first answer is empty or broken before any output | The request is retried on another route, and you get that route's answer |
| A stream whose first answer carries output | Delivered byte for byte, as before |
| A stream that has already sent you any output | Never retried and never spliced: it reaches you as it is |
| A request that no other route can serve | Delivered as before, with no retry |
| A stream from a route the retry does not cover yet | Delivered as before, with no retry |
| A first answer that runs long before its first output | Delivered as before, with no retry |
| A request that names a stop sequence | Delivered as before, with no retry |
| A request that ends with a tool result | Delivered as before, with no retry |
| A web-search stream that has already shown that it is searching | Delivered as before, with no retry |
Only the attempt that answers is billed. Non-streaming Chat Completions requests got the same treatment earlier.