API Documentation for Audiobook Generation

By Lectia editorial team · Updated 2026-11-19

Welcome to the Lectia API documentation. This guide helps product teams integrate natural-sounding audiobook generation directly into their online courses and LMS platforms. You will find clear instructions on how to turn your text content into high-quality audio files at scale, without needing human voice actors.

We cover essential integration steps, from authentication and endpoint usage to rate limits and error handling. The documentation assumes you are familiar with basic HTTP requests and can use tools like cURL or the OpenAI SDK. If you are building accessible, long-form audio content, this page provides the specific technical details you need to get started quickly.

API Documentation for Audiobook Generation

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email plus password. The dashboard displays your active API key, balance, and usage statistics. You can issue a new key at any time, which immediately invalidates the previous one.

What is the base URL?

The API base URL is https://api.f9999.info/v1. You send POST requests to https://api.f9999.info/v1/audio/speech. Other endpoints like /v1/voices and /v1/models are also available at this base path.

Which models are available?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and have identical pricing. Select either model in your request body to generate audio files.

How do I select a voice?

Choose from eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. Pass the chosen voice name in the request body. Each voice has a distinct tone, from warm narration to deep documentary styles.

What is the character limit?

Each request accepts up to 4096 characters of input text. For longer content, split your text into chunks of this size. You must join the resulting audio files manually after generation.

How do I handle errors?

Failed requests are free, and the charge is returned in full if synthesis fails. Check the response status code. If an error occurs, review your input parameters like voice or model validity.

What is the rate limit?

You are limited to 60 requests per minute per key. New accounts start with a 10 requests per minute limit until the first top-up is processed. Requests are processed sequentially, so load may cause queuing.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Configure your OpenAI SDK by changing the base_url to https://api.f9999.info/v1 and using your site-specific API key for authentication.

What audio formats are supported?

Supported formats include mp3, wav, opus, flac, and pcm. Specify your preferred format in the response_format field of the JSON request body. The API returns the audio file directly in the response.

How do I change the speed?

Adjust the speed parameter between 0.25 and 4.0. This allows you to slow down or speed up the narration. The default speed is 1.0, but you can customize it per request.

Is the language parameter required?

No, it is optional. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language to ensure accurate pronunciation.

How do I split long texts?

Split your input text into parts of up to 4096 characters. Send each part as a separate request to the speech endpoint. After receiving all audio files, join them to create the final long-form audio.

What is the response format?

The API returns the generated audio file directly in the response body. The content type matches the requested format (e.g., audio/mpeg for mp3). You receive the binary audio data ready for playback or storage.

How do I regenerate a key?

Issue a new key from your account dashboard at any time. The new key becomes active immediately, and the old key stops working at once. This allows you to rotate credentials securely without downtime.

First request

curl

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

Lectia’s API uses a single active bearer token per account. You generate this key on the /get-api-key/ page after signing in with Google or email. It authenticates all requests to the TTS engine.

API Key

API Key

Your API key is a string starting with tts-. It is the only credential needed to access the endpoint. Keep it secure, as it controls your billing and usage limits.

  • Starts with tts-
  • One active key per account
  • Displayed on your dashboard

Bearer Token

Bearer Token

Include the key in the HTTP header: Authorization: Bearer tts-.... This standard format works with the OpenAI SDKs and any standard HTTP client. Ensure no extra spaces are included in the header value.

  • Format: Bearer tts-your-key-here
  • Case-sensitive header name
  • Standard OAuth 2.0 style

Key Management

You can issue a new key at any time from your account page. The old key stops working immediately. This is useful if you suspect a leak or rotate credentials between development and production environments.

  • Instant invalidation of old keys
  • Generate new keys anytime
  • No downtime during rotation

Endpoints

Sound wave illustration for: Endpoints

The Lectia API provides three core endpoints to manage your audiobook generation workflow. You interact with the speech endpoint to convert text into audio, retrieve available voices via the voices endpoint, and check model details with the models endpoint. All endpoints require a valid Bearer token in the Authorization header.

