Quickstart Guide: Text-to-Speech API for Teachers and Developers

By Classroom Audio editorial team · Updated 2026-11-18

This guide helps teachers and developers integrate Classroom Audio’s text-to-speech API without complex infrastructure. You will learn to generate audio files from lesson texts using simple HTTP requests or the OpenAI SDK. The process is designed for no-code users who want to switch from legacy services like Amazon Polly to a reliable, character-based billing model.

You can start by signing up with Google or an email account to receive your API key. The guide covers making your first request, handling long texts over 4096 characters, and understanding rate limits. You will also see how to manage audio formats and resolve common errors, ensuring a smooth workflow for educational content.

Quickstart Guide: Text-to-Speech API for Teachers and Developers

Frequently asked questions

Do I need to install a specific SDK for this API?

No specific SDK is required. You can use the official OpenAI SDKs by changing the base URL to https://api.jl55mm.com/v1 and providing your API key. Alternatively, you can make standard HTTP requests using any library that supports JSON and Bearer token authentication for your preferred programming language.

How do I change the base URL for Google text to speech JavaScript?

Q: How do I change the base URL for OpenAI JavaScript? A: Update your client configuration to point to https://api.jl55mm.com/v1. Since our request shape matches the OpenAI speech endpoint, you can use the OpenAI JavaScript SDK by setting the base URL to this address. Ensure you include your Bearer token in the Authorization header for authentication.

Can I use the Google text to speech Java client library?

Yes, if you are using the OpenAI Java SDK, you can use it by changing the base URL to https://api.jl55mm.com/v1. The request structure is identical to the OpenAI speech endpoint. Standard Google Cloud TTS Java libraries will not work directly, as our API follows the OpenAI format, not Google’s.

What is the correct endpoint for generating audio?

Use the POST endpoint https://api.jl55mm.com/v1/audio/speech. Send your JSON body containing the model, input text, voice, and optional parameters like speed or language. The API will return the generated audio file in the requested format, such as mp3, wav, opus, flac, or pcm.

Do I need to send the language code for English text?

No, you do not need to send the language code for English. If the language parameter is omitted, the system guesses the language from the script, defaulting to English for Latin script text. However, you should explicitly set the language for other Latin-script languages to ensure accuracy.

How do I handle errors in my Node.js application?

Check the HTTP status code and response body for error details. Failed requests are free, and any charges are returned in full if synthesis fails. Ensure your code handles network errors and validates that the input text does not exceed 4096 characters per request to avoid processing issues.

Is the API synchronous or asynchronous?

The API is synchronous. You send a POST request and receive the audio file in the response. Requests are processed one after another, so under load, your request may wait in a queue. There is no webhook or polling mechanism; you must wait for the response to complete.

Can I generate audio in the background?

No, the API is synchronous. You must wait for the response containing the audio file before proceeding. For long texts, you should split them into parts of up to 4096 characters in your application logic, generate each part, and then join the audio files yourself.

What happens if I send text longer than 4096 characters?

The API limits each request to 4096 characters. You must split longer texts into smaller parts in your application code. Generate audio for each part individually and then join the resulting audio files to create the final output. This ensures compatibility with the single-request character limit.

How do I verify my API key is working?

Send a simple POST request to https://api.jl55mm.com/v1/audio/speech with a short text and your key in the Authorization header. If you receive an audio file, the key is valid. You can also check your balance and usage details on the /get-api-key/ page after signing in.

Is there a sandbox environment for testing?

There is no separate sandbox environment. You use the same production endpoint, https://api.jl55mm.com/v1. New accounts created with Google sign-in receive a free trial of $0.50 credit, valid for 7 days, which is ideal for testing. Email/password accounts start without this trial credit.

Can I use the same key on multiple devices?

Yes, you can use the same API key on multiple devices or applications simultaneously. Each account has one active key that can be used across different clients. If you issue a new key, the old one stops working immediately, so ensure all devices switch to the new key.

How do I know which voice to choose for my text?

Choose from eight presets based on tone: Aria (warm narrator), Nova (bright), Luna (soft), Sage (calm), Felix (energetic), Milo (friendly), Atlas (neutral), or Orion (deep). All voices support all 23 languages. Select based on whether you need a conversational, instructional, or documentary style for your educational content.

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

Both models use the same engine and price. The choice between tts-1 and tts-1-hd does not affect the cost or the underlying synthesis engine. You can use either model identifier in your requests without any difference in billing or processing speed, as they are priced identically at $10 per million characters.

First request

curl

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

Step 1: Create Your Account

Sound wave illustration for: Step 1: Create Your Account

To begin, visit the /get-api-key/ page on jl55mm.com. You can sign up using your Google account for immediate access or create an account with an email and password. This account is specific to this site and manages your billing and API access.

