API Documentation for AI Voice Generation

By VerbaLect editorial team · Updated 2026-11-19

This documentation guides teachers and methodologists through integrating VerbaLect’s text-to-speech API into their LMS workflows. You will learn how to convert lesson texts into clear, consistent audio files for online courses. The guide covers essential integration steps, from obtaining your API key to handling common errors, ensuring you can generate narration without hiring external voice actors.

We focus on concrete, practical steps using standard tools like cURL and the OpenAI SDK. You will find specific examples for handling long texts, managing rate limits, and choosing the right audio format. This page is designed for developers and educators who need reliable, neutral narration that fits seamlessly into their educational video production pipeline.

API Documentation for AI Voice Generation

Frequently asked questions

What is the API endpoint?

Send your text to POST https://api.sortealo.info/v1/audio/speech using a JSON body. You can also retrieve available voices and models via GET /v1/voices and GET /v1/models. The request shape matches the OpenAI speech endpoint, making integration straightforward for your LMS audio generation workflow.

How do I get an API key?

Visit /get-api-key/ to sign up using Google or an email and password. Your account page displays your active API key, current balance, and characters left. You can issue a new key at any time, which immediately stops the previous one, ensuring secure access to the TTS service.

Can I use the OpenAI SDK?

Yes, the official OpenAI SDKs work perfectly by changing the base_url to https://api.sortealo.info/v1. Use your site-specific key with the standard speech endpoint. This allows you to leverage familiar client libraries without writing custom HTTP code, streamlining the integration of voice narration into your educational content.

What audio formats are supported?

You can choose from mp3, wav, opus, flac, or pcm in the response_format field. These formats cover most LMS requirements, from lightweight web playback to high-quality archival storage. Select the format that best fits your course player’s capabilities and your storage constraints for generated audio files.

What is the character limit per request?

Each request accepts up to 4096 characters for the input text. If your lesson text exceeds this limit, split it into smaller parts. The API processes each chunk individually, allowing you to generate audio for longer scripts by handling multiple requests sequentially within your application logic.

How do I handle rate limits?

The limit is 60 requests per minute per key (10 per minute before your first top-up). Requests are processed sequentially, so under load, you may experience queue delays. Monitor your usage on the account page and adjust your submission frequency to stay within these bounds for smooth generation.

What happens if a request fails?

If synthesis fails, the charge is returned in full, so you are not billed for errors. Failed requests do not consume your character credit. This ensures that technical hiccups during audio generation do not impact your budget, allowing you to retry or debug without financial penalty.

How do I split long texts?

Split your text into segments of up to 4096 characters each. Send each segment as a separate POST request to the speech endpoint. Once you receive the audio files for all parts, join them in your LMS or application to create a continuous narration track for your course module.

First request

curl

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

Get Your API Key

Sound wave illustration for: Get Your API Key

To start using VerbaLect for your LMS modules, sign up on /get-api-key/ using either Google or your email and password. This creates an independent account for sortealo.info.

Once registered, you will receive a unique API key. You can find this key in your dashboard, where it is displayed alongside your balance and character usage.

Sign up on the site

Sign up on the site

Visit the registration page and choose Google or email authentication. Google sign-ups include a free trial credit, while email accounts start with zero balance.

Find your key in dashboard

Find your key in dashboard

Your dashboard shows your active key, current balance, and a ready-to-use cURL example. Use this key to authenticate your requests to the API.

Keep it secure

Keep your key private. You can issue a new key at any time, which immediately invalidates the old one, ensuring your integration remains secure.

First Request with cURL

Sound wave illustration for: First Request with cURL

Send a POST request to the API endpoint with your JSON payload. The request generates audio from your lesson text and returns the file directly in the response body.

This simple structure lets you integrate voice generation into your LMS pipeline without complex infrastructure changes.

Basic JSON body

The request body must be a valid JSON object containing the model, input text, and voice selection. Ensure the text does not exceed 4,096 characters.

You can optionally set the response format and speed. The API accepts standard OpenAI-compatible fields for easy integration.

  • Model: 'tts-1' or 'tts-1-hd'
  • Input: Your lesson text (max 4096 chars)
  • Voice: One of 8 available presets

Required fields

The 'model' field determines the engine quality. Both 'tts-1' and 'tts-1-hd' use the same engine and pricing.

The 'input' field contains the text to be converted. The 'voice' field specifies the narrator style, such as 'sage' for instructional content.

  • model: String ('tts-1' or 'tts-1-hd')
  • input: String (up to 4096 characters)
  • voice: String (e.g., 'sage', 'aria')

Response format

A successful request returns the audio file directly in the response body. The content type matches your requested format.

If the synthesis fails, you receive an error JSON object without any charge.

  • Success: Audio file binary data
  • Error: JSON error object
  • No charge on failure

Using OpenAI SDK

Sound wave illustration for: Using OpenAI SDK

The VerbaLect API follows the same request shape as the OpenAI speech endpoint, allowing you to reuse your existing OpenAI SDK clients with minimal changes. You only need to update the base URL to https://api.sortealo.info/v1 and swap in your VerbaLect key for authentication.

Change base_url

Point your OpenAI SDK client to the VerbaLect base URL. This ensures all standard speech generation calls route correctly to our TTS infrastructure without requiring a complete rewrite of your integration logic.

Use same SDK methods

Call the standard audio.speech.create method just as you would for OpenAI. Pass your text, selected voice, and desired format; the SDK handles the JSON payload and returns the audio file directly.

Easy migration

