v4

OpenAPI 3.1.02026-07-313621,3961.8 MB
text-to-voice

Design A Voice.

Design a voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint.

post/v1/text-to-voice/design

Query parameters

output_format'mp3_22050_32' | 'mp3_24000_48' | 'mp3_44100_32' | 'mp3_44100_64' | 'mp3_44100_96' | 'mp3_44100_128' | 'mp3_44100_192' | 'pcm_8000' | 'pcm_16000' | 'pcm_22050' | 'pcm_24000' | 'pcm_32000' | 'pcm_44100' | 'pcm_48000' | 'ulaw_8000' | 'alaw_8000' | 'opus_48000_32' | 'opus_48000_64' | 'opus_48000_96' | 'opus_48000_128' | 'opus_48000_192'

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 Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs.

Headers

xi-api-keystring nullable

Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.

Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.

Request body

voice_descriptionstring required

Description to use for the created voice.

model_id'eleven_multilingual_ttv_v2' | 'eleven_ttv_v3'

Model to use for the voice generation. Possible values: eleven_multilingual_ttv_v2, eleven_ttv_v3.

textstring nullable

Text to generate, text length has to be between 100 and 1000.

auto_generate_textboolean

Whether to automatically generate a text suitable for the voice description.

loudnessnumber

Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS.

seedinteger nullable

Random number that controls the voice generation. Same seed with same inputs produces same voice.

guidance_scalenumber

Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale.

stream_previewsboolean

Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint.

should_enhanceboolean

Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False

remixing_session_idstring nullable

The remixing session id.

remixing_session_iteration_idstring nullable

The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created.

qualitynumber nullable

Higher quality results in better voice output but less variety.

reference_audio_base64string nullable

Reference audio to use for the voice generation. The audio should be base64 encoded. Only supported when using the eleven_ttv_v3 model.

prompt_strengthnumber nullable

Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model.

Example request

{
  "voice_description": "A sassy squeaky mouse",
  "model_id": "eleven_multilingual_ttv_v2",
  "text": "Every act of kindness, no matter how small, carries value and can make a difference, as no gesture of goodwill is ever wasted.",
  "loudness": 0.5,
  "seed": 11,
  "guidance_scale": 5,
  "stream_previews": true,
  "should_enhance": true,
  "remixing_session_id": "123",
  "remixing_session_iteration_id": "123",
  "quality": 0.9,
  "prompt_strength": 0.25
}

Response

Successful Response

textstring required

The text used to preview the voices.