Text-to-Speech API Quickstart: Integration & Pricing

By SpeakLingo editorial team · Updated 2026-11-19

This guide helps product teams quickly integrate SpeakLingo’s text-to-speech API into language learning and audiobook workflows. You will learn how to generate high-quality audio files from text using standard HTTP requests or the OpenAI SDK, ensuring consistent natural voices across your application.

We cover authentication, endpoint usage, and parameter details like voice selection and audio formats. You will also find practical code examples for cURL and Python, along with clear explanations of rate limits and error handling to streamline your development process.

Text-to-Speech API Quickstart: Integration & Pricing

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. The dashboard displays your active key, balance, and usage. You can issue a new key at any time, which immediately invalidates the old one. Each account on jlmaam.top maintains one active key for authentication.

What is the base URL for the API?

The API base URL is https://api.jlmaam.top/v1. You send POST requests to https://api.jlmaam.top/v1/audio/speech. Other endpoints like /voices and /models are also available at this base path. This structure allows standard HTTP clients and SDKs to connect easily.

How do I specify the voice?

Include the voice field in your JSON request body with one of the eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. You can also optionally set the language field to an ISO code. If omitted, the system guesses the language from the text script.

What are the supported audio formats?

You can request audio in mp3, wav, opus, flac, or pcm formats by setting the response_format field. These options cover most use cases for language learning and audiobook production. The API returns the generated audio file directly in the response body in your chosen format.

How do I handle rate limits?

The limit is 60 requests per minute per key, or 10 per minute before your first top-up. Requests are processed sequentially, so under load, you may experience queue delays. Monitor your usage via the dashboard to stay within limits and avoid delays in audio generation.

What happens if the API is down?

We do not provide an uptime guarantee or SLA. If synthesis fails, the charge is returned in full. You can check status by observing response codes. Support is available via email only; there is no phone number or live chat for immediate assistance during outages.

Can I use the OpenAI SDK?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.jlmaam.top/v1. Use your API key for authentication. The request shape matches the OpenAI speech endpoint, allowing you to integrate quickly without learning a new client library or handling raw HTTP requests manually.

How do I split long texts?

Split your text into parts of up to 4096 characters each. Send each part as a separate request and join the resulting audio files. This ensures each request stays within the character limit. You can manage this splitting logic in your application code before calling the API.

What is the character limit per request?

Each request supports up to 4096 characters in the input field. Spaces and punctuation count toward this limit. If your text exceeds this, split it into multiple requests. Failed requests do not consume your character allowance, so you can retry without penalty if an error occurs.

How do I authenticate requests?

Include your API key in the Authorization header as Bearer tts-.... You receive this key after signing up on /get-api-key/. Only one key is active per account. If you issue a new key, the previous one stops working immediately, so update your applications accordingly.

What is the response format?

The response contains the generated audio file in your requested format (mp3, wav, opus, flac, or pcm). It returns the audio file directly in the response body. Failed requests return an error object and refund the charge. The audio is not stored; it is returned directly in the response.

Can I generate audio in real-time?

No, we do not offer streaming, WebSocket, or real-time partial audio. Requests are processed sequentially, which may cause delays under load. For long texts, generate chunks and join them. This batch approach is suitable for language learning materials and audiobook production where immediate playback isn't required.

How do I test the API?

Use the ready curl example provided on the /get-api-key/ dashboard page. You can also use the OpenAI SDK with the adjusted base URL. Sign up to receive $0.50 in free trial credit, valid for 7 days, allowing you to test integration without immediate payment or top-up.

What is the model name for TTS?

The model name is either tts-1 or tts-1-hd. Both use the same engine and pricing. You specify the model in the JSON request body. The choice does not affect the voice or language capabilities, only the audio quality.

First request

curl

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

Access our text-to-speech API by generating a unique API key from your account dashboard. Authentication uses the standard Bearer token scheme, ensuring secure and straightforward integration for product teams building language learning tools or audiobook platforms.

Each account maintains one active key at a time. You can generate a new key immediately via the dashboard; the previous key becomes invalid instantly, providing simple and secure key rotation without downtime or complex re-authentication flows.

API Key Generation

API Key Generation

Create your key on the /get-api-key/ page after signing in with Google or email. The dashboard displays your active key, current balance, and usage statistics immediately upon generation, allowing you to start testing with zero delay.

Keys are tied to your account’s billing status. Ensure your account has sufficient credit or a valid USDT top-up before making your first API call to avoid service interruption during integration testing.

  • Navigate to /get-api-key/ in your dashboard
  • Click 'Generate New Key' to create a Bearer token
  • Copy the key starting with 'tts-' for your requests

Bearer Token

Bearer Token

Include your API key in the HTTP header as Authorization: Bearer tts-your-api-key. This standard format works seamlessly with the OpenAI SDK by adjusting the base_url to https://api.jlmaam.top/v1, simplifying your existing codebase.