Speech Endpoint

Use POST https://api.f9999.info/v1/audio/speech to generate audio. Send a JSON body with your text, selected voice, and desired format. The API returns the audio file directly in the response, allowing you to save it immediately.

  • Endpoint: POST /v1/audio/speech
  • Accepts JSON body with input, voice, and response_format

Voices Endpoint

Call GET https://api.f9999.info/v1/voices to list all available voices, their associated languages, and supported audio formats. This helps you choose the right narrator for your course content without guessing supported parameters.

  • Endpoint: GET /v1/voices
  • Returns voice ID, name, gender, and supported languages

Models Endpoint

Use GET https://api.f9999.info/v1/models to retrieve the current list of available models, such as tts-1 and tts-1-hd. This ensures your requests use valid model identifiers and helps you track any updates to the underlying engine.

  • Endpoint: GET /v1/models
  • Returns model ID and name

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts plain text input to generate natural-sounding speech for your audiobooks or courses. You define the output style and format through specific parameters, ensuring the audio matches your content's tone and technical requirements.

Each request is processed individually, so long texts should be split into chunks of up to 4096 characters. The system joins the resulting audio files seamlessly, maintaining consistent pacing across your entire narrative.

Model Selection

Choose between tts-1 for standard quality or tts-1-hd for higher fidelity. Both models use the same engine and pricing, allowing you to switch based on your need for detail versus generation speed.

Higher definition audio is ideal for complex narration where subtle vocal nuances matter, such as educational courses or dramatic readings.

  • tts-1: Standard quality, faster generation.
  • tts-1-hd: High definition, detailed vocal expression.

Input Text

Pass your script via the input field, limited to 4096 characters per request. Spaces and punctuation count toward this limit.

For longer content, split your text into smaller segments and concatenate the resulting audio files to create a continuous audiobook.

The system guesses the language from the script; set the language parameter explicitly if you are using Latin script for non-English languages like Dutch or Polish.

  • Max 4096 characters per request.
  • Includes spaces and punctuation in the count.
  • Set language for non-English Latin text.

Voice Selection

Select from eight distinct voices, ranging from warm narrators to energetic promotional styles. Each voice is based on licensed recordings and carries an inaudible watermark.

Choose aria for clear storytelling or atlas for neutral news-style delivery. All voices support any of the 23 supported languages.

Use the speed parameter (0.25–4.0) to adjust pacing, ensuring your content fits perfectly within your course timeline.

  • 8 presets available: aria, nova, luna, sage, felix, milo, atlas, orion.
  • All voices support all 23 languages.
  • Adjustable speed from 0.25x to 4.0x.

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in the format you specify via the response_format parameter. Supported formats include MP3, WAV, FLAC, OPUS, and PCM. Each format balances file size, quality, and compatibility differently, allowing you to choose the best fit for your audiobook or course delivery pipeline.

MP3

MP3 is the most widely supported format for web players and mobile apps. It offers a good balance between file size and audio quality, making it ideal for playback of narrated courses or audiobooks.

  • Best for web and mobile playback
  • Small file sizes reduce bandwidth costs
  • Universal compatibility across devices

WAV

WAV provides uncompressed, high-fidelity audio. Use this format when you need pristine quality for editing or archiving narrated materials. It is larger than MP3 but ensures no loss of audio detail during playback or further processing.

  • Uncompressed, lossless quality
  • Ideal for editing and archiving
  • Larger file sizes

FLAC

FLAC offers lossless compression, providing the same audio quality as WAV but with smaller file sizes. It is suitable for distribution where quality is critical but storage space is a concern, such as in premium audiobook packages.

  • Lossless compression
  • Smaller than WAV, same quality
  • Good for premium audio distribution

Rate Limits

Sound wave illustration for: Rate Limits

Each API key supports a standard limit of 60 requests per minute. This cap ensures fair usage and stable generation speeds for your audiobook and course production workflows.

60 RPM

