Integration Guide for the Text-to-Speech API

By LingvoFlow editorial team · Updated 2026-11-19

This guide provides the technical specifications for the LingvoFlow text-to-speech API, designed for integration into language learning platforms and indie developer workflows. You will find precise details on request structures, supported audio formats, and character-based billing logic required for reliable audio generation.

The documentation covers authentication protocols, endpoint configurations, and rate limiting constraints. Developers can implement the API using standard HTTP requests or the OpenAI SDK by adjusting the base URL. All parameters are defined to ensure predictable output and transparent character counting.

Integration Guide for the Text-to-Speech API

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.kriyabet.info/v1. You send POST requests to https://api.kriyabet.info/v1/audio/speech. This endpoint accepts JSON bodies containing model, input, voice, and other parameters. The structure mirrors the OpenAI speech endpoint, allowing standard integration methods for text-to-speech generation.

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email. Accounts are per site. The dashboard displays your active Bearer key. You can issue a new key at any time; the previous one stops immediately. One active key is allowed per account.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Change the base_url to https://api.kriyabet.info/v1 and use your LingvoFlow key. The official OpenAI SDKs work directly without modification, enabling standard integration patterns for developers already familiar with that ecosystem.

What is the maximum text length?

Each request supports up to 4096 characters. If your text exceeds this limit, split it into parts of 4096 characters or less. Generate audio for each part separately, then join the resulting audio files. Spaces and punctuation count toward the character limit.

Can I stream audio?

No. The API returns the complete audio file in the response body. There is no streaming, WebSocket, or real-time partial audio support. You must wait for the full synthesis to complete before receiving the data. This applies to all available response formats.

Do you support SSML?

No. The API does not support SSML, phoneme dictionaries, or custom pronunciation lexicons. You provide plain text input. Voice selection and speed adjustments are handled via specific parameters rather than markup within the text string. Complex audio structuring requires external processing.

How do I change the speed?

Include the speed parameter in your request body. Acceptable values range from 0.25 to 4.0. Adjusting this value scales the generation time proportionally. Ensure the value is a valid number within the specified range for successful synthesis.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key. Before the first top-up, the limit is 10 requests per minute. Exceeding this results in request failures. Failed requests are free, so no charge is incurred. Requests are processed sequentially, so load may cause queuing delays.

Is the API synchronous or asynchronous?

The API is synchronous. You send a POST request and wait for the audio file to be generated and returned. Requests are processed one after another. Under load, a request may wait in a queue. Typical speed is roughly real time for long texts.

Do I need to handle audio decoding?

No. The API returns the audio file directly in the response. You receive the raw bytes for formats like mp3, wav, opus, flac, or pcm. Your application can save or play the file immediately. No additional decoding steps are required by the API.

What audio formats are available?

You can choose from mp3, wav, opus, flac, and pcm. Specify the desired format using the response_format parameter in your request body. Each format serves different use cases regarding file size and quality. The choice does not affect the generation price or speed.

How do I specify the language?

Include the language parameter with an ISO code. If omitted, the system guesses the language from the script. Latin script defaults to English. For non-English Latin text, explicitly set the language code. Supported languages include Arabic, Chinese, English, German, Spanish, and others listed in the docs.

Can I mix languages in one request?

To mix languages, split the text into separate requests for each language and join the resulting audio files manually.

Is there a webhook for completion?

No. The API does not provide webhooks for completion notifications. Since the API is synchronous, the response contains the audio file upon completion. You must poll or wait for the response. There is no background processing notification system for long-running synthesis tasks.

First request

curl

curl https://api.kriyabet.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.mp3

Python (openai)

from openai import OpenAI

