import { Geko } from "@gekoai/sdk";
const geko = new Geko({ apiKey: process.env.GEKO_API_KEY });
for await (const wav of geko.tts.stream({
text: longText,
voice: "Aigerim",
})) {
// each `wav` is a standalone, playable WAV chunk
play(wav);
}curl --request POST \
--url https://geko--tokay-serve-web.modal.run/v1/tts/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.",
"model": "tokay-kk-v1",
"voice": "Aigerim",
"speed": 1,
"nfe": 32,
"normalize": true
}
'import requests
url = "https://geko--tokay-serve-web.modal.run/v1/tts/stream"
payload = {
"text": "Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.",
"model": "tokay-kk-v1",
"voice": "Aigerim",
"speed": 1,
"nfe": 32,
"normalize": 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({
text: 'Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.',
model: 'tokay-kk-v1',
voice: 'Aigerim',
speed: 1,
nfe: 32,
normalize: true
})
};
fetch('https://geko--tokay-serve-web.modal.run/v1/tts/stream', 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/tts/stream",
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([
'text' => 'Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.',
'model' => 'tokay-kk-v1',
'voice' => 'Aigerim',
'speed' => 1,
'nfe' => 32,
'normalize' => 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://geko--tokay-serve-web.modal.run/v1/tts/stream"
payload := strings.NewReader("{\n \"text\": \"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"speed\": 1,\n \"nfe\": 32,\n \"normalize\": 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://geko--tokay-serve-web.modal.run/v1/tts/stream")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"speed\": 1,\n \"nfe\": 32,\n \"normalize\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geko--tokay-serve-web.modal.run/v1/tts/stream")
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 \"text\": \"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"speed\": 1,\n \"nfe\": 32,\n \"normalize\": true\n}"
response = http.request(request)
puts response.read_body"<string>"{
"detail": "text is required"
}{
"detail": "invalid API key"
}{
"detail": "unknown voice"
}{
"detail": "out of credits — top up in the geko console"
}{
"detail": "service temporarily unavailable"
}Stream speech sentence-by-sentence
Same request body as POST /v1/tts, but the response is delivered as each sentence finishes synthesizing — lower time-to-first-audio on long text. Auth and metering are identical to /v1/tts.
The body is a sequence of frames: a 4-byte big-endian length, followed by that many bytes of one complete WAV. Read a length, read that many bytes (one playable WAV chunk), repeat until the stream closes. The X-Tokay-Stream: wav-frames-v1 header identifies the framing. Most callers should use the SDK’s geko.tts.stream(), which wraps this as an async iterable — see the streaming guide.
import { Geko } from "@gekoai/sdk";
const geko = new Geko({ apiKey: process.env.GEKO_API_KEY });
for await (const wav of geko.tts.stream({
text: longText,
voice: "Aigerim",
})) {
// each `wav` is a standalone, playable WAV chunk
play(wav);
}curl --request POST \
--url https://geko--tokay-serve-web.modal.run/v1/tts/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.",
"model": "tokay-kk-v1",
"voice": "Aigerim",
"speed": 1,
"nfe": 32,
"normalize": true
}
'import requests
url = "https://geko--tokay-serve-web.modal.run/v1/tts/stream"
payload = {
"text": "Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.",
"model": "tokay-kk-v1",
"voice": "Aigerim",
"speed": 1,
"nfe": 32,
"normalize": 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({
text: 'Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.',
model: 'tokay-kk-v1',
voice: 'Aigerim',
speed: 1,
nfe: 32,
normalize: true
})
};
fetch('https://geko--tokay-serve-web.modal.run/v1/tts/stream', 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/tts/stream",
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([
'text' => 'Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.',
'model' => 'tokay-kk-v1',
'voice' => 'Aigerim',
'speed' => 1,
'nfe' => 32,
'normalize' => 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://geko--tokay-serve-web.modal.run/v1/tts/stream"
payload := strings.NewReader("{\n \"text\": \"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"speed\": 1,\n \"nfe\": 32,\n \"normalize\": 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://geko--tokay-serve-web.modal.run/v1/tts/stream")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"speed\": 1,\n \"nfe\": 32,\n \"normalize\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geko--tokay-serve-web.modal.run/v1/tts/stream")
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 \"text\": \"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.\",\n \"model\": \"tokay-kk-v1\",\n \"voice\": \"Aigerim\",\n \"speed\": 1,\n \"nfe\": 32,\n \"normalize\": true\n}"
response = http.request(request)
puts response.read_body"<string>"{
"detail": "text is required"
}{
"detail": "invalid API key"
}{
"detail": "unknown voice"
}{
"detail": "out of credits — top up in the geko console"
}{
"detail": "service temporarily unavailable"
}Authorizations
Body
Text to synthesize (up to ~5000 characters).
"Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸."
Model id.
Voice name from GET /v1/voices. Defaults to the model's default voice.
Speed multiplier.
0.5 <= x <= 2Diffusion steps: 16 fast, 32 quality.
Expand numbers, currency, and dates into spoken Kazakh.
Response
A stream of length-prefixed WAV frames (wav-frames-v1).
The response is of type file.