SAGEA LogoDocs & API

Streaming Audio

Stream realtime speech with sonus-tts using chunked transfer and 16kHz PCM frames.

POST https://api.sagea.space/v1/audio/stream

Authentication

Send Authorization: Bearer $SAGEA_API_KEY on every request. Get a key

Parameters

Send a JSON body with the following fields.

ParameterTypeRequiredDescription
modelstringYesAlways sonus-tts for streaming synthesis.
inputstringYesText to stream, max 4096 characters per request.
voicestringNoOne of nova, atlas, or a cloned voice_id.
emotionstringNoOne of neutral, friendly, professional, excited, calm, or warm.
speednumberNoPlayback speed from 0.5 to 2.0. Default is 1.0.
formatstringNoFrame encoding. Use pcm16 for 16kHz PCM frames.
languagestringNoBCP-47 hint such as ne-NP, hi-IN, en-US, or es-ES.

Example request

Stream Welcome to SAGEA with a ne-NP greeting in realtime.

curl -N -X POST https://api.sagea.space/v1/audio/stream \
  -H "Authorization: Bearer $SAGEA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sonus-tts",
    "input": "Welcome to SAGEA. नमस्ते, म तपाईंलाई सहयोग गर्नेछु।",
    "voice": "atlas",
    "emotion": "friendly",
    "speed": 1.0,
    "format": "pcm16"
  }' \
  --output stream.pcm

First audio byte arrives in under 200ms for responsive voice agents.

Response

The API returns chunked 16kHz PCM frames, not a single JSON object.

{
  "note": "Chunked PCM stream. Each frame is 16kHz mono audio.",
  "first_byte_ms": 172,
  "format": "pcm16",
  "sample_rate_hz": 16000,
  "request_id": "stream_atlas77np",
  "model": "sonus-tts",
  "voice": "atlas"
}

Buffer frames client-side and play continuously for realtime output.

Errors

StatusCodeFix
400text_too_longSplit input into chunks under 4096 characters.
401unauthorizedRe-export a valid SAGEA_API_KEY value.
422voice_not_foundUse nova, atlas, or a valid vox_ voice ID.
429rate_limit_exceededBack off and retry with exponential delay.
500internal_errorReconnect once, then report request ID.

Limits

Audio streaming allows 50 requests per minute on Starter and 500 requests per minute on Pro.

What's next

On this page