Create Speech
Generates audio speech from text input using the specified model and voice.
POST https://api.runcrate.ai/v1/audio/speech
Request Body
| Parameter | Type | Required | Description |
|---|
model | string | Yes | The text-to-speech model to use. |
input | string | Yes | The text to convert to speech. Maximum length varies by model. |
voice | string | No | The voice to use for speech generation. Available voices depend on the model. |
response_format | string | No | Audio 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.
| Format | Content-Type |
|---|
mp3 | audio/mpeg |
pcm | audio/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)