text_to_speech_stream
Convert text into speech audio using ElevenLabs, returning MP3 bytes or saving to a file. Specify voice_id and text to generate speech.
Instructions
Text To Speech Streaming Spends ElevenLabs credits. Returns audio/mpeg bytes; pass output_path to save them.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| text | Yes | The text that will get converted into speech. | |
| model_id | No | Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. | |
| voice_id | Yes | Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. | |
| next_text | No | ||
| output_path | No | Where to write the returned bytes. Relative paths resolve against ELEVENLABS_OUTPUT_DIR. Omit it to get the data inline as base64 (small files only). | |
| language_code | No | ||
| output_format | No | Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pr | |
| previous_text | No | ||
| enable_logging | No | When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. | |
| use_pvc_as_ivc | No | If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions. | |
| voice_settings | No | ||
| next_request_ids | No | ||
| previous_request_ids | No | ||
| apply_text_normalization | No | This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. | |
| optimize_streaming_latency | No | You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: 0 - default mode (no latency optimizations) 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) 2 - strong latency optimizations (abou | |
| apply_language_text_normalization | No | This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. | |
| pronunciation_dictionary_locators | No |