Skip to navigation

Streaming

Set stream: true on a chat completion and the response arrives as server-sent events, one chunk per piece of text, ending with data: [DONE].

curl https://ai.hyperflow.fun/v1/chat/completions \
-H "Authorization: Bearer $HYPERFLOW_API_KEY" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "openai/gpt-6-luna",
"messages": [{ "role": "user", "content": "Write a haiku about the sea." }],
"stream": true
}'

The samples use the OpenAI SDK set up as in the Quickstart.

Usage in a stream

Every stream ends with a chunk that has an empty choices list and the request’s usage, so you always know what it cost. You don’t need to set stream_options.

Long answers

While the model is thinking, Flow AI sends a keep-alive comment every 15 seconds so proxies don’t close the connection. SSE clients ignore it. A request can run for up to 10 minutes.

Billing

A streamed request is held and charged like any other. If you stop reading or the connection drops, the request settles on the tokens the model had already read and written, and the rest of the hold is released.