Frequently asked questions
How do I authenticate with the API?
Include your unique API key in the request header as Authorization: Bearer tts-.... Each account holds one active key. You can generate a new key at any time via the dashboard; the previous key stops working immediately upon issuance.
What is the base URL for the API?
The API base URL is https://api.kuyaking.info/v1. All requests, including speech synthesis and voice listing, are directed to this endpoint. Ensure your client library points to this specific domain to route requests correctly.
Can I use the OpenAI JavaScript SDK?
Yes. The request shape matches the OpenAI speech endpoint exactly. You can use the official OpenAI JavaScript SDK by configuring it to use https://api.kuyaking.info/v1 as the base URL and providing your Kuyaking API key.
How do I change the API base URL?
If using the OpenAI SDK, set the base_url configuration option to https://api.kuyaking.info/v1. For plain HTTP requests, simply update your request target to this domain. The SDK handles the rest of the routing automatically.
What happens if the API key is compromised?
Generate a new API key immediately from your dashboard. The old key stops working instantly. You can issue a new key at any time, ensuring your integration remains secure without needing to update your billing details.
Is the API key reusable?
Yes, each account has one active key that can be reused across all your integrations. You can rotate it anytime via the dashboard. The new key becomes active immediately, and the old one is invalidated at once.
How do I handle rate limit errors?
The limit is 60 requests per minute per key (10 before the first top-up). Implement exponential backoff in your JavaScript code. Retry failed requests after a delay, as requests are processed sequentially and may queue under load.
What is the maximum text length per request?
The maximum input length is 4096 characters per request. For longer texts, split the content into chunks of up to 4096 characters, generate audio for each, and join the resulting audio files in your application logic.
Can I stream the audio response?
No. The API returns the complete audio file in the response body. There is no streaming or WebSocket support. You must wait for the full synthesis to complete before receiving the audio data.
Does the API support async requests?
No. Requests are processed sequentially. The API returns the audio file directly in the response. Long texts may take time due to queueing, but the connection remains open until the audio is fully generated.
How do I get the list of available voices?
Send a GET request to /v1/voices. This endpoint returns details on all 8 voice presets, supported languages, formats, and pricing information. Use this data to populate your UI or configure your integration dynamically.
What is the default response format?
The default format is mp3. You can specify other formats like wav, opus, flac, or pcm by including the response_format field in your JSON request body. If omitted, the server defaults to MP3.
How do I specify a language explicitly?
Include the language field in your request body with the ISO code (e.g., "de" for German). If omitted, the system guesses the language from the script, defaulting to English for Latin text. Explicit setting ensures accuracy.
Is there a webhook for long requests?
No. The API does not support webhooks. Requests are processed sequentially. You must poll or wait for the synchronous response. Long texts may queue, but the response is returned directly to your client when ready.
First request
curl
curl https://api.kuyaking.info/v1/audio/speech \
-H "Authorization: Bearer $TTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"tts-1","voice":"aria","input":"Hello from the API.","response_format":"mp3"}' \
--output hello.mp3Python (openai)
from openai import OpenAI
client = OpenAI(base_url="https://api.kuyaking.info/v1", api_key="tts-...")
with client.audio.speech.with_streaming_response.create(
model="tts-1", voice="nova", input="Hello from Python.", response_format="mp3"
) as response:
response.stream_to_file("hello.mp3")Node.js (openai)
import OpenAI from "openai";
import fs from "node:fs";
const client = new OpenAI({ baseURL: "https://api.kuyaking.info/v1", apiKey: process.env.TTS_API_KEY });
const res = await client.audio.speech.create({ model: "tts-1", voice: "milo", input: "Hello from Node.js." });
fs.writeFileSync("hello.mp3", Buffer.from(await res.arrayBuffer()));| voice | |
|---|---|
aria | female |
nova | female |
luna | female |
sage | female |
felix | male |
milo | male |
atlas | male |
orion | male |
| language | |
|---|---|
ar | العربية |
zh | 中文 |
da | Dansk |
nl | Nederlands |
en | English |
fi | Suomi |
fr | Français |
de | Deutsch |
el | Ελληνικά |
he | עברית |
hi | हिन्दी |
it | Italiano |
ja | 日本語 |
ko | 한국어 |
ms | Bahasa Melayu |
no | Norsk |
pl | Polski |
pt | Português |
ru | Русский |
es | Español |
sw | Kiswahili |
sv | Svenska |
tr | Türkçe |
Authentication
Authentication relies on a single active API key issued per account. Keys follow the tts-... format and are managed via the /get-api-key/ dashboard. Each account holds one valid key at a time, ensuring simple credential management for no-code integrations without complex permission scopes.
Pass the key in the HTTP header as Authorization: Bearer tts-<your_key>. This standard Bearer token structure works with the OpenAI SDK by pointing base_url to https://api.kuyaking.info/v1. You can regenerate keys instantly via the dashboard; the old key stops working immediately upon issuance of the new one.
API Key format
Keys start with tts- and are unique per site account. They are visible in the dashboard after sign-up via Google or email.
Bearer token usage
Include Authorization: Bearer tts-<key> in every request header. This applies to both speech generation and metadata endpoints like /v1/voices.
Key regeneration
Generate a new key in the dashboard at any time. The previous key is invalidated immediately, so update your integration configuration promptly to avoid 401 errors.
Endpoints
The API exposes three primary endpoints for integration. The speech generation endpoint accepts JSON payloads to convert text into audio files, while the voices and models endpoints provide metadata for configuration.
These endpoints follow a standard structure compatible with existing OpenAI SDKs, allowing for straightforward implementation in no-code platforms and custom scripts without complex protocol management.
Speech generation
Send a POST request to /v1/audio/speech with your text, selected voice, and format parameters. The endpoint returns the generated audio file directly in the response body.
Text is limited to 4096 characters per request. For longer lessons, split the content and join the resulting audio files sequentially.
- Endpoint:
POST https://api.kuyaking.info/v1/audio/speech - Accepts JSON body with
model,input,voice, andresponse_formatfields.
Voices list
Retrieve available voices, languages, and formats via GET /v1/voices. This endpoint returns a list of eight presets with their supported languages.
Use this data to populate dropdown menus in your course platform’s audio settings, ensuring instructors select voices compatible with their content’s language.
- Endpoint:
GET https://api.kuyaking.info/v1/voices - Returns voice ID, name, gender, and supported languages.
Model info
Query GET /v1/models to verify available models (tts-1 and tts-1-hd). Both models use the same engine and pricing, but tts-1-hd offers higher fidelity audio than tts-1.
Checking this endpoint ensures your integration uses the correct model identifiers for API calls.
- Endpoint:
GET https://api.kuyaking.info/v1/models - Lists available model IDs.
Request parameters
The API requires specific parameters to generate audio correctly. You must define the synthesis model, voice, and optional speed to ensure the output matches your course content requirements. These settings control the engine behavior and audio characteristics.
All parameters are sent in the JSON body of your POST request. Misconfigured values will result in immediate errors, so verify your inputs against the reference list below before sending data to the endpoint.
Model selection
Select between tts-1 and tts-1-hd. Both models use the same underlying engine and pricing structure, so the choice affects only the audio quality, not the cost. Use tts-1-hd for higher fidelity lesson narration.
The model name is a simple string field in the request body. There is no performance difference in processing time between the two options.
tts-1: Standard quality, standard price.tts-1-hd: High definition audio, same price.
Voice selection
Choose one of eight preset voices from aria, nova, luna, sage, felix, milo, atlas, or orion. Each voice has a distinct tone suitable for different teaching styles, from calm instructional to energetic promo.
Voices are language-agnostic; any voice can speak any of the 23 supported languages. If the input text language differs from the voice's default, specify the language parameter to prevent guessing errors.
aria: Warm, clear narrator.nova: Bright, upbeat.luna: Soft, storytelling.sage: Calm, instructional.felix: Energetic, promo.milo: Friendly, conversational.atlas: Neutral, news.orion: Deep, documentary.
Speed control
Adjust the speed parameter between 0.25 and 4.0 to modify the playback rate. A value of 1.0 is normal speed. Faster speeds reduce generation time but may reduce clarity for complex course material.
Slower speeds (e.g., 0.75) are useful for language learning or detailed explanations. The API processes requests sequentially, so extreme speed changes do not significantly alter queue wait times.
- Minimum speed: 0.25
- Maximum speed: 4.0
- Default speed: 1.0
Response formats
The API returns the audio file directly in the response body. The request_id helps track specific synthesis jobs for billing or debugging purposes. Ensure you handle the response promptly to avoid timeouts.
Success response
Successful requests return a 200 OK status with a JSON payload. The payload contains the audio binary in the requested format. This URL is valid for a short period, so download the file immediately.
Error codes
Errors return a 4xx or 5xx status with a JSON error object. Common codes include 400 for invalid parameters (e.g., invalid voice or speed) and 429 for rate limit exceeded. Each error includes a code and message field for precise debugging.
- 400: Bad Request – Invalid input parameters
- 401: Unauthorized – Invalid or expired API key
- 429: Too Many Requests – Rate limit exceeded
Audio binary
The audio file is delivered via the URL provided in the success response. You can download it using standard HTTP clients. The file format matches the response_format parameter (mp3, wav, opus, flac, or pcm). The audio data is included directly in the response body.
JavaScript examples
This section provides concrete JavaScript snippets for integrating the Kuyaking TTS API. The examples cover direct HTTP requests for Node.js and browser environments, as well as configuration for the OpenAI SDK, which works by adjusting the base URL.
Node.js fetch
Use the standard fetch API to send a POST request to the speech endpoint. Include the model, voice, and input text in the JSON body. Set the Authorization header with your Bearer token. The response contains the audio binary that can be written to a file or played directly.
Ensure you handle the binary data correctly. The API returns audio in the specified format, such as mp3 or wav. For Node.js environments, you may need to pipe the response body to a file system stream or a media player library.
- Set
Authorization: Bearer tts-your-key - Send
model,input,voice, andresponse_formatin the body - Handle binary response data directly
Browser fetch
In browser environments, use fetch to request audio. Note that the request is synchronous in processing, so long texts may take time. The browser will receive the audio file as a blob, which you can convert to a playable URL.
Be mindful of CORS policies if hosting your script separately. The API supports standard CORS headers for browser-based integrations, allowing seamless integration into no-code platforms or custom web apps without backend proxies.
- Convert response to
blob() - Create object URL for playback
- Handle potential CORS issues
OpenAI SDK config
The API is compatible with the OpenAI SDK. Set the base_url to https://api.kuyaking.info/v1 and use your Kuyaking key. This allows you to use existing OpenAI code structures with minimal changes.
This approach is ideal for developers already familiar with the OpenAI ecosystem. It simplifies integration into platforms that already support OpenAI-style endpoints, reducing the learning curve for new users.
- Set
base_urltohttps://api.kuyaking.info/v1 - Use standard OpenAI SDK methods
- Replace key with your Kuyaking key

