Frequently asked questions
How do I get an API key?
Sign up on the /get-api-key/ page using Google or an email and password combination. The account page displays your active API key, balance, and usage statistics. Each account holds one active key; issuing a new one immediately invalidates the previous one.
What is the base URL for requests?
The API base URL is https://api.pklal.info/v1. You send POST requests to https://api.pklal.info/v1/audio/speech. Other endpoints include GET /v1/voices for voice details and GET /v1/models. Use this base URL for all API interactions.
Can I use the OpenAI SDK?
Yes, the official OpenAI SDKs work by changing the base_url to https://api.pklal.info/v1. Use the standard speech endpoint with your LMS Voice API key. The request shape matches the OpenAI speech endpoint exactly, ensuring straightforward integration for developers.
What are the rate limits?
The limit is 60 requests per minute per key. Before the first top-up, the limit is 10 requests per minute. Requests are processed sequentially, so under load, a request may wait in a queue. Exceeding limits may result in delays.
How many characters can I send?
Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. For texts exceeding this length, split the content into parts and join the resulting audio files after synthesis completes successfully.
What voices are available?
There are eight presets: aria, nova, luna, sage, felix, milo, atlas, and orion. Voices are based on licensed recordings from LibriTTS-R and LibriVox. Every file carries an inaudible watermark marking it as synthetic speech. Select one via the voice parameter.
How do I specify a language?
Set the optional language parameter to an ISO code. If omitted, the system guesses the language, defaulting to English for Latin script. For non-English Latin text, explicitly set the language to ensure correct synthesis and avoid misidentification.
What happens if the request fails?
Failed requests are free. If synthesis fails, the charge is returned in full. No characters are deducted from your balance. You can retry the request or split the text differently without incurring additional costs for the failed attempt.
Is streaming supported?
No, streaming is not supported. The API returns the complete audio file in the response. There is no WebSocket or real-time partial audio delivery. You must wait for the full file generation before processing or storing the audio.
Can I adjust the speaking speed?
Yes, you can adjust the speed between 0.25 and 4.0. This parameter allows you to slow down or speed up the narration. The default speed is 1.0. Adjusting speed affects the duration of the generated audio file.
What formats are returned?
You can request mp3, wav, opus, flac, or pcm formats. Specify the desired format using the response_format parameter. The API returns the audio file directly in the response body, ready for download or immediate playback in your LMS.
How do I handle long texts?
Split texts into parts of up to 4096 characters. Send each part as a separate request and join the resulting audio files. This approach ensures efficient processing and avoids exceeding the character limit per request while maintaining audio continuity.
Is SSML supported?
No, SSML is not supported. The API accepts plain text input only. There is no support for SSML tags, phoneme dictionaries, or custom pronunciation lexicons. Format your text as plain string input for the synthesis engine to process.
How do I rotate my API key?
Issue a new key from the account page at any time. The new key becomes active immediately, and the old one stops working at once. This allows seamless rotation without downtime. Ensure your application updates to use the new key.
First request
curl
curl https://api.pklal.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.pklal.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.pklal.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 and Keys
Access to the LMS Voice API requires a valid bearer token, issued per account on the /get-api-key/ dashboard. Each account holds one active key; the header Authorization: Bearer tts-... must accompany every request to the base URL https://api.pklal.info/v1. Keys are tied to the specific site domain and do not transfer between storefronts.
API Key Generation
Generate a key via the /get-api-key/ page using Google sign-in or email registration. The dashboard displays the current key, balance, and usage statistics. Only one key remains active at any time.
- Generate via /get-api-key/ page
- Supports Google or email registration
- One active key per account
Bearer Token Usage
Include the key in the HTTP header as Authorization: Bearer [your_key]. The API validates this token against the account’s active credential set. Incorrect or expired tokens result in a 401 Unauthorized response.
- Header: Authorization: Bearer tts-...
- Validates against active account key
- Returns 401 if invalid
Key Rotation
Issue a new key via the dashboard at any time. The previous key stops working immediately upon generation of the new one. No downtime occurs during rotation if you update your integration promptly.
- Issue new key via dashboard
- Old key invalidates immediately
- No downtime if updated promptly
Quickstart with cURL
The API accepts text via a simple POST request. Send your course content to the speech endpoint with the appropriate model and voice parameters to receive an audio file directly in the response.
Basic Request
Use the following cURL command to generate speech. Replace YOUR_API_KEY with your key from the dashboard. The request sends the text Hello, this is a test of the LMS Voice API. using the tts-1 model and the nova voice.
- Endpoint:
https://api.pklal.info/v1/audio/speech - Method:
POST - Content-Type:
application/json
Response Format
A successful request returns the audio file directly in the response body with the specified response_format (e.g., mp3, wav). Headers include Content-Type matching the requested format. Failed requests return a JSON error object with a status code and message, ensuring no character count is deducted for errors.
Error Codes
Common errors include 401 Unauthorized for invalid keys and 429 Too Many Requests if you exceed the 60 requests per minute limit. A 400 Bad Request indicates invalid parameters, such as text exceeding 4096 characters. These errors return a JSON body detailing the issue without charging your balance.
Integration with OpenAI SDK
The API mirrors the OpenAI speech endpoint structure, allowing developers to reuse existing integration logic with minimal adjustments. By pointing the client to the correct base URL, you can leverage standard HTTP libraries or the official OpenAI SDK for Python and Node.js without custom parsing.
Base URL Configuration
Set the API base URL to https://api.pklal.info/v1 in your client configuration. This directs requests to the LMS Voice API endpoint while maintaining the standard /v1/audio/speech path for synthesis.
Client Initialization
Initialize the OpenAI SDK client using your API key obtained from the dashboard. Ensure the base_url parameter is explicitly defined to override the default OpenAI endpoint, ensuring all subsequent calls route correctly to the TTS service.
- Use standard Bearer token authentication.
- Set
base_urltohttps://api.pklal.info/v1.
Compatibility Notes
The request payload matches the OpenAI speech schema exactly. Fields such as model, input, voice, response_format, and speed are supported directly. This ensures compatibility with existing codebases that already interact with OpenAI-style TTS endpoints.
Voice and Language Parameters
The API provides eight distinct voice presets suitable for educational content, ranging from warm narrators to neutral news readers. Each voice is generated from licensed recordings and carries an inaudible synthetic watermark.
Voice Selection
Select a voice by passing its name in the voice field. Available options include female voices (aria, nova, luna, sage) and male voices (felix, milo, atlas, orion). All voices support the full range of 23 languages without additional configuration.
- aria: warm, clear narrator
- nova: bright, upbeat
- luna: soft, storytelling
- sage: calm, instructional
- felix: energetic, promo
- milo: friendly, conversational
Language Code
Pass the ISO language code (e.g., en, de, ru) to the language parameter. While the system guesses language from script, explicit codes ensure accuracy for non-English Latin text. Only 23 specific languages are supported.
- Arabic, Chinese, Danish, Dutch
- English, Finnish, French, German
- Greek, Hebrew, Hindi, Italian
- Japanese, Korean, Malay, Norwegian
- Polish, Portuguese, Russian, Spanish
- Swahili, Swedish, Turkish
Speed Adjustment
Adjust playback speed between 0.25 and 4.0 using the speed parameter. This allows methodologists to optimize audio for lecture pacing or accessibility needs without re-generating the file.
Request Limits and Throttling
Each API key allows 60 requests per minute, but new accounts start with a limit of 10 requests per minute until the first top-up is processed. This restriction ensures stable processing during the initial trial period, which provides $0.50 of credit valid for seven days.
Rate Limit Specs
The standard limit is 60 requests per minute per key. Requests are processed sequentially, meaning under heavy load a request may wait in a queue before synthesis begins. This sequential processing ensures consistent audio quality but can increase latency for bulk conversions.
- Standard limit: 60 requests/minute
- Initial limit: 10 requests/minute
- Limit resets after first top-up
- One active key per account
Queue Behavior
Requests are handled one after another. If you send multiple requests rapidly, they will be queued. Short phrases take a few seconds to generate, while longer texts process at roughly real-time speed (25 characters per second).
Retry Logic
Implement exponential backoff for transient errors. Failed requests are free, so retrying immediately after a 5xx error is safe. For rate limit errors (429), wait briefly before retrying to avoid overwhelming the queue.
- Retry on 429 or 5xx
- Use exponential backoff
- Failed requests incur no charge

