Streaming API
Stream output chunks in real-time as the model generates them. This is useful for supported text-to-speech, music, and streaming model endpoints.
Note: A streaming request is authenticated, billed, and associated with a prediction. Capture the streamed data you need and avoid blindly replaying the POST after an ambiguous disconnect.
Endpoint
POST https://api.wavespeed.ai/api/v3/{model_id}/streamAdd /stream to a model endpoint that explicitly supports streaming. The request payload uses that model’s normal input schema; the /stream path selects streaming mode, not a stream field in the JSON body.
Request
curl --fail-with-body --no-buffer --connect-timeout 10 --max-time 600 \
-X POST "https://api.wavespeed.ai/api/v3/minimax/speech-02-turbo/stream" \
-H "Authorization: Bearer $WAVESPEED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world! This is a test of the text-to-speech system.",
"voice_id": "Energetic_Girl",
"emotion": "happy",
"speed": 1,
"volume": 1
}'Response
The response is an event stream (text/event-stream). Chunks are relayed from the upstream model as SSE data: events.
- Stream closes when the provider finishes
- Terminal status payload (if any) is included in the stream
- Event JSON is model-specific; consult the selected model’s schema and do not assume progress-percentage events are present
Supported Models
| Provider | Models |
|---|---|
| MiniMax Speech | speech-02-hd, speech-02-turbo, speech-2.5-hd-preview, speech-2.5-turbo-preview, speech-2.6-hd, speech-2.6-turbo |
| MiniMax Music | music-02 |
| WaveSpeed LLM | any-llm, any-llm/vision |
Requests to /stream for unsupported models will return an error.
Notes
- Your client must support Server-Sent Events (SSE) or chunked responses
- Authentication, rate limits, and billing are the same as non-streaming endpoints
- Use
stream=Truein Python requests to consume the HTTP response incrementally; do not add"stream": trueto the model input unless that model’s schema separately defines it - The server terminates a stream after 10 minutes without output
Keepalive and Errors
After a prediction is created, while waiting for model output, the server can send SSE comments such as : WAVESPEED PROCESSING. Ignore lines beginning with :; they are not output chunks or billable model tokens. Comments do not reset the 10-minute model-output idle timeout or extend your client deadline.
After response bytes are sent, later failures arrive as SSE error events, even when HTTP status is 200. Inspect each event for errors; raise_for_status() and curl --fail-with-body alone cannot detect an error inside an established stream. Do not automatically replay a generation after a timeout or uncertain disconnect.