Audio Speech (TTS)
curl --request POST \
--url https://kymaapi.com/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": "<string>",
"voice_id": "<string>",
"response_format": "<string>",
"voice_settings": {},
"stream": true
}
'import requests
url = "https://kymaapi.com/v1/audio/speech"
payload = {
"model": "<string>",
"input": "<string>",
"voice_id": "<string>",
"response_format": "<string>",
"voice_settings": {},
"stream": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: '<string>',
voice_id: '<string>',
response_format: '<string>',
voice_settings: {},
stream: true
})
};
fetch('https://kymaapi.com/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://kymaapi.com/v1/audio/speech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'input' => '<string>',
'voice_id' => '<string>',
'response_format' => '<string>',
'voice_settings' => [
],
'stream' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://kymaapi.com/v1/audio/speech"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"response_format\": \"<string>\",\n \"voice_settings\": {},\n \"stream\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://kymaapi.com/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"response_format\": \"<string>\",\n \"voice_settings\": {},\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kymaapi.com/v1/audio/speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"response_format\": \"<string>\",\n \"voice_settings\": {},\n \"stream\": true\n}"
response = http.request(request)
puts response.read_bodyEndpoints
Audio Speech (TTS)
Text-to-speech. Synchronous, returns audio bytes, billed per character. Several voice models, 3,000+ pre-made voices.
POST
/
v1
/
audio
/
speech
Audio Speech (TTS)
curl --request POST \
--url https://kymaapi.com/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": "<string>",
"voice_id": "<string>",
"response_format": "<string>",
"voice_settings": {},
"stream": true
}
'import requests
url = "https://kymaapi.com/v1/audio/speech"
payload = {
"model": "<string>",
"input": "<string>",
"voice_id": "<string>",
"response_format": "<string>",
"voice_settings": {},
"stream": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: '<string>',
voice_id: '<string>',
response_format: '<string>',
voice_settings: {},
stream: true
})
};
fetch('https://kymaapi.com/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://kymaapi.com/v1/audio/speech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'input' => '<string>',
'voice_id' => '<string>',
'response_format' => '<string>',
'voice_settings' => [
],
'stream' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://kymaapi.com/v1/audio/speech"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"response_format\": \"<string>\",\n \"voice_settings\": {},\n \"stream\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://kymaapi.com/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"response_format\": \"<string>\",\n \"voice_settings\": {},\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kymaapi.com/v1/audio/speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"response_format\": \"<string>\",\n \"voice_settings\": {},\n \"stream\": true\n}"
response = http.request(request)
puts response.read_bodySynchronous endpoint. Send text, get back audio bytes in one call. Pick a model based on quality needs vs latency budget.
No speech model is in the free tier. An account that has never added credits gets
402 with error.code: "model_requires_paid" from every model on this page; any first top-up unlocks them.curl -X POST https://kymaapi.com/v1/audio/speech \
-H "Authorization: Bearer $KYMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "eleven-multilingual-v2",
"input": "The first move is what sets everything in motion.",
"voice_id": "JBFqnCBsd6RMkjVDRZzb",
"response_format": "mp3_44100_128"
}' \
--output speech.mp3
Request
application/json body.
string
default:"eleven-multilingual-v2"
One of:
eleven-multilingual-v2— hero quality, 29 languages, expressive ($0.405/1K char)eleven-flash-v2-5— ~75ms time-to-first-byte, real-time agents ($0.2025/1K char)eleven-turbo-v2-5— balanced quality + speed ($0.2025/1K char)minimax-speech-hd— MiniMax HD voices ($0.07/1K char)minimax-speech-turbo— MiniMax low-latency voices ($0.04/1K char)
string
required
Text to synthesize. Max 5000 characters per request — chunk longer text client-side. Also accepts the alias
text for OpenAI compatibility.string
Voice id — opaque string from
GET /v1/audio/voices. Also accepts the alias voice. Use an ElevenLabs voice with eleven-* models and a MiniMax voice with minimax-speech-* models. When omitted, eleven-* models use 21m00Tcm4TlvDq8ikWAM and minimax-speech-* models use female-shaonv.string
default:"mp3_44100_128"
Audio format.
mp3_44100_128 (default), mp3_44100_192, mp3_22050_32, pcm_16000/22050/24000/44100, ulaw_8000.object
Optional fine-tuning:
stability (0–1), similarity_boost (0–1), style (0–1), use_speaker_boost (boolean).boolean
default:"false"
Opt-in low-latency mode. When
true, audio is delivered progressively as it is synthesized — time-to-first-audio drops to ~0.4s (vs ~1.8s for the default full-buffer path). Transparent to your code: the response is still a single complete audio/mpeg stream you can pipe straight to disk or a player. Currently applies to the MiniMax speech models; ignored by models that don’t support progressive synthesis.Response
200 OK with raw audio bytes. Billing rides on X-Kyma-* response headers — the body stays a clean audio file you can pipe straight to disk or play.
| Header | What |
|---|---|
Content-Type | matches the requested format (audio/mpeg for mp3, etc.) |
X-Kyma-Model | resolved model id |
X-Kyma-Chars-Billed | input char count used for pricing |
X-Kyma-Cost-USD | actual cost charged |
X-Kyma-Balance-USD | remaining balance |
Errors
| Status | error.code | When |
|---|---|---|
400 | not_a_tts_model | model is not a TTS SKU |
400 | input_too_long | input text > 5000 chars |
400 | — | invalid JSON or missing input (error.type: invalid_request) |
401 | — | missing or invalid API key (error.type: auth_error) |
402 | model_requires_paid | your account has never added credits; speech models are not in the free tier |
402 | insufficient_credits | your balance does not cover the request |
403 | voice_not_owned | the voice_id is a cloned voice that belongs to another account |
404 | model_not_found | the model is paused or retired (for example eleven-v3); the message names a replacement when there is one |
413 | — | request body > 25 MB (error.type: invalid_request) |
429 | audio_concurrent_limit | your tier’s speech concurrency cap is reached. Retry-After: 5 |
502 | tts_failed | the speech model failed (error.type: provider_error) |
503 | — | speech is not available right now; retry shortly (error.type: provider_error) |
See also
GET /v1/audio/voices— browse the voice library