---
title: "Text-to-Speech API for Video | Rendley API Docs"
description: "Turn a script into natural-sounding narration with ElevenLabs voices. Browse the catalog, pick a voice, and get audio you can drop straight onto a timeline."
url: https://docs.rendley.com/api/text-to-speech/
---

# Text to speech

Turn a script into natural-sounding narration with ElevenLabs voices. Browse the catalog, pick a voice, and get audio you can drop straight onto a timeline.

## Generate text-to-speech audio

Enqueue a job to generate spoken-word audio from text using a selected voice.

POST`https://api.rendley.com/v1/ai/text-to-speech`

Body

`model_id`optionalstring

Which model to use. Changing it updates the params below.

`params`requiredjson

Model-specific parameters. The fields listed for the selected model.

`voice_id`requiredstring

Voice ID from the voice catalog.

`prompt`requiredstring

The exact spoken words to convert to speech audio. No stage directions or annotations.

`stability`optionalnumber

How consistent the voice is across the clip. Higher = more monotone and stable; lower = more expressive and variable. Raise this if the voice sounds different on every generation.

`similarity_boost`optionalnumber

How closely the output matches the original voice. Higher = closer to the source voice.

`style`optionalnumber

Style exaggeration of the original speaker. 0 disables style transfer. Higher values amplify the speaker's style at the cost of stability.

`use_speaker_boost`optionalboolean

Boost similarity to the original speaker. Adds slight latency.

true

`speed`optionalnumber

Playback speed. 1.0 is natural speed; lower is slower; higher is faster.

`seed`optionalinteger

Optional seed for deterministic output. Reuse the same seed (with the same voice and settings) to get the same audio every time. Leave empty for random.

`project_id`optionalstring

`workspace_id`optionalstring

```
const res = await fetch("https://api.rendley.com/v1/ai/text-to-speech", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({
    "params": {
      "voice_id": "EXAVITQu4vr4xnSDxMaL",
      "prompt": "Welcome to Rendley. Let's make something."
    },
    "model_id": "eleven-labs-tts"
  }),
});
const { data } = await res.json();
```

```
curl -X POST "https://api.rendley.com/v1/ai/text-to-speech" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "params": {
      "voice_id": "EXAVITQu4vr4xnSDxMaL",
      "prompt": "Welcome to Rendley. Let's make something."
    },
    "model_id": "eleven-labs-tts"
  }'
```

```
import requests

res = requests.post(
    "https://api.rendley.com/v1/ai/text-to-speech",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "params": {
            "voice_id": "EXAVITQu4vr4xnSDxMaL",
            "prompt": "Welcome to Rendley. Let's make something."
        },
        "model_id": "eleven-labs-tts"
    },
)
data = res.json()["data"]
```

```
$ch = curl_init("https://api.rendley.com/v1/ai/text-to-speech");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_API_KEY", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["params" => ["voice_id" => "EXAVITQu4vr4xnSDxMaL", "prompt" => "Welcome to Rendley. Let's make something."], "model_id" => "eleven-labs-tts"]));

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true)["data"];
```

```
package main

import (
	"fmt"
	"io"
	"net/http"
	"bytes"
)

func main() {
	body := bytes.NewBufferString(`{
  "params": {
    "voice_id": "EXAVITQu4vr4xnSDxMaL",
    "prompt": "Welcome to Rendley. Let's make something."
  },
  "model_id": "eleven-labs-tts"
}`)
	req, _ := http.NewRequest("POST", "https://api.rendley.com/v1/ai/text-to-speech", body)
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	b, _ := io.ReadAll(res.Body)
	fmt.Println(string(b))
}
```

```
require "net/http"
require "json"

uri = URI("https://api.rendley.com/v1/ai/text-to-speech")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer YOUR_API_KEY"
req["Content-Type"] = "application/json"
req.body = { params: { voice_id: "EXAVITQu4vr4xnSDxMaL", prompt: "Welcome to Rendley. Let's make something." }, model_id: "eleven-labs-tts" }.to_json

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)["data"]
```

Response 200

```
{
  "data": {
    "job_id": "d97241f2-e1e4-4651-b078-8663fc35c584"
  }
}
```

## Calculate text-to-speech cost

Calculate the credit cost of generating spoken-word audio from text.

POST`https://api.rendley.com/v1/ai/text-to-speech/cost`

Body

`model_id`optionalstring

Which model to use. Changing it updates the params below.

`params`requiredjson

Model-specific parameters. The fields listed for the selected model.

`voice_id`requiredstring

Voice ID from the voice catalog.

`prompt`requiredstring

The exact spoken words to convert to speech audio. No stage directions or annotations.

`stability`optionalnumber

How consistent the voice is across the clip. Higher = more monotone and stable; lower = more expressive and variable. Raise this if the voice sounds different on every generation.

`similarity_boost`optionalnumber

How closely the output matches the original voice. Higher = closer to the source voice.

`style`optionalnumber

Style exaggeration of the original speaker. 0 disables style transfer. Higher values amplify the speaker's style at the cost of stability.

`use_speaker_boost`optionalboolean

Boost similarity to the original speaker. Adds slight latency.

true

`speed`optionalnumber

Playback speed. 1.0 is natural speed; lower is slower; higher is faster.

`seed`optionalinteger

Optional seed for deterministic output. Reuse the same seed (with the same voice and settings) to get the same audio every time. Leave empty for random.

`project_id`optionalstring

`workspace_id`optionalstring

```
const res = await fetch("https://api.rendley.com/v1/ai/text-to-speech/cost", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({
    "params": {
      "voice_id": "EXAVITQu4vr4xnSDxMaL",
      "prompt": "Welcome to Rendley. Let's make something."
    },
    "model_id": "eleven-labs-tts"
  }),
});
const { data } = await res.json();
```