client = OpenAI(base_url="https://api.kriyabet.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.kriyabet.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
ariafemale
novafemale
lunafemale
sagefemale
felixmale
milomale
atlasmale
orionmale
language
arالعربية
zh中文
daDansk
nlNederlands
enEnglish
fiSuomi
frFrançais
deDeutsch
elΕλληνικά
heעברית
hiहिन्दी
itItaliano
ja日本語
ko한국어
msBahasa Melayu
noNorsk
plPolski
ptPortuguês
ruРусский
esEspañol
swKiswahili
svSvenska
trTürkçe

Authentication

Sound wave illustration for: Authentication

The API key is the sole credential for authenticating requests to the LingvoFlow endpoint. You can generate a key via the /get-api-key/ dashboard page, supporting both Google Sign-In and standard email/password accounts. Each account maintains one active key at a time.

API Key Generation

API Key Generation

Keys are issued immediately upon creation. The dashboard displays your current key, allowing you to copy it for integration into your language learning platform or indie developer workflow. Ensure you store the key securely, as it grants full access to your account's character balance.

  • Generate via /get-api-key/ page
  • Supports Google or email authentication
  • One active key per account

Bearer Token Format

Bearer Token Format

Include your key in the HTTP header as Authorization: Bearer tts-.... This standard format ensures compatibility with the OpenAI SDKs by simply adjusting the base_url to https://api.kriyabet.info/v1. No additional authentication parameters are required in the request body.

Key Revocation

Generate a new key at any time from the dashboard to invalidate the previous one immediately. The old key stops working at once, ensuring rapid response to potential security concerns without waiting for a session timeout or manual deactivation.

Endpoint Overview

Sound wave illustration for: Endpoint Overview

The API exposes three primary endpoints for interaction. The speech generation endpoint accepts POST requests with JSON payloads to synthesize audio files. The voices and models endpoints provide metadata for configuration.

All requests use the base URL https://api.kriyabet.info/v1. Authentication is handled via a Bearer token in the Authorization header. Responses return binary audio data or JSON metadata.

Speech Generation URL

Send text to POST https://api.kriyabet.info/v1/audio/speech. The endpoint accepts standard TTS parameters and returns audio files directly in the response body. Ensure the request body matches the expected JSON structure for model, input, and voice.

Failed synthesis requests do not incur charges. The endpoint processes requests sequentially, so high volume may introduce queuing delays.

  • Method: POST
  • Content-Type: application/json
  • Response: Binary audio or error JSON

Voices Listing Endpoint

Retrieve available voice presets, supported languages, and formats via GET https://api.kriyabet.info/v1/voices. This endpoint returns a JSON object listing all 8 voice presets and their attributes.

Use this endpoint to verify supported formats before generating audio. It confirms which voices support specific languages and output types.

  • Returns voice ID, name, gender, and language support
  • Includes format availability (mp3, wav, opus, flac, pcm)
  • No authentication required for basic listing

Models Endpoint

Fetch model details using GET https://api.kriyabet.info/v1/models. This endpoint lists the available synthesis engines, specifically tts-1 and tts-1-hd.

Both models share the same engine and pricing structure. Use this endpoint to confirm current model availability and versioning details for your integration.

  • Lists available model IDs
  • Shows pricing per character
  • Indicates model status

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts text input via the input field, supporting up to 4096 characters per request. Characters include spaces and punctuation, directly affecting the billed amount of $0.01 per 1,000 characters. For texts exceeding this limit, clients must split the input and join the resulting audio files sequentially.

Voice selection determines the timbre and style of the generated speech. The API provides eight distinct presets, categorized by gender and tone, such as the warm narrator Aria or the energetic promo voice Felix. Each voice supports all 23 supported languages, ensuring consistent output quality across different linguistic contexts.

Input Text Field

The input parameter accepts a string containing the text to be synthesized. The maximum length is strictly 4096 characters. If the input exceeds this limit, the request will fail, requiring the client application to handle chunking and concatenation of the resulting audio segments.

  • Maximum length: 4096 characters
  • Spaces and punctuation count toward the character limit
  • Failed requests incur no charge for the input text

Voice Selection

Select a voice from the eight available presets using the voice parameter. Each voice offers a distinct tonal quality, from the soft storytelling of Luna to the neutral news delivery of Atlas. All voices support the full range of 23 languages, allowing for flexible localization without voice switching.

  • 8 presets: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, Orion
  • Supports all 23 listed languages
  • Voices are based on licensed recordings from LibriTTS-R

Model Selection

Choose between the standard tts-1 and high-definition tts-1-hd models. Both models use the same underlying engine and incur identical billing rates. The choice affects audio fidelity but not the processing queue behavior or character count calculation.

  • Options: tts-1 or tts-1-hd
  • Same engine and price for both models
  • No difference in rate limits or character counting

Audio Formats

Sound wave illustration for: Audio Formats

The API supports five distinct audio formats, allowing you to select the optimal balance between file size and quality for your language learning application. Each format is generated synchronously upon request completion.

MP3 Output

MP3 is the default format for most integrations. It offers efficient compression suitable for web delivery and mobile applications, ensuring rapid playback across diverse devices without excessive bandwidth consumption.

WAV and FLAC Options

WAV provides uncompressed, lossless audio ideal for archival purposes or high-fidelity audio processing pipelines. FLAC offers lossless compression, reducing storage requirements by approximately 50% compared to WAV while preserving identical audio quality.

Opus and PCM Support

Opus delivers efficient compression at low bitrates, making it suitable for bandwidth-constrained environments. PCM provides raw, uncompressed linear audio data, suitable for immediate digital signal processing without decoding overhead.

Speed and Language

Sound wave illustration for: Speed and Language

Speed and language parameters allow precise control over audio output characteristics. The API accepts speed values between 0.25 and 4.0, enabling acceleration or deceleration of speech synthesis. Language specification ensures accurate phoneme generation for supported scripts, preventing mispronunciation in multilingual contexts.

Speed Range Configuration

Set the speed field to adjust playback rate. Values range from 0.25 (slow) to 4.0 (fast). This adjustment affects the duration of the generated audio file without altering the voice timbre.

ISO Language Codes

Specify the language field using a two-letter ISO 639-1 code (e.g., en, de, ja). This ensures the engine applies correct phonetic rules for the 23 supported languages, including Arabic, Chinese, and Swahili.

  • Supported codes include: en, de, fr, es, ja, ko, zh, ar, hi, ru, it, pt, tr, nl, pl, sv, fi, no, da, el, he, ms, sw

Auto-Detection Logic

If the language field is omitted, the system infers the language from the input text script. Latin script text defaults to English. For non-English Latin text, explicitly setting the language code is required to avoid default English pronunciation.

Speed and Language

Rate Limits

Sound wave illustration for: Rate Limits

Rate limits are enforced at 60 requests per minute per API key. This ceiling applies uniformly regardless of the model or audio format selected. Monitoring your usage dashboard provides visibility into consumption patterns and helps prevent unexpected throttling during high-volume generation tasks.

60 Requests Per Minute

Each active key processes up to 60 synthesis requests within a sliding one-minute window. Exceeding this threshold triggers a 429 Too Many Requests response. The limit resets continuously as older requests age out of the window, allowing steady throughput for batch processing jobs.

Initial Limit for New Keys

Newly created API keys start with a reduced limit of 10 requests per minute. This restriction remains active until the first top-up is processed. Once a minimum deposit of $5 USDT is confirmed on the TRON network, the key automatically upgrades to the standard 60 requests per minute capacity.

Queue Behavior

Requests exceeding the immediate processing capacity are queued and processed sequentially. Under heavy load, generation time may extend beyond the typical real-time speed of 25 characters per second. Each request is processed in the order received, ensuring deterministic billing and consistent audio output quality.

Error Handling

Sound wave illustration for: Error Handling

The API returns standard HTTP status codes to indicate request outcomes. A 200 OK response confirms successful audio synthesis, while 4xx errors signal client-side issues such as invalid parameters or authentication failures. A 5xx status indicates a transient server problem that may resolve upon retry.

Proper error handling ensures your integration remains robust during peak usage or when input data exceeds constraints. Always check the response body for detailed error messages to diagnose specific failures quickly.

Common HTTP Errors

Use standard HTTP codes to determine the nature of the failure. A 401 Unauthorized error occurs if the Bearer token is missing or invalid. A 404 Not Found indicates the endpoint is incorrect. A 500 Internal Server Error suggests a temporary backend issue, which you can retry with exponential backoff.

  • 401: Invalid or expired API key
  • 404: Incorrect endpoint path
  • 500: Temporary server error

Input Validation Errors

The API validates input text length and format before synthesis. If the input exceeds 4096 characters, a 400 Bad Request error is returned. Ensure the text is valid UTF-8 and that the specified voice and model exist in the /v1/voices list. Missing required fields such as 'input' or 'voice' will also trigger a 400 error with a descriptive message.

  • 400: Input exceeds 4096 characters
  • 400: Missing required field 'input'
  • 400: Invalid voice ID

Rate Limit Exceeded

Each API key is limited to 60 requests per minute. If this limit is exceeded, the API returns a 429 Too Many Requests error. New keys start with a lower limit of 10 requests per minute until the first top-up is processed. Implement a retry mechanism that respects the Retry-After header to avoid further throttling.

  • 429: Rate limit exceeded (60 req/min)
  • 429: New key limit (10 req/min)
  • Check Retry-After header

Example Implementations

Sound wave illustration for: Example Implementations

The following examples demonstrate direct integration with the LingvoFlow API, supporting both raw HTTP requests and the OpenAI SDK standard. These implementations handle character limits, format selection, and authentication headers required for language learning platforms.

cURL Command

Use this command to generate audio via the terminal. Replace YOUR_API_KEY with your generated key and adjust the --data payload as needed.

  • curl -X POST https://api.kriyabet.info/v1/audio/speech \
  • -H "Authorization: Bearer YOUR_API_KEY" \
  • -H "Content-Type: application/json" \
  • -d '{"model": "tts-1", "input": "Hello world", "voice": "nova", "response_format": "mp3"}' \
  • -o output.mp3

OpenAI SDK Configuration

Configure the OpenAI SDK by pointing it to our base URL. This allows you to use standard client methods while billing remains character-based.

  • from openai import OpenAI
  • client = OpenAI(api_key='YOUR_API_KEY', base_url='https://api.kriyabet.info/v1')
  • audio = client.audio.speech.create(
  • model='tts-1',
  • voice='nova',
  • input='Text to synthesize'

Python Script Example

This script demonstrates a complete request cycle, including error handling and file saving. Ensure you handle the 4096 character input limit by splitting longer texts in your application logic before sending requests.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Comparing core capabilities helps indie developers select the right engine for their language learning applications.

Avatar of the voice aria
ariafemale
Avatar of the voice nova
novafemale
Avatar of the voice luna
lunafemale
Avatar of the voice sage
sagefemale
Avatar of the voice felix
felixmale
Avatar of the voice milo
milomale
Avatar of the voice atlas
atlasmale
Avatar of the voice orion
orionmale

23 languages

Any voice speaks any of these languages.

Sources and further reading

  1. Wikipedia
  2. LibriTTS-R corpus (OpenSLR 141)
  3. curl documentation
  4. FFmpeg documentation
  5. LibriVox public-domain audiobooks
  6. W3C WAI: making audio and video accessible
  7. openai-python on GitHub
  8. IETF RFC 7845: Ogg Opus
  9. Tether (USDT)
  10. LibriTTS-R paper (arXiv 2305.18802)
  11. MDN: Web Speech API
  12. TRON developer hub: TRC-20

More on this site