Skip to main content

Create Speech

Generates audio speech from text input using the specified model and voice.
POST https://api.runcrate.ai/v1/audio/speech

Request Body

ParameterTypeRequiredDescription
modelstringYesThe text-to-speech model to use.
inputstringYesThe text to convert to speech. Maximum length varies by model.
voicestringNoThe voice to use for speech generation. Available voices depend on the model.
response_formatstringNoAudio output format. Supported values: mp3, pcm. Default: mp3.

Example Request

curl https://api.runcrate.ai/v1/audio/speech \
  -H "Authorization: Bearer rc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "hexgrad/Kokoro-82M",
    "input": "Welcome to Runcrate. The fastest way to run AI in the cloud.",
    "voice": "af_heart",
    "response_format": "mp3"
  }' \
  --output speech.mp3

Response

Returns the audio file as binary data.
FormatContent-Type
mp3audio/mpeg
pcmaudio/pcm
The response is a raw audio binary. Use the --output flag with curl (or equivalent in your HTTP client) to save it to a file.

Python Example

import requests

response = requests.post(
    "https://api.runcrate.ai/v1/audio/speech",
    headers={
        "Authorization": "Bearer rc_live_YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "model": "hexgrad/Kokoro-82M",
        "input": "Hello from Runcrate!",
        "voice": "af_heart",
        "response_format": "mp3",
    },
)

with open("output.mp3", "wb") as f:
    f.write(response.content)