When stream: true, task: false, the server returns audio data via standard SSE (Server-Sent Events).

Request example

curl -N -X POST https://51kik.com/audio/v1/generations \
  -H 'Authorization: Bearer sk-xxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "<streaming-audio-model>",
    "prompt": "This is a streaming speech synthesis example.",
    "voice": "<voice>",
    "stream": true,
    "task": false
  }'

SSE event types

EventDescription
audioAn audio chunk, data.url is the audio URL
timelineWord-level timing or additional metadata
completeGeneration finished, includes final usage and results
errorGeneration failed

Completion signal

On success, a complete event is sent followed by data: [DONE]. Keep reading events until [DONE] is received.

Error handling

Once audio events have been sent to the client in SSE mode, the stream cannot seamlessly switch to another route. The client should handle the error event and close the stream.