Google sign-ups receive a $0.50 trial credit valid for seven days, covering approximately 50,000 characters. Email-based accounts start without trial credit. Your unique API key appears on this dashboard, ready for use in your requests.

Sign up with Google

Sign up with Google

Click the Google sign-in button on the /get-api-key/ page. After authentication, your account is created instantly. You receive $0.50 in trial credit, valid for seven days, which covers about 50,000 characters of text-to-speech generation.

  • Instant account creation
  • $0.50 trial credit included
  • 7-day validity period

Sign up with email and password

Sign up with email and password

Enter your email address and create a password to register. This method does not include trial credit. You must top up your balance using USDT (TRC-20) before making your first request. Accounts are independent per site.

Where to find your API key

Once logged in, the dashboard displays your active Bearer token starting with 'tts-'. This key authenticates your requests to https://api.jl55mm.com/v1. You can issue a new key at any time, which immediately invalidates the previous one.

  • Key format: Bearer tts-...
  • One active key per account
  • New key invalidates old immediately

Step 2: Your First Curl Request

Sound wave illustration for: Step 2: Your First Curl Request

Send your lesson text to the speech endpoint using a standard HTTP POST request. The API accepts JSON payloads and returns audio files directly, making it easy to integrate into your existing teaching workflows or simple scripts.

Ensure your request includes the correct model, input text, and voice selection. The endpoint handles the synthesis, returning the audio data ready for playback or download in your preferred format.

The POST endpoint URL

Direct all speech synthesis requests to https://api.jl55mm.com/v1/audio/speech. This endpoint mirrors the structure of the OpenAI speech API, allowing you to use familiar tools and libraries without learning a new protocol.

Required JSON fields

Your request body must include the model ("tts-1" or "tts-1-hd"), the input text (up to 4096 characters), and the voice preset. You may also specify response_format (mp3, wav, opus, flac, or pcm) and speed (0.25–4.0).

  • model: "tts-1" or "tts-1-hd"
  • input: Your text content
  • voice: One of the 8 available presets
  • response_format: mp3, wav, opus, flac, or pcm

Example request with aria voice

