curl --request POST \
--url https://api.deapi.ai/api/v2/audio/speech/price \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "Kokoro",
"lang": "en-us",
"speed": 1,
"format": "mp3",
"sample_rate": 24000,
"text": "A beautiful sunset over mountains",
"count_text": 1000,
"mode": "custom_voice",
"voice": "af_sky",
"instruct": "Read this in a calm, measured tone"
}
'import requests
url = "https://api.deapi.ai/api/v2/audio/speech/price"
payload = {
"model": "Kokoro",
"lang": "en-us",
"speed": 1,
"format": "mp3",
"sample_rate": 24000,
"text": "A beautiful sunset over mountains",
"count_text": 1000,
"mode": "custom_voice",
"voice": "af_sky",
"instruct": "Read this in a calm, measured tone"
}
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'Kokoro',
lang: 'en-us',
speed: 1,
format: 'mp3',
sample_rate: 24000,
text: 'A beautiful sunset over mountains',
count_text: 1000,
mode: 'custom_voice',
voice: 'af_sky',
instruct: 'Read this in a calm, measured tone'
})
};
fetch('https://api.deapi.ai/api/v2/audio/speech/price', 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://api.deapi.ai/api/v2/audio/speech/price",
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' => 'Kokoro',
'lang' => 'en-us',
'speed' => 1,
'format' => 'mp3',
'sample_rate' => 24000,
'text' => 'A beautiful sunset over mountains',
'count_text' => 1000,
'mode' => 'custom_voice',
'voice' => 'af_sky',
'instruct' => 'Read this in a calm, measured tone'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"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://api.deapi.ai/api/v2/audio/speech/price"
payload := strings.NewReader("{\n \"model\": \"Kokoro\",\n \"lang\": \"en-us\",\n \"speed\": 1,\n \"format\": \"mp3\",\n \"sample_rate\": 24000,\n \"text\": \"A beautiful sunset over mountains\",\n \"count_text\": 1000,\n \"mode\": \"custom_voice\",\n \"voice\": \"af_sky\",\n \"instruct\": \"Read this in a calm, measured tone\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
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://api.deapi.ai/api/v2/audio/speech/price")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"Kokoro\",\n \"lang\": \"en-us\",\n \"speed\": 1,\n \"format\": \"mp3\",\n \"sample_rate\": 24000,\n \"text\": \"A beautiful sunset over mountains\",\n \"count_text\": 1000,\n \"mode\": \"custom_voice\",\n \"voice\": \"af_sky\",\n \"instruct\": \"Read this in a calm, measured tone\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/audio/speech/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"Kokoro\",\n \"lang\": \"en-us\",\n \"speed\": 1,\n \"format\": \"mp3\",\n \"sample_rate\": 24000,\n \"text\": \"A beautiful sunset over mountains\",\n \"count_text\": 1000,\n \"mode\": \"custom_voice\",\n \"voice\": \"af_sky\",\n \"instruct\": \"Read this in a calm, measured tone\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"price": 0.25
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"message": "The selected model does not support Text To Image.",
"errors": {
"model": [
"This model is not available on your plan. Please upgrade to access it."
]
}
}{
"message": "Too Many Attempts."
}Text-to-Speech Price Calculation
Estimate the price of a text-to-speech generation request. Either text or count_text must be provided.
curl --request POST \
--url https://api.deapi.ai/api/v2/audio/speech/price \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "Kokoro",
"lang": "en-us",
"speed": 1,
"format": "mp3",
"sample_rate": 24000,
"text": "A beautiful sunset over mountains",
"count_text": 1000,
"mode": "custom_voice",
"voice": "af_sky",
"instruct": "Read this in a calm, measured tone"
}
'import requests
url = "https://api.deapi.ai/api/v2/audio/speech/price"
payload = {
"model": "Kokoro",
"lang": "en-us",
"speed": 1,
"format": "mp3",
"sample_rate": 24000,
"text": "A beautiful sunset over mountains",
"count_text": 1000,
"mode": "custom_voice",
"voice": "af_sky",
"instruct": "Read this in a calm, measured tone"
}
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'Kokoro',
lang: 'en-us',
speed: 1,
format: 'mp3',
sample_rate: 24000,
text: 'A beautiful sunset over mountains',
count_text: 1000,
mode: 'custom_voice',
voice: 'af_sky',
instruct: 'Read this in a calm, measured tone'
})
};
fetch('https://api.deapi.ai/api/v2/audio/speech/price', 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://api.deapi.ai/api/v2/audio/speech/price",
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' => 'Kokoro',
'lang' => 'en-us',
'speed' => 1,
'format' => 'mp3',
'sample_rate' => 24000,
'text' => 'A beautiful sunset over mountains',
'count_text' => 1000,
'mode' => 'custom_voice',
'voice' => 'af_sky',
'instruct' => 'Read this in a calm, measured tone'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"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://api.deapi.ai/api/v2/audio/speech/price"
payload := strings.NewReader("{\n \"model\": \"Kokoro\",\n \"lang\": \"en-us\",\n \"speed\": 1,\n \"format\": \"mp3\",\n \"sample_rate\": 24000,\n \"text\": \"A beautiful sunset over mountains\",\n \"count_text\": 1000,\n \"mode\": \"custom_voice\",\n \"voice\": \"af_sky\",\n \"instruct\": \"Read this in a calm, measured tone\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
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://api.deapi.ai/api/v2/audio/speech/price")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"Kokoro\",\n \"lang\": \"en-us\",\n \"speed\": 1,\n \"format\": \"mp3\",\n \"sample_rate\": 24000,\n \"text\": \"A beautiful sunset over mountains\",\n \"count_text\": 1000,\n \"mode\": \"custom_voice\",\n \"voice\": \"af_sky\",\n \"instruct\": \"Read this in a calm, measured tone\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/audio/speech/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"Kokoro\",\n \"lang\": \"en-us\",\n \"speed\": 1,\n \"format\": \"mp3\",\n \"sample_rate\": 24000,\n \"text\": \"A beautiful sunset over mountains\",\n \"count_text\": 1000,\n \"mode\": \"custom_voice\",\n \"voice\": \"af_sky\",\n \"instruct\": \"Read this in a calm, measured tone\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"price": 0.25
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"message": "The selected model does not support Text To Image.",
"errors": {
"model": [
"This model is not available on your plan. Please upgrade to access it."
]
}
}{
"message": "Too Many Attempts."
}Authorizations
Sanctum personal access token, sent as Authorization: Bearer <token>. The token is opaque — it carries no claims and no embedded expiry, so do not attempt to decode it. Issue and revoke tokens from your account dashboard.
Headers
application/json Body
Audio generation parameters. Either text or count_text must be provided. Voice is optional (not needed for voice_clone or voice_design modes).
The model to use for speech generation. Available models can be retrieved via the GET /api/v2/models endpoint.
"Kokoro"
Language to be used during audio generation
"en-us"
Generated audio speech speed
1
Audio output format. Read info.limits.output_formats for your model from GET /api/v2/models and send one of the listed values; anything else is rejected with 422.
"mp3"
Sample rate of generated audio
24000
Text to be converted to speech. Either this or count_text must be provided.
"A beautiful sunset over mountains"
Number of characters for price calculation. Either this or text must be provided.
1000
TTS mode: custom_voice (default), voice_clone, or voice_design.
custom_voice, voice_clone, voice_design, null "custom_voice"
Name of the voice to be used. Only relevant for custom_voice mode.
"af_sky"
Natural language voice description for voice_design mode price calculation.
"Read this in a calm, measured tone"
Response
Calculated price for text2audio inference.
Show child attributes
Show child attributes
Was this page helpful?