Documentation

Your familiar SDK. A clear path from API key to first response.

Streaming

Choose a guide or find an API method. Copy examples to your project; this page does not execute requests.

Streaming

Consume the complete server-sent event stream.

Enable streaming

Set stream to true in the selected protocol request. Parse SSE records across arbitrary network chunk boundaries, including CRLF and fragmented UTF-8. A network chunk is not necessarily an event.

cURL
curl --no-buffer "https://api.quanteex.com/v1/chat/completions" \
  -H "Authorization: Bearer $QUANTEEX_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Quanteex-Output-Policy: provider_maximum" \
  --data '{"model":"gpt-6-astra","messages":[{"role":"user","content":"Hello"}],"stream":true,"stream_options":{"include_usage":true}}'

Read the terminal event

Chat streams end with [DONE]; Messages finish with message_stop and Responses with response.completed. Images use image_generation.completed or image_edit.completed with the final image in b64_json. Handle error events and unexpected termination; HTTP 200 alone does not establish completion.

Image SSE example

Long-running requests

There is no default total generation deadline. The API allows up to 300 seconds without model-service data; your client and the direct or CDN proxy can impose additional limits. A heartbeat keeps a connection active but does not establish successful generation.

Cancellation

Disconnecting after generation starts may still produce billable usage. Treat an interrupted request as indeterminate until you receive a final response or a clear error.

Retry safely

Retry only before a request has produced output or side effects. After a timeout or broken connection, avoid automatic duplicate requests when the operation may have completed.

Search documentation