Speech Streaming API
Use stream_format=sse to receive audio events, or audio to receive a binary stream.
POST /v1/audio/speech
Set KITSCH_OPENAI_BASE_URL to your Audio API URL ending in /v1.
curl "$KITSCH_OPENAI_BASE_URL/audio/speech" \
-H "Authorization: Bearer $KITSCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"kitsch-voice","voice":"<voice_id>","input":"Hello.","response_format":"wav","stream_format":"sse"}'
Response
Content-Type: text/event-stream.
event: speech.audio.delta
data: {"type":"speech.audio.delta","audio":"<BASE64_AUDIO>"}
event: speech.audio.done
data: {"type":"speech.audio.done"}
Decode each speech.audio.delta event's base64 audio in order and concatenate the bytes. speech.audio.done marks the end of the transfer.