Add text-to-speech and voice cloning to your app

Published · Updated · Radiant Crest Inc.

Find a voice, generate speech, add a second speaker for dialogue, and clone your own voice, with the exact API calls for each step.

1. Find a voice

curl "https://omni-api.rcinc.app/v1/voices?provider=elevenlabs&search=narrator&language=English" -H "Authorization: Bearer $OMNI_KEY"

Voice ids carry a provider prefix such as elevenlabs_, minimax_, edge_ or kokoro_. Use them exactly as returned.

2. Generate speech

curl https://omni-api.rcinc.app/v1/audio/speech \
  -H "Authorization: Bearer $OMNI_KEY" -H "content-type: application/json" \
  -d '{"input":"Thanks for listening. See you next week.","voice_id":"elevenlabs_TX3LPaxmHKxFdv7VOQHJ","speed":1,"with_transcript":true}'

Poll GET /v1/tasks/{id}. The finished task has output.audio[0].url, and output.srt_url when you asked for a transcript.

3. Two speakers

{
  "input": "A> Welcome to the show.\nB> Glad to be here.",
  "speakers": [{ "voice_id": "elevenlabs_TX3LPaxmHKxFdv7VOQHJ" }, { "voice_id": "minimax_male-qn-qingse" }],
  "delay": 0.4
}

Send it to POST /v1/audio/dialogue.

4. Fix pronunciation

Create a dictionary once and attach its id to speech requests:

{ "name": "Brand names", "rules": [{ "from": "Omni", "to": "Om-nee", "matchType": "word" }] }

5. Clone your own voice

curl https://omni-api.rcinc.app/v1/voices/clone -H "Authorization: Bearer $OMNI_KEY" -F name="My narrator" -F audio_file=@sample.mp3

Use the returned clone_… id anywhere a voice is accepted. Cloned voices are private to your account. Only clone voices you have permission to use.

Costs

Each task shows exactly what it took from your credit. ElevenLabs Multilingual v2 voices cost about $0.069 per 1,000 characters, below ElevenLabs' own $0.08.

Follow along with $5 of credit.

Get your API key →