Error handling
Handling errors correctly ensures your course audio generation pipeline remains stable. The API returns standard HTTP status codes to indicate success or failure, allowing your integration to react appropriately without manual intervention.
Common errors
A 400 Bad Request usually indicates invalid JSON, missing required fields like input or voice, or exceeding the 4096-character limit. A 401 Unauthorized error means your API key is missing or invalid. Check your key format and ensure it starts with tts-.
Retry logic
Implement exponential backoff for transient failures (5xx errors). Since requests are processed sequentially, short delays help avoid overwhelming the queue. Failed synthesis returns a full refund, so retrying is safe if the input remains valid.
Rate limit errors
Exceeding 60 requests per minute triggers a 429 Too Many Requests error. New accounts start with a 10 requests/minute limit. Pause processing or batch your text splits to stay within these bounds. Monitor your dashboard for usage trends.
Rate limits
Your API key allows 60 requests per minute (10 per minute before the first top-up). Requests are processed sequentially, meaning high-volume generation may queue behind previous tasks.
Monitoring your usage is straightforward via the dashboard. Track character consumption and request status to ensure your course audio pipeline stays within limits without unexpected interruptions.
Requests per minute
Each key supports up to 60 requests per minute. New accounts start with a limit of 10 requests per minute until the first top-up is processed. This limit applies per key, not per IP address.
- Standard limit: 60 requests/minute
- Initial limit: 10 requests/minute
- Limit resets every 60 seconds
Queue handling
Requests are processed in the order received. If you exceed the rate limit, subsequent requests will wait in a queue until capacity becomes available. Short phrases may take a few seconds to generate, while longer texts take longer due to real-time synthesis speed.
- Sequential processing model
- Queued requests wait for capacity
- No priority queue available
Monitoring usage
Use the dashboard to track character counts and usage. The dashboard shows real-time usage, balance, and character consumption. Failed requests do not consume your character limit, ensuring accurate billing.
- Check response headers for character count
- Dashboard shows real-time usage
- Failed requests are free
Best practices
Optimizing your TTS integration requires handling text length limits and language detection correctly to ensure consistent audio quality. By splitting inputs and providing explicit language hints, you avoid synthesis errors and improve processing speed for online course materials.
Text splitting
The API accepts a maximum of 4,096 characters per request. For longer lessons, split your text into chunks of this size, generate audio for each part, and join the resulting files. This approach prevents truncation and ensures complete delivery of your course content.
Language hinting
While the API guesses language from script, non-English Latin text defaults to English. Always set the language parameter explicitly (e.g., de for German) to ensure correct pronunciation and intonation, especially when your course materials include mixed languages or proper nouns.
Format selection
Choose mp3 for general web playback to balance quality and file size. Use wav or flac if your LMS requires uncompressed audio for editing or archival purposes. Note that opus and pcm are also available for specific streaming or processing needs.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. Your text input is processed exclusively to create the audio file.
23 languages
Any voice speaks any of these languages.