The standard rate limit allows 60 requests per minute per key. This throughput is sufficient for most batch processing needs, such as generating chapters for online courses or narrating e-books efficiently.

Initial Limit

New accounts start with a lower limit of 10 requests per minute. This initial cap applies until you complete your first top-up. Once a transfer is confirmed, the full 60 RPM limit becomes active immediately.

Queue Handling

Requests are processed sequentially. Under load, additional requests may wait in a queue rather than being rejected. Typical generation speed is roughly real-time, so long texts process steadily without blocking other requests unnecessarily.

Rate Limits

Error Handling

Sound wave illustration for: Error Handling

The API returns standard HTTP status codes to indicate request outcomes. A 200 OK means your audio file is ready in the response body. If the service is temporarily overloaded, you may receive a 429 Too Many Requests error, reflecting the per-key rate limit of 60 requests per minute.

Common Errors

Most errors stem from invalid inputs or exceeding limits. Ensure your text does not exceed 4096 characters per request. If a synthesis failure occurs, the charge is returned in full, so failed requests do not deplete your balance.

Retry Logic

Implement exponential backoff for transient errors. Since requests are processed sequentially under load, a 429 error may persist briefly. Wait a few seconds before retrying to avoid queue congestion.

Status Codes

200: Success. 400: Bad Request (invalid JSON or missing fields). 401: Unauthorized (invalid API key). 429: Rate limit exceeded (max 60 RPM).

OpenAI SDK

Sound wave illustration for: OpenAI SDK

Integrate our TTS API using the official OpenAI SDK by simply adjusting the base URL. Point your client to https://api.f9999.info/v1 and use your tts-... Bearer token. This allows your existing code to work without major refactoring, ensuring a smooth transition for product teams building narrated courses.

The standard openai Python or Node.js packages handle the request shape identically to the OpenAI speech endpoint. You only need to supply the correct base_url and your API key. This approach leverages familiar SDK structures, reducing integration friction for developers already accustomed to standard TTS workflows.

Base URL Change

Update your SDK client configuration to point base_url at https://api.f9999.info/v1. This single change directs all requests to our infrastructure while maintaining the expected JSON body structure. Ensure your Authorization header includes your unique tts-... key for authentication.

SDK Compatibility

The API supports the same request parameters as the OpenAI speech endpoint, including model, input, voice, response_format, and speed. Standard SDKs handle the file parsing automatically, making it easy to generate audio files for long-form audiobooks or course modules without custom parsing logic.

Example Code

  • Initialize the OpenAI client with base_url='https://api.f9999.info/v1'
  • Pass your API key via api_key='tts-...'
  • Call client.audio.speech.create() with your text and voice selection
  • Save the resulting audio file to your LMS or storage bucket

cURL Example

Sound wave illustration for: cURL Example

Use cURL to quickly verify your API key and generate audio. This method requires no SDK installation, making it ideal for initial testing or lightweight scripts.

The example below demonstrates a standard request for a short narration. Adjust the voice and format parameters to match your specific audiobook or course requirements.

Basic Request

Send a POST request to the speech endpoint with your text and desired parameters. The system processes the text synchronously, returning the audio file directly in the response body.

Headers

Include your API key in the Authorization header using the Bearer scheme. Ensure the Content-Type is set to application/json for proper request parsing.

  • Authorization: Bearer tts-your-api-key-here
  • Content-Type: application/json

Response

On success, you receive the audio file binary data directly. Failed requests return a JSON error object with details, and no charge is applied for the character count.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Her pacing works well for quick tips, feature introductions, or engaging marketing-style course segments where energy is key.

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. Creative Commons Attribution 4.0
  3. openai-node on GitHub
  4. Node.js documentation
  5. OpenAI API reference: create speech
  6. TRON developer hub: TRC-20
  7. Tether (USDT)
  8. LibriTTS-R corpus (OpenSLR 141)
  9. FFmpeg documentation
  10. ISO 639 language codes
  11. openai-python on GitHub
  12. Python documentation

More on this site