Skip to content

Voices

Every avatar has one voice, set on the avatar in 2wai Studio. Every session of that avatar speaks in it.

  • voice_id on POST /v1/sessions is accepted and ignored, so an integration that already sends it keeps working, but it has no effect. Leave it out of new code.
  • To change how an avatar sounds, change its voice in Studio. The next session uses the new voice.
  • There is no way to push your own audio: POST /v1/sessions/{id}/audio answers 409 not_available_on_livekit (see Bring your own TTS).

The shape below is what the API is planned to accept. Today it returns 501 voice_cloning_unavailable.

Option A: upload a file, then reference it

Section titled “Option A: upload a file, then reference it”
  1. Upload the clip with POST /v1/files:

    Terminal window
    curl -X POST https://api.2wai.ai/v1/files \
    -H "Authorization: Bearer $TWAI_SECRET_KEY" \
    -F "file=@reference-clip.wav"

    The response carries a file_id.

  2. Create the voice from that file_id:

    Terminal window
    curl -X POST https://api.2wai.ai/v1/voices \
    -H "Authorization: Bearer $TWAI_SECRET_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "narrator",
    "file_id": "<file_id from step 1>"
    }'
Terminal window
curl -X POST https://api.2wai.ai/v1/voices \
-H "Authorization: Bearer $TWAI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "narrator",
"url": "https://example.com/reference-clip.wav"
}'

Provide exactly one of file_id or url, not both.

Use clean, single-speaker audio: no background music or noise, no clipping, and no long silences at the start or end.

Terminal window
curl https://api.2wai.ai/v1/voices \
-H "Authorization: Bearer $TWAI_SECRET_KEY"

A voice listed here does not change what a LiveKit session sounds like; only the voice set on the avatar in Studio does.