Stream Speech
Changed onStream speech from the voice identified by voice_id.
Set output_format to request raw PCM16, MP3, mu-law, or A-law audio bytes without SSE framing. Raw streams require with_timestamps=false; a failure after audio begins terminates the connection. X-Audio-Sample-Rate and X-Audio-Channels identify the audio parameters. Otherwise, the response sends base64 WAV parts as Server-Sent Events (SSE). Set with_timestamps to true to include one alignment event after the audio. This event contains character and word timings for original and normalized text. Words use Unicode boundaries, without dictionary segmentation. A successful stream ends with data: [DONE].
Voice and settings
Use an ACTIVE HeyGen Voice clone in your workspace. heygen-voice-1-turbo speaks instant clones at lower latency and refuses professional clones. For paid models, API-key billing accumulates fractional usage. OAuth requests, including MCP calls, are rounded up per request to whole billing units, so their effective cost can be higher.
seed, speed, pitch_shift, and pitch_variance apply only to professional clones. Instant clones, including Turbo, accept and ignore these controls.
Turbo Free
Use heygen-voice-1-turbo-free for instant voices without charge, including API-key and OAuth requests. This model is available to direct users and resellers for experimentation and prototyping. It has no latency, time-to-first-audio, or availability guarantee.
Per-user request limits and shared free capacity both apply. Either limit can return HTTP 429 with code=rate_limit_exceeded. Shared capacity can be exhausted even when you are below your own request limit. A timeout or service failure can return HTTP 500. Follow Retry-After when present; otherwise use exponential backoff. A free request never switches to a paid model. For streaming, HTTP 429 is returned before audio starts.
Language
Set language to the language of text. If you omit it, the language is detected from text. Successful responses include Content-Language, the language the speech was generated in.
Limits and request ID
The rate limit is 30 requests per minute per workspace member. High demand can exceed the available capacity for speech generation. The service then returns HTTP 429 with code=rate_limit_exceeded. This response has no Retry-After header. Retry the request with exponential backoff. For streaming, the service returns HTTP 429 only before the response starts.
Successful responses include X-Request-Id. Use this ID when you contact support about the request. For instant clones, completed requests automatically retain audio for request stitching when speech retention is allowed. Pass completed IDs in previous_request_ids or next_request_ids to keep continuity. Use up to three IDs per field in playback order, from the same workspace, voice, and model, within two hours. Finish reading a stream before reusing its ID. If context is unavailable, synthesis continues with its normal defaults. Stitching is unavailable when speech retention is disabled.
Request
- Base URLhttps://api.heygen.com
- URLhttps://api.heygen.com/v3/models/audio/tts/stream
- Auth
- API key in header x-api-key
- or HTTP bearer
Request body
Example request
{
"language": "en",
"text": "Hello from HeyGen Voice.",
"voice_id": "<voice_id>"
}Response
Raw audio bytes when output_format is supplied; otherwise a Server-Sent Events stream. Each data: frame contains an audio, alignment, or terminal error event; a clean stream terminates with data: [DONE].
Changes
- info
endpoint added
- info