openai
from openai import OpenAI
client = OpenAI(
base_url="https://geko--tokay-serve-web.modal.run/v1",
api_key=os.environ["GEKO_API_KEY"],
)
res = client.audio.speech.create(
model="tts-1",
voice="Aigerim",
input="Сәлеметсіз бе!",
response_format="wav",
)
res.write_to_file("hello.wav")curl --request POST \
--url https://geko--tokay-serve-web.modal.run/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "Сәлеметсіз бе!",
"model": "tokay-kk-v1",
"voice": "Aigerim",
"response_format": "wav",
"speed": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: 'Сәлеметсіз бе!',
model: 'tokay-kk-v1',
voice: 'Aigerim',
response_format: 'wav',
speed: 1
})
};
fetch('https://geko--tokay-serve-web.modal.run/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://geko--tokay-serve-web.modal.run/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([
'input' => 'Сәлеметсіз бе!',
'model' => 'tokay-kk-v1',
'voice' => 'Aigerim',
'response_format' => 'wav',
'speed' => 1
]),
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://geko--tokay-serve-web.modal.run/v1/audio/speech"
payload := strings.NewReader("{\n \"input\": \"Сәлеметсіз бе!\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"response_format\": \"wav\",\n \"speed\": 1\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://geko--tokay-serve-web.modal.run/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"Сәлеметсіз бе!\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"response_format\": \"wav\",\n \"speed\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geko--tokay-serve-web.modal.run/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 \"input\": \"Сәлеметсіз бе!\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"response_format\": \"wav\",\n \"speed\": 1\n}"
response = http.request(request)
puts response.read_body"<string>"{
"detail": "text is required"
}{
"detail": "invalid API key"
}{
"detail": "out of credits — top up in the geko console"
}API reference
OpenAI-compatible speech
OpenAI-compatible alias — point the OpenAI SDK at geko by swapping the base URL and model. Maps OpenAI’s request shape onto the Tokay engine. See the OpenAI compatibility guide.
POST
/
v1
/
audio
/
speech
openai
from openai import OpenAI
client = OpenAI(
base_url="https://geko--tokay-serve-web.modal.run/v1",
api_key=os.environ["GEKO_API_KEY"],
)
res = client.audio.speech.create(
model="tts-1",
voice="Aigerim",
input="Сәлеметсіз бе!",
response_format="wav",
)
res.write_to_file("hello.wav")curl --request POST \
--url https://geko--tokay-serve-web.modal.run/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "Сәлеметсіз бе!",
"model": "tokay-kk-v1",
"voice": "Aigerim",
"response_format": "wav",
"speed": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: 'Сәлеметсіз бе!',
model: 'tokay-kk-v1',
voice: 'Aigerim',
response_format: 'wav',
speed: 1
})
};
fetch('https://geko--tokay-serve-web.modal.run/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://geko--tokay-serve-web.modal.run/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([
'input' => 'Сәлеметсіз бе!',
'model' => 'tokay-kk-v1',
'voice' => 'Aigerim',
'response_format' => 'wav',
'speed' => 1
]),
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://geko--tokay-serve-web.modal.run/v1/audio/speech"
payload := strings.NewReader("{\n \"input\": \"Сәлеметсіз бе!\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"response_format\": \"wav\",\n \"speed\": 1\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://geko--tokay-serve-web.modal.run/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"Сәлеметсіз бе!\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"response_format\": \"wav\",\n \"speed\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geko--tokay-serve-web.modal.run/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 \"input\": \"Сәлеметсіз бе!\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"response_format\": \"wav\",\n \"speed\": 1\n}"
response = http.request(request)
puts response.read_body"<string>"{
"detail": "text is required"
}{
"detail": "invalid API key"
}{
"detail": "out of credits — top up in the geko console"
}Authorizations
Body
application/json
Text to synthesize.
Example:
"Сәлеметсіз бе!"
OpenAI ids (tts-1, tts-1-hd, gpt-4o-mini-tts) are accepted and mapped to the default.
Voice name.
wav or pcm (raw 16-bit PCM @ 24 kHz). mp3/opus/aac/flac return 400 (not transcoded yet).
Available options:
wav, pcm Speed multiplier.
Response
WAV audio (or raw PCM when response_format is pcm).
The response is of type file.
⌘I