Loly 3.5

Text-to-Speech (SSE)

Uses the same JSON fields as batch generation and returns progressive text/event-stream events.

POST/api/v1/tts/sse
On this page

Code examples

curl -N -X POST https://studio.evomlabs.com/api/v1/tts/sse \
  -H "Authorization: Bearer vc_sk_live_YOUR_KEY" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{"text":"Xin chào","language":"vi"}'

Events

event: start
data: {"sample_rate":24000,"channels":1,"format":"pcm_s16le","encoding":"base64"}

event: audio
data: {"sequence":1,"audio":"<base64 PCM16 little-endian>"}

event: done
data: {"chunks":12,"duration_ms":5230,"elapsed_ms":6100}

Authorization

Bearer credential

Send the credential in the Authorization header. Account and voice keys are accepted only where the endpoint contract permits them.

Request

FieldTypeRequiredDefaultDescription
textstringYes-Text to speak, not empty, up to 5,000 characters.
voice_idstringNo-Required with an account key. Omit with a voice key; if provided, it must match the key-bound voice.
languagestringNoautoauto, or one code or full name from the 646-language catalog.
format"mp3" | "wav"Nomp3Exactly mp3 or wav. The returned container and MIME match this value.
speednumberNo1.0Playback rate, clamped to 0.5 to 1.5. Ignored when duration is set.
cfg_valuenumberNo2.0How closely to follow the reference voice. A finite number from 0.0 to 4.0, including 0.
dit_stepsintegerNo10Diffusion steps. An integer from 0 to 64, including 0.

The allowance is deducted up front by text.length, including any whitespace in the string you send.

Fixed output duration

This transport accepts duration but does nothing with it. It synthesises one sentence per model call, so a single length for the whole request has nowhere to apply. Use POST /api/v1/tts/generate or /bytes when you need a fixed length.

Response

JSON
event: start
data: {"sample_rate":24000,"channels":1,"format":"pcm_s16le","encoding":"base64"}

event: audio
data: {"sequence":1,"audio":"<base64 PCM16 little-endian>"}

event: done
data: {"chunks":12,"duration_ms":5230,"elapsed_ms":6100}

Important

Exactly one start event comes first, then one or more audio events in increasing sequence order, then one done event. An error event has code GENERATION_FAILED and replaces done if generation fails after the stream begins.

Errors

REST failures use the documented error envelope. Handle the error code instead of matching the human-readable message.

Error codes

Was this page helpful?

Evom Labs API documentation