```
curl -X POST "https://api.rendley.com/v1/ai/text-to-speech/cost" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "params": {
      "voice_id": "EXAVITQu4vr4xnSDxMaL",
      "prompt": "Welcome to Rendley. Let's make something."
    },
    "model_id": "eleven-labs-tts"
  }'
```

```
import requests

res = requests.post(
    "https://api.rendley.com/v1/ai/text-to-speech/cost",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "params": {
            "voice_id": "EXAVITQu4vr4xnSDxMaL",
            "prompt": "Welcome to Rendley. Let's make something."
        },
        "model_id": "eleven-labs-tts"
    },
)
data = res.json()["data"]
```

```
$ch = curl_init("https://api.rendley.com/v1/ai/text-to-speech/cost");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_API_KEY", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["params" => ["voice_id" => "EXAVITQu4vr4xnSDxMaL", "prompt" => "Welcome to Rendley. Let's make something."], "model_id" => "eleven-labs-tts"]));

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true)["data"];
```

```
package main

import (
	"fmt"
	"io"
	"net/http"
	"bytes"
)

func main() {
	body := bytes.NewBufferString(`{
  "params": {
    "voice_id": "EXAVITQu4vr4xnSDxMaL",
    "prompt": "Welcome to Rendley. Let's make something."
  },
  "model_id": "eleven-labs-tts"
}`)
	req, _ := http.NewRequest("POST", "https://api.rendley.com/v1/ai/text-to-speech/cost", body)
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	b, _ := io.ReadAll(res.Body)
	fmt.Println(string(b))
}
```

```
require "net/http"
require "json"

uri = URI("https://api.rendley.com/v1/ai/text-to-speech/cost")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer YOUR_API_KEY"
req["Content-Type"] = "application/json"
req.body = { params: { voice_id: "EXAVITQu4vr4xnSDxMaL", prompt: "Welcome to Rendley. Let's make something." }, model_id: "eleven-labs-tts" }.to_json

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)["data"]
```

Response 200

```
{
  "data": 0
}
```

## List text-to-speech voices

Voices of the default text-to-speech model; same as GET /ai/models/{modelId}/voices.

GET`https://api.rendley.com/v1/ai/text-to-speech/voices`

`page`optionalstring

`limit`optionalstring

`query`optionalstring

`gender`optionalstring

`age`optionalstring

`accent`optionalstring

`language`optionalstring

```
const res = await fetch("https://api.rendley.com/v1/ai/text-to-speech/voices", {
  headers: { Authorization: "Bearer YOUR_API_KEY" },
});
const { data } = await res.json();
```

```
curl "https://api.rendley.com/v1/ai/text-to-speech/voices" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```
import requests

res = requests.get(
    "https://api.rendley.com/v1/ai/text-to-speech/voices",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
data = res.json()["data"]
```

```
$ch = curl_init("https://api.rendley.com/v1/ai/text-to-speech/voices");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_API_KEY"]);

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true)["data"];
```

```
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.rendley.com/v1/ai/text-to-speech/voices", nil)
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	b, _ := io.ReadAll(res.Body)
	fmt.Println(string(b))
}
```

```
require "net/http"
require "json"

uri = URI("https://api.rendley.com/v1/ai/text-to-speech/voices")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_API_KEY"

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)["data"]
```

Response 200

```
{
  "data": [
    {
      "accent": "string",
      "age": "string",
      "description": "string",
      "gender": "string",
      "id": "3f0d5a4e-3d2a-4c1f-9b3e-2a1c4d5e6f70",
      "language": "string",
      "model_id": "3f0d5a4e-3d2a-4c1f-9b3e-2a1c4d5e6f70",
      "name": "string",
      "preview_audio_url": "string",
      "recommended": true,
      "use": "string"
    }
  ]
}
```

## Get a voice preview

Get a preview audio URL for a specific text-to-speech voice.

GET`https://api.rendley.com/v1/ai/text-to-speech/voices/{voiceId}/preview`

`voiceId`requiredstring

```
const res = await fetch("https://api.rendley.com/v1/ai/text-to-speech/voices/VOICE_ID/preview", {
  headers: { Authorization: "Bearer YOUR_API_KEY" },
});
const { data } = await res.json();
```

```
curl "https://api.rendley.com/v1/ai/text-to-speech/voices/VOICE_ID/preview" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```
import requests

res = requests.get(
    "https://api.rendley.com/v1/ai/text-to-speech/voices/VOICE_ID/preview",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
data = res.json()["data"]
```

```
$ch = curl_init("https://api.rendley.com/v1/ai/text-to-speech/voices/VOICE_ID/preview");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_API_KEY"]);

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true)["data"];
```

```
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.rendley.com/v1/ai/text-to-speech/voices/VOICE_ID/preview", nil)
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	b, _ := io.ReadAll(res.Body)
	fmt.Println(string(b))
}
```

```
require "net/http"
require "json"

uri = URI("https://api.rendley.com/v1/ai/text-to-speech/voices/VOICE_ID/preview")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_API_KEY"

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)["data"]
```

Response 200

```
{
  "data": {
    "preview_audio_url": "string"
  }
}
```

Generation is asynchronous. These endpoints return a `job_id`, so poll [GET /v1/jobs/{id}](https://docs.rendley.com/api/jobs/) until the job completes and read the download URL off the finished job. [Jobs and polling](https://docs.rendley.com/api/polling/) covers the loop, and [Generate and download](https://docs.rendley.com/api/examples/generate-and-download/) is a script that runs it end to end.

[Previous pageLip sync](https://docs.rendley.com/api/lipsync/) [Next pageMusic generation](https://docs.rendley.com/api/generate-music/)
