Cartesia TTS API
Generates speech audio from the provided text using Cartesia's Text-to-Speech service
Request Body
application/json
Optionaltext
RequiredstringMinimum length:
1
Maximum length: 10000
voice
stringThe ID of the voice to use
Default:
"f9a4b3a6-b44b-469f-90e3-c8e19bd30e99"
model
stringThe ID of the model to use for the generation
Default:
"sonic-2"
token
RequiredstringCartesia API key for authentication
Minimum length:
1
language
stringThe language that the given voice should speak the transcript in
Default:
"zh"
Value in: "en" | "fr" | "de" | "es" | "pt" | "zh" | "ja" | "hi" | "it" | "ko" | "nl" | "pl" | "ru" | "sv" | "tr"
duration
numberThe maximum duration of the audio in seconds
Minimum:
0
speed
stringSpeed setting for the model
Default:
"normal"
Value in: "slow" | "normal" | "fast"
pronunciation_dict_ids
array<string>A list of pronunciation dict IDs to use for the generation
output_format
objectResponse Body
Audio file containing the generated speech
TypeScript Definitions
Use the response body type in TypeScript.
response
RequiredunknownBad request - validation error
TypeScript Definitions
Use the response body type in TypeScript.
success
RequiredbooleanValue in:
false
message
RequiredstringServer error or Cartesia API error
TypeScript Definitions
Use the response body type in TypeScript.
success
RequiredbooleanValue in:
false
message
Requiredstringcurl -X POST "https://edge-workers.laplace.cn/laplace/tts-cartesia" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!",
"voice": "f9a4b3a6-b44b-469f-90e3-c8e19bd30e99",
"model": "sonic-2",
"token": "string",
"language": "en",
"duration": 0,
"speed": "slow",
"pronunciation_dict_ids": [
"string"
],
"output_format": {
"container": "mp3",
"bit_rate": 64000,
"sample_rate": 44100
}
}'
const body = JSON.stringify({
"text": "Hello, world!",
"voice": "f9a4b3a6-b44b-469f-90e3-c8e19bd30e99",
"model": "sonic-2",
"token": "string",
"language": "en",
"duration": 0,
"speed": "slow",
"pronunciation_dict_ids": [
"string"
],
"output_format": {
"container": "mp3",
"bit_rate": 64000,
"sample_rate": 44100
}
})
fetch("https://edge-workers.laplace.cn/laplace/tts-cartesia", {
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://edge-workers.laplace.cn/laplace/tts-cartesia"
body := strings.NewReader(`{
"text": "Hello, world!",
"voice": "f9a4b3a6-b44b-469f-90e3-c8e19bd30e99",
"model": "sonic-2",
"token": "string",
"language": "en",
"duration": 0,
"speed": "slow",
"pronunciation_dict_ids": [
"string"
],
"output_format": {
"container": "mp3",
"bit_rate": 64000,
"sample_rate": 44100
}
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "https://edge-workers.laplace.cn/laplace/tts-cartesia"
body = {
"text": "Hello, world!",
"voice": "f9a4b3a6-b44b-469f-90e3-c8e19bd30e99",
"model": "sonic-2",
"token": "string",
"language": "en",
"duration": 0,
"speed": "slow",
"pronunciation_dict_ids": [
"string"
],
"output_format": {
"container": "mp3",
"bit_rate": 64000,
"sample_rate": 44100
}
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)
null
{
"success": false,
"message": "string"
}
{
"success": false,
"message": "string"
}