Subspace Institute

Cartesia TTS API

Generates speech audio from the provided text using Cartesia's Text-to-Speech service

POST
/tts-cartesia

Request Body

application/jsonOptional
textRequiredstring
Minimum length: 1Maximum length: 10000
voicestring

The ID of the voice to use

Default: "f9a4b3a6-b44b-469f-90e3-c8e19bd30e99"
modelstring

The ID of the model to use for the generation

Default: "sonic-2"
tokenRequiredstring

Cartesia API key for authentication

Minimum length: 1
languagestring

The 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"
durationnumber

The maximum duration of the audio in seconds

Minimum: 0
speedstring

Speed setting for the model

Default: "normal"Value in: "slow" | "normal" | "fast"
pronunciation_dict_idsarray<string>

A list of pronunciation dict IDs to use for the generation

output_formatobject

Response Body

Audio file containing the generated speech

TypeScript Definitions

Use the response body type in TypeScript.

responseRequiredunknown

Bad request - validation error

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean
Value in: false
messageRequiredstring

Server error or Cartesia API error

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean
Value in: false
messageRequiredstring
curl -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"
}