Audio Output Formats
The API accepts mp3, wav, op, flac, and pcm as valid values for the response_format field. These formats cover most LMS audio requirements, from compressed web delivery to uncompressed archival storage.
MP3 Options
MP3 is a supported format and offers a good balance between compression and compatibility. It is suitable for standard web playback in most Learning Management Systems.
WAV Options
WAV provides uncompressed audio, ensuring maximum fidelity for educational materials where lossless quality is required. It is larger in file size but universally supported.
Opus and FLAC
Opus and FLAC are also supported. FLAC offers lossless compression for efficient storage, while Opus provides low-latency streaming capabilities. PCM is available for raw audio processing.
Handling Long Texts
Text exceeding 4,096 characters must be divided into smaller segments before submission to the API. Each segment is processed independently, ensuring that the input size constraint is strictly respected for every request.
Character Splitting
Split the input text at logical boundaries, such as sentence endings, to maintain audio coherence. Each part must not exceed 4,096 characters, including spaces and punctuation. This ensures consistent processing and avoids truncation errors.
Audio Joining
The API returns individual audio files for each text segment. Your application must concatenate these files in the correct sequence to reconstruct the full audio. Supported formats like MP3, WAV, and FLAC allow for straightforward concatenation using standard libraries.
Memory Management
Handle temporary audio files efficiently during the join process. Since requests are processed sequentially, buffer sizes should be optimized to prevent memory spikes. Release temporary resources promptly after concatenation to maintain stable performance during bulk generation tasks.
Error Handling and Status Codes
The API returns standard HTTP status codes to indicate request outcomes. Understanding these codes allows developers to handle failures gracefully within their LMS workflows without unnecessary manual intervention.
4xx Errors
Client errors typically indicate issues with the request structure or authentication. A 401 Unauthorized response occurs if the Bearer token is invalid or expired. A 429 Too Many Requests response appears when the per-key limit of 60 requests per minute is exceeded.
- 400: Invalid JSON body or missing required fields.
- 401: Invalid or missing Authorization header.
- 429: Rate limit exceeded (60 req/min).
5xx Errors
Server errors, such as 500 Internal Server Error, indicate temporary issues with the synthesis engine. These errors do not consume your character balance. The API guarantees a full refund of any attempted charge if the synthesis process fails before completion.
- 500: Internal server error during processing.
- 503: Service temporarily unavailable due to high load.
Retry Strategy
Implement exponential backoff for 429 and 5xx errors. Since requests are processed sequentially under load, a failed request may simply need to wait in the queue. Retry up to three times with increasing delays to ensure stable integration with your course generation pipelines.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. The quality relies on licensed recordings from LibriTTS-R and LibriVox.
23 languages
Any voice speaks any of these languages.