The token validates your identity and checks your available character balance for each request. Failed requests due to insufficient funds return an error without charging your balance, ensuring predictable costs during development.

  • Header: Authorization: Bearer tts-...
  • Works with OpenAI SDK base_url configuration
  • Validates balance on every request

Key Management

You may issue a new key at any time from your dashboard. The old key stops working immediately, which is useful for security audits or if a key is exposed in a public repository. There is no limit to how many times you can rotate keys.

Each account holds only one active key. This simplifies debugging and billing tracking since all usage under that key is attributed to a single token. Keep your key secure and avoid hardcoding it in client-side code.

  • Generate a new key anytime via dashboard
  • Old key invalidates instantly upon new generation
  • One active key per account for clear billing

Endpoints

Sound wave illustration for: Endpoints

Our API provides three primary endpoints for integrating text-to-speech into your language learning or audiobook applications. The speech generation endpoint converts text into audio, while the voices and models endpoints allow you to query available options and pricing details.

Speech Generation

Send a POST request to /v1/audio/speech with your JSON payload. The API returns an audio file directly in the response body, supporting formats like MP3, WAV, Opus, FLAC, and PCM. Ensure your input text does not exceed 4,096 characters per request.

List Voices

Use GET /v1/voices to retrieve a list of all available voices, their associated languages, supported formats, and current pricing. This endpoint helps you select the right voice preset for your educational content before making synthesis requests.

List Models

Call GET /v1/models to view the available synthesis models. Currently, the API supports "tts-1" and "tts-1-hd", which use the same engine and pricing structure. You can switch between them by updating the model field in your request.

Request Parameters

Sound wave illustration for: Request Parameters

Configure your API requests by specifying the text to convert, the desired voice, and the output format. The input field accepts up to 4096 characters, where spaces and punctuation count toward the limit. For non-English Latin-script text, explicitly set the language parameter to ensure accurate pronunciation, as the system defaults to English otherwise.

Input Text

Send your text via the input field in the JSON body. Each request supports a maximum of 4096 characters. For longer content, split the text into chunks and join the resulting audio files. The system processes requests sequentially, so queue times may apply during high load.

  • Maximum length: 4096 characters per request
  • Spaces and punctuation count as characters
  • Explicitly set language for non-English Latin text

Voice Selection

Choose from eight distinct presets using the voice parameter. Voices are based on licensed recordings from LibriTTS-R and LibriVox. Each voice maintains a consistent tone suitable for language learning or audiobook production, such as the warm narrator 'Aria' or the energetic 'Felix'.

  • 8 presets: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, Orion
  • Voices are based on licensed recordings
  • Consistent tone across all generations

Response Format

Specify the output format using response_format. Options include mp3, wav, opus, flac, and pcm. MP3 and opus offer efficient compression for web delivery, while WAV and FLAC provide lossless quality. PCM is available for raw audio data processing. The default format is mp3.

  • Formats: mp3, wav, opus, flac, pcm
  • MP3 and opus: efficient compression
  • WAV and FLAC: lossless quality
  • Default format: mp3

Rate Limits

Sound wave illustration for: Rate Limits

Each API key allows 60 requests per minute, though new accounts without top-ups are limited to 10 requests per minute. This limit ensures fair usage while your account builds its transaction history. You can increase this capacity instantly by adding USDT (TRC-20) to your balance.

Requests Per Minute

New accounts start with a 10 requests-per-minute limit. Once you top up at least $5 via USTRC-20, your limit increases to 60 requests per minute. This cap applies per key, so rotating keys can help if you need higher throughput.

  • Standard limit: 60 requests/minute per key
  • New account limit: 10 requests/minute
  • Increase limit via USDT (TRC-20) top-up

Queue Processing

Requests are processed sequentially. If you send multiple requests quickly, they wait in a queue. Short phrases typically take a few seconds to generate, while longer texts generate at roughly real-time speed (25 characters per second).

Because requests are handled one after another, heavy loads mean your request may wait. There is no parallel processing, so plan your batch sizes accordingly.

Load Handling

To manage load effectively, split long texts into chunks of up to 4,096 characters. Generate audio for each chunk separately, then join the files on your end. This approach keeps individual requests within limits and prevents queue bottlenecks.

Monitor your usage dashboard to track request volume. If you consistently hit the 60 requests/minute limit, consider spreading requests over time or using multiple API keys.

Error Handling

Sound wave illustration for: Error Handling

Reliable error handling ensures your language learning app stays responsive when synthesis fails or limits are reached. Our API returns clear status codes so you can adjust retry logic or notify users appropriately.

Common Errors

The most frequent issues involve invalid input text or exceeding the 4096-character limit per request. Ensure your text is properly encoded and split before sending.

  • Invalid JSON body
  • Missing or invalid API key
  • Text exceeds 4096 characters
  • Insufficient balance

Status Codes

