Core features
Text to speech
Synthesise speech from text and receive an audio file in return.
POST
/v1/audio/speech
Converts input text into spoken audio. Returns raw audio bytes in the requested format.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | Yes | A TTS model id from your catalog (e.g. myt TTS). |
input | string | Yes | Text to synthesise. |
voice | string | Yes | A voice id supported by the model. Available voices are model-specific — open the model's detail page in the catalog to see its voices. |
response_format | string | No | Audio format (model-dependent), e.g. mp3 (default), opus, aac, flac, wav, pcm. |
speed | number | No | Playback speed multiplier, where the model supports it. Default 1.0. |
Example request
{
"model": "myt TTS",
"input": "Welcome to myt AI Cloud. Your gateway to AI models.",
"voice": "<voice-id>",
"response_format": "mp3"
}Response
The response body is raw audio bytes. The Content-Type header matches the requested format (e.g. audio/mpeg for mp3). Write the bytes directly to a file.
curl -sS --request "POST" \
--url "$MYT_BASE_URL/audio/speech" \
--header "Authorization: Bearer $MYT_API_KEY" \
--header "Content-Type: application/json" \
--output "speech.mp3" \
--data '{"model":"myt TTS","input":"Hello from myt AI Cloud.","voice":"<voice-id>"}'Errors
| Status | When |
|---|---|
400 | Input too long, unsupported voice or format |
401 | API key missing or invalid |
429 | Rate limit or budget exceeded |
Code examples
curl -sS --request "POST" \
--url "$MYT_BASE_URL/audio/speech" \
--header "Authorization: Bearer $MYT_API_KEY" \
--header "Content-Type: application/json" \
--output "speech.mp3" \
--data '{"model":"myt TTS","input":"Hello from myt AI Cloud.","voice":"<voice-id>"}'Full parameter reference: Audio speech.