Python TTS API Documentation for Developers

By VoiceLingo editorial team · Updated 2026-11-19

This documentation provides a practical, step-by-step guide for indie developers integrating VoiceLingo’s text-to-speech API into language learning applications. You will learn how to authenticate, generate audio files, and handle common edge cases using standard Python libraries. The guide focuses on concrete examples, specific parameter ranges, and real-world workflows to help you deliver clear, high-quality speech to your users without unnecessary complexity.

We cover everything from generating your API key to selecting the right voice preset for educational content. You will see exactly how to format requests, understand rate limits, and manage character counts for longer texts. Whether you are building a simple quiz app or a complex course platform, this page gives you the precise technical details needed to implement TTS functionality quickly and reliably.

Python TTS API Documentation for Developers

Frequently asked questions

What is the API endpoint?

The endpoint is POST https://api.fodmod.info/v1/audio/speech. Send a JSON body with your text, voice selection, and format preferences. The request shape matches the OpenAI speech endpoint, allowing you to use existing client libraries by simply adjusting the base URL configuration.

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email. Your account key appears on the dashboard alongside your balance and usage stats. You can issue a new key at any time, which immediately invalidates the previous one.

What is the base URL?

The base URL is https://api.fodmod.info/v1. Configure your SDK or HTTP client to use this URL. All requests, including speech synthesis and voice listing, are routed through this base path for the VoiceLingo API.

Which SDK should I use?

Use the official OpenAI SDK or plain HTTP. We do not provide a dedicated VoiceLingo SDK. The OpenAI SDK works seamlessly by changing the base_url to our API endpoint, making integration straightforward for Python developers.

Can I use the OpenAI SDK?

Yes, the OpenAI SDK works perfectly. Change the base_url to https://api.fodmod.info/v1 and use your VoiceLingo API key. This allows you to leverage familiar Python libraries for making requests to our text-to-speech endpoint.

What models are available?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and pricing. Select either based on your preference, as they deliver identical audio quality and performance characteristics for your language learning application.

What is the difference between tts-1 and tts-1-hd?

There is no functional difference between tts-1 and tts-1-hd. They use the same engine and have the same price. You can use either model interchangeably without affecting the output quality or your billing rate.

What voices are available?

Eight voices are available: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, and Orion. Each voice can speak all 23 supported languages. Select the voice that best fits the tone of your educational content.

How do I set the speed?

Include the speed parameter in your JSON body, with values between 0.25 and 4.0. This allows you to adjust the playback rate of the generated audio. Default speed is applied if you omit this field.

What response formats are supported?

Supported formats are mp3, wav, opus, flac, and pcm. Specify your preferred format in the response_format field. This gives you flexibility in handling audio files within your language learning app depending on your storage and playback needs.

What are the rate limits?

The limit is 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. Exceeding this limit will result in errors until the window resets or you upgrade your account status.

What happens if I exceed limits?

Requests are processed sequentially. If you exceed the limit, requests may wait in a queue or return an error. Failed requests are free, so you are not charged for audio that does not generate successfully.

How do I handle errors?

Check the HTTP status code and response body for error details. Failed synthesis requests are free, and charges are returned in full if synthesis fails. Implement retry logic with exponential backoff for transient network or queue issues.

Is the API RESTful?

Yes, the API is RESTful. It uses standard HTTP methods like POST for speech generation and GET for retrieving voices and models. It returns JSON responses, making it easy to integrate with standard web development workflows.

First request

curl

curl https://api.fodmod.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.fodmod.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.fodmod.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 and Keys

Sound wave illustration for: Authentication and Keys

To begin using VoiceLingo, visit the /get-api-key/ page on fodmod.info. Sign in with your Google account or create a standard email/password account. The dashboard immediately displays your unique API key and current balance.

Keep this key secure. It authenticates all requests to the API. If needed, you can issue a new key at any time via the same dashboard; the previous key stops working instantly.

Generate your API key from /get-api-key/

Generate your API key from /get-api-key/

Navigate to the /get-api-key/ page to create your account. You can sign up using Google for immediate access or use a standard email and password combination. Upon registration, the interface displays your active API key alongside your current balance and usage statistics.