Below is a basic cURL command to generate audio using the "aria" voice. Replace YOUR_API_KEY with your actual key from the dashboard. This example requests an MP3 file with default settings.

  • ```bash
  • curl https://api.jl55mm.com/v1/audio/speech \
  • -H "Authorization: Bearer YOUR_API_KEY" \
  • -H "Content-Type: application/json" \
  • -d '{"model": "tts-1", "input": "Hello, this is a test lesson.", "voice": "aria", "response_format": "mp3"}'

Step 3: Using the OpenAI SDK

Sound wave illustration for: Step 3: Using the OpenAI SDK

The official OpenAI SDKs work with our API because we mirror the same request shape. This allows teachers and no-code users to switch from legacy services without learning a new library. You simply point the SDK to our endpoint and use standard methods.

By updating the base URL, you leverage familiar code structures. This reduces friction for developers integrating audio into lesson plans or reading apps without managing complex infrastructure.

Install the OpenAI npm package

Begin by installing the standard OpenAI package in your project. This provides the core client methods needed for text-to-speech generation without requiring additional dependencies.

  • Run: npm install openai

Change the base_url

Configure the client to use our API domain instead of the default OpenAI servers. This ensures all requests are routed to our infrastructure for synthesis.

Set the base URL to https://api.jl55mm.com/v1 in your client configuration.

  • base_url: 'https://api.jl55mm.com/v1'

Use the same SDK methods

Call the audio speech method using your API key. The parameters remain identical to the standard OpenAI format, ensuring compatibility with existing integrations.

Pass your model, voice, input text, and desired format. The SDK handles the JSON serialization and authentication headers automatically.

  • model: 'tts-1'
  • voice: 'aria'
  • input: 'Lesson text here'
  • response_format: 'mp3'

Available Audio Formats

Sound wave illustration for: Available Audio Formats

Selecting the right audio format depends on how you plan to deliver the content to your students. The API supports five distinct output formats, allowing you to balance file size, quality, and compatibility without needing external conversion tools.

Each format serves a specific technical need, from standard web playback to lossless archival storage. The choice does not affect the voice quality or the character count charged to your account.

MP3 for web playback

MP3 is the default and most widely supported format for web browsers and mobile devices. It offers a good balance between file size and audio quality, making it ideal for embedding audio players in lesson plans or learning management systems.

This format ensures broad compatibility across devices used by students, from Chromebooks to smartphones, without requiring special plugins or codecs.

  • Default output format
  • Ideal for web embedding
  • Small file sizes for faster loading

WAV for high quality

WAV provides uncompressed, high-fidelity audio suitable for professional editing or archival purposes. It preserves the full detail of the synthesized voice, which is useful if you plan to further edit the audio in a DAW.

Choose WAV when you need the highest possible audio integrity and do not mind larger file sizes compared to compressed formats.

  • Uncompressed audio
  • Highest fidelity
  • Suitable for editing

FLAC and OPUS options

FLAC offers lossless compression, reducing file size while maintaining perfect audio quality. OPUS provides efficient compression for low-bandwidth environments.

Use FLAC for archival needs where storage space is a concern but quality is paramount. OPUS is optimal for mobile delivery or scenarios with limited bandwidth.

  • FLAC: Lossless compression
  • OPUS: Efficient streaming
  • Low bandwidth friendly

Understanding Rate Limits

Sound wave illustration for: Understanding Rate Limits

Understanding rate limits is essential for maintaining a smooth workflow when converting lesson plans or readings into audio. The API enforces a standard limit of 60 requests per minute for active accounts, ensuring fair usage across the network.

New accounts start with a lower limit, and requests are processed sequentially. Under heavy load, your requests may wait in a queue, which can affect the speed of generation for longer texts.

60 requests per minute

Once your account is active with a valid API key, you can make up to 60 requests per minute. This limit applies per key. Each request can handle up to 4096 characters, allowing you to convert substantial portions of text efficiently within this window.

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. The free trial credit of $0.50 does not automatically raise this limit; you need to add funds via USDT (TRC-20) to unlock the full 60 requests per minute capacity.

Queuing behavior under load

Requests are processed one after another. If the system is under heavy load, your request may wait in a queue. This can result in longer generation times, especially for short phrases which typically take a few seconds. Longer texts may take longer as they are processed sequentially, so plan your audio generation time accordingly.

Understanding Rate Limits

Handling Long Texts

Sound wave illustration for: Handling Long Texts

Lessons and reading passages often exceed the single-request limit of 4096 characters. To handle longer texts, you must split the input into smaller chunks and process each part individually.

4096 character limit per request

Each API call accepts a maximum of 4096 characters, including spaces and punctuation. If your source text is longer, you must divide it before sending.

Splitting text into parts

Divide your lesson into segments that fit within the character limit. Send each segment as a separate POST request to the speech endpoint. This ensures every part is processed independently.

Joining audio files

The API returns an audio file for each request. After receiving all parts, you must concatenate them in the correct order to reconstruct the full lesson audio.

Common Errors and Solutions

Sound wave illustration for: Common Errors and Solutions

API errors usually stem from account limits or configuration issues. Understanding these responses helps you adjust your classroom audio workflow without unnecessary delays.

Each error provides a clear signal for the next step, whether topping up credit or checking your key.

Insufficient balance

The API returns a 402 error when your account balance cannot cover the character count of the request. Failed requests are free, so only successful synthesis attempts deduct from your balance.

Top up via USDT on TRON (TRC-20) to restore service. New accounts with Google sign-up receive a $0.50 trial credit valid for 7 days.

  • Check your dashboard balance before bulk generation.
  • Top-ups credit automatically within minutes.

Invalid API key

A 401 error indicates the key is missing, malformed, or revoked. Each account holds one active key; issuing a new one instantly invalidates the old one.

Ensure you copy the full key from the /get-api-key/ page and include it in the Authorization header as Bearer tts-....

  • Generate a new key if the old one stops working.
  • Verify no trailing spaces in the key string.

Rate limit exceeded

You receive a 429 error if you exceed 60 requests per minute. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed.

Requests are processed sequentially; under load, your request may wait in a queue before being counted toward the limit.

  • Implement exponential backoff in your script.
  • Monitor the rate limit header in responses.

Supported Languages in Requests

Sound wave illustration for: Supported Languages in Requests

Language detection is automatic, but explicit control ensures accuracy across diverse classroom materials. The language field is optional; omitting it allows the API to guess the language from the text script, defaulting to English for Latin characters.

Optional language parameter

The API infers language from context when the language field is absent. This works well for straightforward content but may misidentify mixed-language texts or dialects.

Default to English for Latin script

Text written in Latin characters defaults to English if no language is specified. This simplifies requests for English lessons but requires explicit codes for other Latin-based languages like Spanish or French to ensure correct voice selection.

Specifying ISO codes

Set the language field to a valid ISO code (e.g., de, ja, zh) to enforce specific pronunciation. This covers all 23 supported languages, including Arabic, Hindi, and Swahili, ensuring consistent audio output regardless of input text variations.

  • Supported languages: Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Teachers pay only for what they consume, with no hidden tiers or surprise fees.

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. ISO 639 language codes
  3. LibriTTS-R paper (arXiv 2305.18802)
  4. FFmpeg documentation
  5. W3C WAI: making audio and video accessible
  6. Creative Commons Attribution 4.0
  7. LibriVox public-domain audiobooks
  8. Python documentation
  9. Node.js documentation
  10. MDN: Web Speech API
  11. openai-python on GitHub
  12. Tether (USDT)

More on this site