Streaming · UltraGPT API
Streaming
With stream: true you receive chat.completion.chunk events ending in data: [DONE]. Add stream_options: {"include_usage": true} for a final chunk with usage and cost. If you disconnect mid-stream the generation still completes and is billed in full, with exact usage. Send X-UltraGPT-Abort-On-Disconnect: true to stop it instead: you pay only for the output produced until you left (estimated, since the provider reports no usage for a cut stream).
curl https://api.ultragpt.pro/v1/chat/completions \
-H "Authorization: Bearer $ULTRAGPT_API_KEY" \
-H "Content-Type: application/json" \
-N -d '{
"model": "grok-4.7",
"stream": true,
"messages": [{ "role": "user", "content": "Write a haiku about APIs" }]
}'