Use Bearer token in Authorization header

Use Bearer token in Authorization header

Include your API key in the HTTP header for every request. Use the format Authorization: Bearer tts-... where tts-... is your specific key string. This header authenticates your requests to the endpoint https://api.fodmod.info/v1.

One active key per account at a time

Each account maintains only one active API key. If you generate a new key from the dashboard, the old key is immediately invalidated. This ensures that your usage and billing remain tied to a single credential.

First Request with cURL

Sound wave illustration for: First Request with cURL

You can verify the API quickly with a simple cURL command. Send a POST request to the speech endpoint with your API key in the Authorization header. This method works immediately without installing any libraries.

Basic POST request example

Use this command to generate audio. Replace YOUR_API_KEY with your key from /get-api-key/. The request sends JSON data to the endpoint.

  • Endpoint: POST https://api.fodmod.info/v1/audio/speech
  • Header: Authorization: Bearer YOUR_API_KEY
  • Body: JSON with model, input, and voice

Required fields: model, input, voice

Every request must include three fields. The model is either tts-1 or tts-1-hd. The input text cannot exceed 4096 characters. Choose a voice from the eight presets.

  • model: tts-1 or tts-1-hd
  • input: your text string
  • voice: e.g., aria, nova, felix

Receiving audio file response

The API returns the audio file directly in the response body. You can save this output to a file for playback. Supported formats include mp3, wav, opus, flac, and pcm.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

VoiceLingo integrates seamlessly with the official OpenAI Python SDK, allowing you to use familiar methods while routing requests to our TTS infrastructure. This approach lets you leverage standard libraries without learning a new client.

By overriding the default base URL, you direct all speech synthesis calls to VoiceLingo’s endpoints. This ensures compatibility with existing code structures while accessing our specific voice models and pricing.

Install the official OpenAI Python SDK

Install the standard library using pip. The official SDK handles the HTTP communication, so you do not need to write raw request logic.

  • pip install openai

Set base_url to api.fodmod.info/v1

Initialize the client by passing your API key and setting the base URL to our API endpoint. This redirects all standard speech operations to VoiceLingo.

Use standard speech.create() method

Call the standard speech.create() method with your desired parameters. The SDK handles the POST request to /v1/audio/speech and returns the audio file.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts text up to 4096 characters per request. For longer content, split the input into chunks and join the resulting audio files.

The language parameter is optional; if omitted, the system guesses the language from the script (defaulting to English for Latin text). Explicitly setting it ensures accuracy for non-English Latin-script text.

Model: tts-1 or tts-1-hd

Both models use the same underlying engine and pricing. Select tts-1 for standard generation or tts-1-hd for higher fidelity. The choice does not affect cost or speed.

Voice: choose from 8 presets

Select from eight distinct voices optimized for educational clarity. Female options include Aria (warm narrator), Nova (bright), Luna (soft storytelling), and Sage (calm instruction). Male options are Felix (energetic promo), Milo (friendly), Atlas (neutral news), and Orion (deep documentary).

  • Voices are licensed from LibriTTS-R (CC BY 4.0) and LibriVox public-domain readings.
  • Each generated audio file contains an inaudible watermark marking it as synthetic speech.

Speed: range 0.25 to 4.0

Adjust playback speed between 0.25 and 4.0 to suit your app's needs. Typical generation speed is roughly real-time (25 characters per second). Short phrases may take a few seconds to process.

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in MP3, WAV, FLAC, or OPUS formats via the response_format parameter. MP3 is the standard choice for web-based language learning applications, offering a balance between file size and acceptable audio quality for mobile and desktop browsers.

MP3 for web streaming compatibility

MP3 is ideal for delivering audio directly in the browser. Most language learning platforms rely on standard HTML5 audio players that handle MP3 files natively, ensuring broad compatibility across devices without requiring additional codecs.

WAV for high-quality local storage

Use WAV for uncompressed audio storage when you need to cache files locally on user devices. This format preserves the full fidelity of the synthesis engine, which is useful for offline language practice apps that require consistent playback quality.

FLAC for lossless archival

