Skip to main content
POST
/
v1
/
text-to-speech
/
{voice_id}
Text To Speech
curl --request POST \
  --url https://api.example.com/v1/text-to-speech/{voice_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "model_id": "hexgrad/Kokoro-82M",
  "output_format": "wav",
  "language_code": "<string>"
}
'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

xi-api-key
string | null

Path Parameters

voice_id
string
required

Query Parameters

output_format
string | null

Body

application/json
text
string
required

Text to convert to speech

Example:

"I'm beginnin' to feel like a Rap God, Rap God\nAll my people from the front to the back nod, back nod\nNow, who thinks their arms are long enough to slap box, slap box?\nThey said I rap like a robot, so call me Rap-bot"

model_id
string
default:hexgrad/Kokoro-82M

Model ID to use for the conversion

output_format
enum<string>
default:wav

Output format for the speech

Available options:
mp3,
opus,
flac,
wav,
pcm
Examples:

"mp3"

"opus"

"flac"

"wav"

"pcm"

language_code
string | null

ISO 639-1, 2 letter language code

Response

Successful Response