Saltar a la navegación

Generate Text-to-Speech

Turn a script into speech and get back a hosted audio url. Use that URL as an audio input in POST /v2/generate to lipsync the result.

voiceId takes an ElevenLabs voice id from List Voices or the id of a voice you cloned. Retry 503 and 504 elevenlabs_service_unavailable after the Retry-After interval. Other error codes, including voice restrictions and problems with a connected ElevenLabs key, are explained in Error Handling. See Text-to-Speech.

Autenticación

x-api-keystring
Autenticación con clave API vía encabezado

Solicitud

This endpoint expects an object.
scriptstringRequerido1-5000 characters

The text to synthesize into speech (1–5,000 characters).

voiceIdstringRequerido

A voice id to synthesize with — either an ElevenLabs voice id (discover via GET /v2/voices) or the id of a voice cloned via POST /v2/voices.

providerenumRequerido

The voice provider to synthesize with. Currently elevenlabs.

Valores permitidos:
stabilitydoubleOpcional0-1

Voice stability (0-1). Higher is more consistent, lower is more expressive.

similarityBoostdoubleOpcional0-1

How closely the synthesized audio matches the original voice (0-1).

Respuesta

TTS audio generated successfully
idstring
A unique identifier for the synthesized audio.
urlstring

The hosted URL of the synthesized audio. Reuse it as an audio input in POST /v2/generate to keep the same take across generations.

durationdouble
Duration of the synthesized audio in seconds.

Errores

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
422
Unprocessable Entity Error
500
Internal Server Error
503
Service Unavailable Error
504
Gateway Timeout Error