FLAC provides lossless compression, reducing file size while maintaining bit-perfect audio data. This is suitable for educational archives where you need to preserve the exact synthesized output for review or further processing without generational loss.

Response Formats

Handling Errors

Sound wave illustration for: Handling Errors

When your API integration fails, the error response includes a code and message that helps you resolve the issue quickly. Common problems involve authentication, input length, and rate limits. Understanding these responses ensures your language learning app handles TTS requests gracefully without crashing or hanging indefinitely.

Invalid API key errors

If the key is missing or incorrect, the API returns a 401 Unauthorized error. Ensure your Authorization: Bearer header contains the exact key from your dashboard. Keys are case-sensitive and must not include extra spaces.

  • Check the key in /get-api-key/ dashboard
  • Verify the Authorization header format
  • Regenerate key if compromised

Input text too long errors

Each request supports up to 4096 characters. If your text exceeds this limit, split it into smaller chunks before sending. The API does not automatically truncate text, so exceeding the limit results in a 400 Bad Request error.

  • Max 4096 characters per request
  • Split long texts into parts
  • Join audio files manually

Rate limit exceeded errors

The limit is 60 requests per minute per key (10 before top-up). Exceeding this returns a 429 Too Many Requests error. Implement exponential backoff in your code to retry after the queue clears.

  • 60 requests/minute limit
  • 10 requests/minute before top-up
  • Use exponential backoff for retries

Rate Limits and Queues

Sound wave illustration for: Rate Limits and Queues

To ensure fair usage, the API enforces a rate limit of 60 requests per minute per API key. This limit applies uniformly regardless of text length, allowing developers to batch generate audio efficiently without exceeding the threshold.

Before any top-up, new accounts operate under a stricter limit of 10 requests per minute. This baseline ensures stability during the free trial period while providing sufficient capacity for initial testing and small-scale language learning app integrations.

60 requests per minute per key

After topping up your balance, your quota increases to 60 requests per minute. This higher limit supports sustained audio generation for language learning applications, accommodating multiple user requests or batch processing of vocabulary lists.

10 requests per minute before top-up

Accounts without a top-up are restricted to 10 requests per minute. This constraint is designed for the free trial phase, allowing developers to verify the API's quality and integration workflow before committing to paid usage.

Requests processed in queue order

Requests are processed sequentially in the order they are received. During periods of high load, a request may wait in a queue before synthesis begins. This ensures orderly processing and prevents resource contention, though it means longer texts may take time to generate.

Voice Selection Guide

Sound wave illustration for: Voice Selection Guide

VoiceLingo provides eight distinct voice presets optimized for educational content. Female voices include Aria (warm narrator), Nova (bright and upbeat), Luna (soft storyteller), and Sage (calm instructor). Male options feature Felix (energetic promo), Milo (conversational), Atlas (neutral news), and Orion (deep documentary).

Female voices: aria, nova, luna, sage

Aria offers a warm, clear narration style ideal for textbook reading. Nova provides a bright, upbeat tone suitable for interactive exercises. Luna’s soft delivery works well for storytelling segments, while Sage’s calm, instructional tone suits direct teaching content.

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional

Male voices: felix, milo, atlas, orion

Felix delivers an energetic, promo-style voice perfect for quick quizzes or announcements. Milo sounds friendly and conversational, suitable for dialogue practice. Atlas provides a neutral, news-like tone for clear information delivery. Orion’s deep voice is ideal for documentary-style educational content.

  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Matching voice tone to content type

Match voice character to lesson type for better learner engagement. Use Luna for stories and Milo for conversational drills. Select Sage or Atlas for clear instructional material. Ensure the voice tone aligns with the educational goal, whether it is passive listening or active participation.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This extensive catalog allows indie developers to build apps for niche linguistic markets without needing multiple providers.

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. FFmpeg documentation
  3. openai-python on GitHub
  4. openai-node on GitHub
  5. Node.js documentation
  6. MDN: Web Speech API
  7. Creative Commons Attribution 4.0
  8. LibriVox public-domain audiobooks
  9. IETF RFC 7845: Ogg Opus
  10. Tether (USDT)
  11. curl documentation
  12. LibriTTS-R paper (arXiv 2305.18802)

More on this site