Since the API structure mirrors OpenAI, migrating your LMS audio generation pipeline requires only changing the endpoint and key. Your existing code for handling MP3 or WAV responses remains fully compatible.

Available Audio Formats

Sound wave illustration for: Available Audio Formats

The API returns audio in five distinct formats, allowing you to choose the best balance between file size and quality for your LMS modules. You can specify your preferred format using the response_format parameter in your API requests.

Selecting the right format ensures efficient delivery to students while maintaining clear narration for lesson content.

MP3 for web

MP3 is the standard choice for web playback. It offers a good balance between audio quality and small file size, making it ideal for embedding directly into course players or downloading by students.

This format is universally supported by modern browsers and mobile devices, ensuring smooth playback across all learning devices.

  • Best for general web delivery
  • Small file sizes for faster loading
  • Compatible with most LMS players

WAV for editing

WAV provides uncompressed, high-quality audio. It is the preferred format for methodologists who need to edit the generated narration further or integrate it into professional video production workflows.

The raw quality ensures no loss of detail when processing the audio through external editing software.

  • Uncompressed high fidelity
  • Ideal for post-production editing
  • No quality loss during processing

OPUS, FLAC, PCM

OPUS offers high-quality compression at very low bitrates, suitable for bandwidth-constrained environments. FLAC provides lossless compression, reducing file size without sacrificing any audio quality. PCM is raw, uncompressed audio data for maximum compatibility with specific hardware or legacy systems.

Choose OPUS or FLAC when storage space is a concern but quality remains critical. PCM is best when you need raw audio data for specialized processing.

  • OPUS: efficient compression for low bandwidth
  • FLAC: lossless compression for archiving
  • PCM: raw audio data for legacy systems

Rate Limits and Queues

Sound wave illustration for: Rate Limits and Queues

Our API enforces a standard rate limit of 60 requests per minute per API key. This limit applies uniformly to all users, ensuring consistent performance for your LMS audio generation workflows regardless of volume.

60 requests per minute

Once your account is active and funded, you can process up to 60 audio synthesis requests each minute. This capacity is sufficient for most educational content pipelines, allowing you to generate lesson audio in batches without significant delays.

10 requests before first top-up

New accounts start with a lower limit of 10 requests per minute. This applies until you make your first top-up. Once you add funds via USDT on the TRON network (TRC-20), your limit increases to the full 60 requests per minute immediately.

Queue processing

Requests are processed sequentially. If you send multiple requests rapidly, they may wait in a queue. Longer texts take more time to generate, so keep your batching strategies in mind to avoid unnecessary waiting during peak usage.

Rate Limits and Queues

Handling Errors

Sound wave illustration for: Handling Errors

Errors are common when integrating audio generation into automated LMS workflows. Understanding the specific response codes helps you handle failures gracefully without interrupting your lesson production pipeline.

Each error type has a distinct cause and a clear solution. By checking the response status and message, you can adjust your integration logic to keep your audio modules running smoothly.

Invalid API key

If your key is missing or incorrect, the API returns a 401 Unauthorized error. Ensure you are using the correct key from your dashboard and that it hasn’t been revoked after issuing a new one.

  • Check your dashboard for the current active key.
  • Verify the Authorization: Bearer header format.

Text too long

The API accepts a maximum of 4096 characters per request. If your input exceeds this limit, you will receive a 400 Bad Request error. You must split your lesson text into smaller chunks before sending them.

  • Count characters including spaces and punctuation.
  • Split text at logical sentence boundaries.

Rate limit exceeded

You are limited to 60 requests per minute for active accounts. If you exceed this, the API returns a 429 Too Many Requests error. New accounts start with a limit of 10 requests per minute until the first top-up.

  • Implement retry logic with exponential backoff.
  • Monitor your usage in the dashboard.

Splitting Long Texts

Sound wave illustration for: Splitting Long Texts

The API accepts up to 4096 characters per request, including spaces and punctuation. For longer lesson texts, split the input into chunks of this size and process each independently.

4096 character limit

Each API call processes a maximum of 4096 characters. If your script exceeds this, split the text into smaller segments before sending them to the endpoint.

Split and join audio

Generate audio files for each chunk separately. Once all segments are synthesized, join the resulting audio files to create a complete narration file for your LMS module.

Maintain flow

Split at natural sentence boundaries to ensure smooth transitions between segments. This approach preserves the natural pacing of the narration, avoiding abrupt cuts in your educational content.

Authentication Details

Sound wave illustration for: Authentication Details

Authentication is handled via a standard HTTP header. Include your unique API key in the Authorization field using the Bearer scheme. This token grants access to your account’s balance and usage limits.

Bearer token

Format the header as Authorization: Bearer tts-<your-key>. Ensure no extra spaces are included before or after the token string.

One active key per account

Each account maintains exactly one active API key at any time. If you generate a new key, the previous one becomes invalid immediately.

Revoke old keys

Since only one key is active, issuing a new one effectively revokes the old one. You do not need a separate deactivation step.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. All voices share the same engine, so switching styles does not affect quality or pricing.

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. LibriVox public-domain audiobooks
  3. IETF RFC 7845: Ogg Opus
  4. W3C WAI: making audio and video accessible
  5. FFmpeg documentation
  6. TRON developer hub: TRC-20
  7. Tether (USDT)
  8. MDN: Web Speech API
  9. Creative Commons Attribution 4.0
  10. openai-python on GitHub
  11. ISO 639 language codes
  12. Node.js documentation

More on this site