Give your application
a voice.
Integrate Kokorov text-to-speech into your product using a simple HTTP API. Submit text, choose a voice and audio format, and receive generated speech as an audio file.
API base URL
https://Kokorov.duckdns.org
Create an account and wait for activation. Your API key is issued during registration, but speech generation remains unavailable until your account has an active subscription.
Quick start
Follow these steps to make your first speech-generation request.
- Register. Submit your name and email address to receive an account ID and API key.
- Wait for activation. Your account starts with
pendingstatus. The service provider must activate it and assign a subscription. - Choose a voice. Call
GET /voicesto retrieve the voices currently available. - Generate speech. Send an authenticated request to
POST /v1/ttsand save the returned audio.
curl -X POST https://Kokorov.duckdns.org/v1/tts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello! Welcome to Kokorov text to speech.",
"voice": "af_heart",
"speed": 1.0,
"format": "wav"
}' \
--output speech.wav
Create an account
Creates a new customer account. Registration does not require an API key.
Request body
{
"name": "John Banda",
"email": "john@example.com"
}
| Field | Type | Rules |
|---|---|---|
name | String | Required. 1–120 bytes after trimming. |
email | String | Required. Maximum 254 bytes; must contain @. |
Successful response
Registration returns HTTP 200 with your account ID and newly generated API key.
{
"account_id": "KKR-XXXXXXXXXXXXXXX",
"api_key": "kk_live_YOUR_SECRET_KEY"
}
Treat it like a password. Store it securely on your backend. Do not expose it in browser JavaScript, mobile app source code, public repositories, or logs.
An email address can only be registered once. A duplicate registration returns HTTP 409 Conflict.
Account activation
New accounts are created with pending status. Your API key is valid for account and usage lookups, but cannot generate speech until the account is activated.
| Status | Meaning |
|---|---|
pending | Registration received; awaiting activation. |
active | Account is activated. A valid subscription and remaining quota are still required for synthesis. |
suspended | Account access is suspended. |
Contact your Kokorov service provider for activation or subscription questions. Activation, subscription changes, and account administration are handled by the provider.
Authentication
Protected endpoints use Bearer token authentication. Include your API key in the HTTP Authorization header.
Authorization: Bearer YOUR_API_KEY
API keys have the prefix kk_live_. Requests with missing, invalid, or revoked keys are rejected with HTTP 401 Unauthorized.
List voices
Returns the voices currently available on the service. This endpoint does not require authentication.
Example response
{
"voices": ["af_heart"]
}
Currently available: af_heart. Always query this endpoint for the latest list before presenting voice choices in your application.
curl https://Kokorov.duckdns.org/voices
Text to speech
Converts text into an audio file. Requires an active account, a valid API key, and sufficient subscription quota. The /tts route is also available as an authenticated alias.
Request body
| Field | Type | Rules |
|---|---|---|
text REQUIRED | String | Must not be empty. Maximum 2,000 characters. |
voice OPTIONAL | String | Defaults to af_heart. Must match a voice returned by /voices. |
speed OPTIONAL | Number | Defaults to 1.0. Allowed range: 0.5 to 2.0. |
format OPTIONAL | String | Defaults to wav. Supported: wav, mp3, ogg, flac, aac. |
Example request
{
"text": "Hello! This audio was generated using Kokorov.",
"voice": "af_heart",
"speed": 1.0,
"format": "wav"
}
JavaScript example (Node.js)
This example uses the built-in fetch API available in modern Node.js versions.
const fs = require("node:fs/promises");
const API_URL = "https://Kokorov.duckdns.org";
const API_KEY = process.env.Kokorov_API_KEY;
async function synthesize(text) {
const response = await fetch(`${API_URL}/v1/tts`, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
text,
voice: "af_heart",
speed: 1.0,
format: "mp3"
})
});
if (!response.ok) {
const error = await response.text();
throw new Error(`Kokorov ${response.status}: ${error}`);
}
const audio = Buffer.from(await response.arrayBuffer());
await fs.writeFile("speech.mp3", audio);
return audio.length;
}
synthesize("Hello from my application!")
.then(size => console.log(`Saved ${size} bytes`))
.catch(console.error);
Successful response
A successful synthesis returns the audio file directly, not JSON. The response includes these headers:
| Header | Description |
|---|---|
Content-Type | MIME type for the selected audio format. |
Content-Disposition | Attachment filename, such as Kokorov-speech.wav. |
Content-Length | Audio response size in bytes. |
x-synthesis-ms | Time spent synthesizing, in milliseconds. |
x-audio-format | Selected output format. |
The service currently processes one synthesis request at a time. If another synthesis is running, the API returns HTTP 429 Too Many Requests. Your application should retry after a short delay, using a bounded retry policy.
Account details
Returns account information, subscription details when available, and the number of active API keys. Requires authentication.
curl https://Kokorov.duckdns.org/v1/account \ -H "Authorization: Bearer YOUR_API_KEY"
The response contains an account object, a subscription object (which may be null), and active_api_keys. Account information includes the account ID, name, email, status, and creation timestamp.
Usage and quota
Returns the account's current status and subscription usage information. Requires authentication.
curl https://Kokorov.duckdns.org/v1/usage \ -H "Authorization: Bearer YOUR_API_KEY"
When a subscription exists, usage data includes its character limit, characters used, characters remaining, status, start time, and expiry time. Successful speech-generation requests consume quota based on the number of characters submitted.
Audio formats
Choose the output format using the format request field. If omitted, the API returns WAV.
| Format | Content type | File extension |
|---|---|---|
wav | audio/wav | .wav |
mp3 | audio/mpeg | .mp3 |
ogg | audio/ogg | .ogg |
flac | audio/flac | .flac |
aac | audio/aac | .aac |
Format names are case-insensitive. Unsupported formats return HTTP 400 Bad Request.
Errors
Errors are returned with an appropriate HTTP status and a message describing the problem.
| Status | Meaning | What to do |
|---|---|---|
400 | Invalid input, voice, speed, or format. | Check your request fields and allowed values. |
401 | Missing, invalid, or revoked API key. | Check your Bearer token. |
403 | Account inactive or subscription/quota restriction. | Check account status and contact your provider if needed. |
409 | Email already registered. | Use the existing account. |
413 | Text exceeds 2,000 characters. | Split the text into smaller requests. |
422 | Speech synthesis failed. | Retry carefully; contact support if it persists. |
429 | Another synthesis is currently running. | Wait briefly and retry. |
500 | Internal server or audio conversion error. | Retry later and contact support if persistent. |
Security best practices
- Keep API keys on your server. Never embed them in public frontend code.
- Use environment variables or a secrets manager to store credentials.
- Use HTTPS for every API request.
- Do not commit API keys to Git repositories.
- Do not log authorization headers or full API keys.
- Validate user input and enforce sensible request limits in your application.