We use standard HTTP codes to indicate success or failure. A 200 OK means your audio file is ready. A 400 error indicates a problem with your request parameters.

  • 200 OK: Success
  • 400 Bad Request: Invalid parameters
  • 401 Unauthorized: Invalid API key
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Temporary service issue

Troubleshooting

If you receive a 429 error, wait a few seconds before retrying. Our rate limit is 60 requests per minute per key. For persistent issues, check your balance and key validity.

Error Handling

Code Examples

Sound wave illustration for: Code Examples

Get started quickly by generating audio from text. This section provides ready-to-use examples for cURL, the OpenAI SDK, and Python to help you integrate our TTS API into your language learning or audiobook workflow.

All examples use the standard request shape. You can adapt them to your preferred language or framework while keeping the core parameters intact.

cURL Example

Use cURL to send a simple POST request. Replace YOUR_API_KEY with your key from /get-api-key/. This method works for any environment that supports HTTP requests.

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

OpenAI SDK

Since our API mirrors the OpenAI speech endpoint, you can use the official OpenAI SDK by pointing it to our base URL. This allows you to leverage familiar SDK patterns.

```python import openai client = openai.OpenAI(base_url="https://api.jlmaam.top/v1", api_key="tts-...") with client.audio.speech.create( model="tts-1", voice="nova", input="Hello world" ) as response: response.write_to_file("output.mp3") ```

Python Integration

For more control, use the requests library. This approach is useful when you need to handle custom headers or error responses manually. Ensure you handle the binary audio data correctly.

```python import requests response = requests.post( "https://api.jlmaam.top/v1/audio/speech", headers={"Authorization": "Bearer tts-..."}, json={"model": "tts-1", "voice": "nova", "input": "Hello world", "response_format": "mp3"} ) with open("output.mp3", "wb") as f: f.write(response.content) ```

Audio Formats

Sound wave illustration for: Audio Formats

The API supports MP3, WAV, FLAC, OPUS, and PCM output formats. You specify the desired format using the response_format parameter in your request body. This gives you control over file size, quality, and compatibility with your specific language learning or audiobook player.

MP3 Support

MP3 is the default format. It offers a good balance between audio quality and file size, making it ideal for web players and mobile applications in language learning apps.

WAV Support

WAV provides uncompressed, high-quality audio. This is useful for professional audiobook production where you need lossless files for further editing or distribution.

Other Formats

OPUS and FLAC offer advanced compression options. OPUS is excellent for streaming or low-bandwidth scenarios, while FLAC provides lossless compression for archival purposes. PCM is available for raw audio data needs.

  • MP3: Default, balanced quality/size
  • WAV: Uncompressed, high fidelity
  • OPUS: Efficient compression (Note: Streaming is not supported)
  • FLAC: Lossless compression
  • PCM: Raw audio data

Best Practices

Sound wave illustration for: Best Practices

Handling long texts requires splitting input into chunks of up to 4096 characters, then joining the resulting audio files. This ensures consistent delivery without hitting request limits. Use the character count to plan your splitting logic before sending requests.

Optimization involves monitoring rate limits and understanding queue behavior. Requests process sequentially, so long texts may experience delays during high load. Plan your integration to handle these waits gracefully without timing out.

Text Splitting

Break input text into segments of 4096 characters or fewer. Send each segment individually and concatenate the returned audio files. This approach respects API limits and ensures complete synthesis of lengthy documents.

Count spaces and punctuation as characters when calculating split points. Accurate character counting prevents truncated audio or unexpected errors during synthesis.

  • Max 4096 characters per request
  • Count spaces and punctuation
  • Concatenate returned audio files

Long Text Handling

Recognize that requests are processed sequentially. Under load, your request may wait in a queue before synthesis begins. Plan for this latency in your application’s user experience.

Typical generation speed is roughly real-time, producing about 25 characters of text per second of audio. Short phrases may take a few seconds to process.

  • Requests are sequential
  • Queue processing possible
  • Real-time generation speed

Optimization Tips

Use the OpenAI SDK by changing the base URL for easy integration. This allows you to leverage existing client libraries with minimal code changes.

Set the language parameter explicitly for non-English Latin script text. This prevents incorrect language guessing and ensures accurate voice synthesis.

Monitor your rate limit of 60 requests per minute. Adjust your application’s request frequency to stay within this limit for consistent performance.

  • Use OpenAI SDK
  • Set language explicitly
  • Monitor rate limits

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. However, our infrastructure maintains steady throughput even during peak usage hours.

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. TRON developer hub: TRC-20
  3. LibriTTS-R corpus (OpenSLR 141)
  4. ISO 639 language codes
  5. MDN: Web Speech API
  6. IETF RFC 7845: Ogg Opus
  7. LibriVox public-domain audiobooks
  8. Python documentation
  9. OpenAI API reference: create speech
  10. Creative Commons Attribution 4.0
  11. openai-node on GitHub
  12. W3C WAI: making audio and video accessible

More on this site