Quick Start Guide: Generate Audio with Our TTS API

By EdTech Voice Lab editorial team · Updated 2026-11-18

This guide helps teachers and school staff generate audio files from lesson text, reading assignments, and exam questions using a straightforward TTS API. You will find exact endpoints, parameter limits, and integration steps that work with standard HTTP requests, ensuring non-technical users can implement the tool without complex enterprise contracts or custom SDKs.

We cover authentication setup, voice selection, and speed controls with concrete examples. The documentation details rate limits, error handling, and troubleshooting for latency or quality issues. Use this reference to quickly turn text into usable audio for classroom resources, keeping in mind the 4096-character input limit and simple per-character pricing.

Quick Start Guide: Generate Audio with Our TTS API

Frequently asked questions

What is the API endpoint?

The endpoint is POST https://api.playsona101.com/v1/audio/speech. You send a JSON body containing the text, voice, and format preferences. It follows the same request shape as the OpenAI speech endpoint, ensuring compatibility with existing tools and scripts used for text-to-speech generation.

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email. Your key starts with 'tts-'. One active key is issued per account. You can issue a new key at any time via the dashboard; the old key stops immediately upon creation of the new one.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint exactly. You can use official OpenAI SDKs by changing the base_url to https://api.playsona101.com/v1 and providing your site-specific API key in the Authorization header. This allows seamless integration without rewriting your client code.

What is the maximum input length?

Each request supports up to 4096 characters. If your text exceeds this limit, split it into parts of 4096 characters or fewer. Generate audio for each part individually, then join the resulting audio files to create the final output for longer documents or lessons.

Which audio formats are supported?

You can choose from mp3, wav, opus, flac, and pcm. Select the format via the response_format field in your request. These options cover most educational use cases, from web playback to high-quality archival storage, ensuring compatibility with various learning management systems and devices.

How do I handle rate limits?

A: The limit is 60 requests per minute per key (10 per minute before the first top-up). Monitor your usage via the dashboard. If you exceed the limit, requests will be queued, not immediately rejected. Implement retry logic with exponential backoff in your application to handle temporary spikes efficiently.

What happens if the API is slow?

Requests are processed sequentially, so under load, your request may wait in a queue. Typical speed is roughly real-time (25 characters per second). Short phrases may take a few seconds. Longer texts generate at real-time speed, but initial processing might introduce slight delays.

Can I change the voice speed?

Yes, the speed parameter accepts values between 0.25 and 4.0. This allows you to adjust playback speed for clarity or emphasis. Set this value in your request body alongside the voice and input text to customize the audio output for your specific educational content needs.

Is there a JSON response?

The response contains the audio file data, not a JSON payload with audio. The request body is JSON. You receive the synthesized audio directly in the response body, formatted according to your specified response_format. Metadata like character count and status are handled via HTTP headers or billing logs.

How do I rotate my API key?

Issue a new key anytime from your account dashboard. The new key becomes active immediately, and the old key stops working at once. This ensures seamless rotation without downtime. You can revoke the old key manually if needed, but it becomes invalid automatically upon new key creation.

What are common error codes?

Standard HTTP error codes apply, such as 400 for bad requests or 429 for rate limits. Failed synthesis requests are free, and charges are returned in full. Check the response body for specific error messages indicating issues like invalid voice names, unsupported formats, or input text errors.

Do I need to install extra libraries?

No. You can use plain HTTP requests or the official OpenAI SDK. No proprietary library is required. Simply send a POST request to the endpoint with your JSON body and API key. This simplicity makes it easy for non-technical staff to integrate into existing workflows.

First request

curl

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

Authentication

Sound wave illustration for: Authentication

Access the API by generating a unique key via the /get-api-key/ dashboard. Each account holds one active key, which authenticates all requests to the speech endpoint. This key acts as your sole identifier for usage tracking and billing.

Include the key in the HTTP header as a Bearer token. This simple setup ensures that only your account’s credits are charged for the generated audio files.

API Key Setup

Navigate to the /get-api-key/ page on playsona101.com. Sign in with Google or your email credentials to view your unique API key. This key is required for every API call and links all activity to your account balance.

  • Create an account via Google or email.
  • Locate your key on the dashboard.
  • Copy the key for your configuration.

Bearer Token Usage

Include the header Authorization: Bearer tts-... in every request. The system validates this token to authorize the synthesis process and deduct characters from your balance accordingly.

  • Header: Authorization: Bearer <your-key>
  • Format: tts- prefix followed by unique identifiers.

Key Rotation

Generate a new key at any time via the dashboard. The previous key becomes invalid immediately upon creation of the new one, ensuring secure access control without downtime if managed correctly.

  • Generate new key via dashboard.
  • Old key stops instantly.
  • No downtime if rotated properly.

Endpoint Overview

Sound wave illustration for: Endpoint Overview

The EdTech Voice Lab API provides three core endpoints for managing your text-to-speech integration. Use these endpoints to configure voices, verify model availability, and generate audio files from your educational content.

Speech Generation

Send a POST request to https://api.playsona101.com/v1/audio/speech with your JSON payload containing the text, voice, and format. The API processes the input and returns the generated audio file directly in the response.

Voice Listing

Use GET /v1/voices to retrieve the full list of available voices, languages, and supported formats. This helps you select the appropriate voice, such as Aria for narrations or Felix for energetic announcements. Note that voice names are case-sensitive (e.g., 'aria', not 'Aria').

Model Info

Query GET /v1/models to check the current model status and details. Both tts-1 and tts-1-hd use the same engine and pricing, so you can choose based on quality preference without cost differences. The endpoint returns the list of available models.

Endpoint Overview

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts plain text input for synthesis, supporting a maximum length of 4,096 characters per request. Spaces and punctuation are counted as characters, so concise phrasing helps manage volume efficiently. For longer lesson plans or reading assignments, split the text into chunks and join the resulting audio files.

Input Text Limits

Each request processes up to 4,096 characters. If your material exceeds this, divide it into segments. The system does not store the input text for training, using it solely for audio generation.

  • Maximum 4,096 characters per request
  • Spaces and punctuation count toward the limit
  • Split longer texts into multiple requests

Voice Selection

Choose from eight distinct presets, including female voices like Aria and Luna, and male voices such as Felix and Atlas. Each voice can speak any of the 23 supported languages, though setting the language field is recommended for non-English Latin-script text to ensure accurate pronunciation.

  • 8 presets: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, Orion
  • Supports 23 languages
  • Set language for non-English Latin text

Speed Control

Adjust playback speed between 0.25 and 4.0 using the speed parameter. This allows teachers to slow down complex instructions for clarity or speed up repetitive reading practice. Default speed is 1.0.

  • Range: 0.25 to 4.0
  • Default: 1.0
  • Useful for adjusting comprehension levels

Response Formats

Sound wave illustration for: Response Formats

The API returns the synthesized audio file directly in the response body, matching your chosen format. There is no intermediate JSON payload with audio data; you receive the raw bytes ready for immediate playback or storage.

Audio Formats

You can specify the output format using the response_format parameter. Supported formats include mp3, wav, opus, flac, and pcm. The generated file is returned directly as the response body, allowing non-technical staff to download or stream it without parsing complex JSON structures.

  • mp3: Small file size, ideal for web playback
  • wav: Uncompressed, high quality for classroom speakers
  • opus: Efficient compression for mobile apps
  • flac: Lossless compression for archival
  • pcm: Raw uncompressed audio data

JSON Response

Successful requests return the audio file directly in the response body, formatted according to your specified response_format. Metadata such as character count and processing time is available via HTTP headers or billing logs, not in the response body. This keeps the payload lightweight and efficient for simple integrations.

Error Codes

If synthesis fails, the charge is returned in full. Standard HTTP status codes indicate the result. A 200 OK means the audio file was generated successfully. Use 4xx codes for authentication or parameter issues, and 5xx for server errors. Failed requests do not consume your character credit.

  • 200 OK: Audio file generated successfully
  • 400 Bad Request: Invalid parameters or text
  • 401 Unauthorized: Invalid or expired API key
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Temporary service issue

Rate Limits

Sound wave illustration for: Rate Limits

Understanding rate limits helps you plan classroom audio generation efficiently. Our API enforces a strict limit of 60 requests per minute for each API key, regardless of your plan. This ensures fair usage for all teachers and schools using the service simultaneously.

60 Requests Per Minute

Each API key is limited to 60 requests per minute. This limit applies to all users regardless of their plan. If you exceed this threshold, requests will be queued until the rate allows processing. Requests are processed one after another, so under load a request may wait in a queue.

Pre-Topup Limits

New accounts start with a lower limit of 10 requests per minute before the first top-up. This allows you to test the API without exceeding capacity. Once you add funds, the limit increases to the standard 60 requests per minute immediately.

Queue Behavior

Excess requests are queued and processed sequentially. Typical speed is roughly real-time, generating about 25 characters of text per second. Short phrases may take a few seconds, while longer texts process at a consistent pace. Queue times depend on current server load.

Rate Limits

SDK Integration

Sound wave illustration for: SDK Integration

EdTech Voice Lab’s API mirrors the OpenAI speech structure, allowing schools to use standard OpenAI Python or Node.js SDKs with minimal configuration. This compatibility simplifies integration for non-technical staff who already use these libraries, requiring only a base URL adjustment rather than a complete rewrite of existing code logic. The service accepts standard parameters like model, input, voice, and response_format, ensuring that lesson texts and exam questions convert seamlessly into audio files.

OpenAI SDK Compatibility

Our API endpoint structure aligns with the OpenAI audio/speech endpoint. You can use standard OpenAI SDKs directly, updating only the base_url configuration to point to our infrastructure. This ensures that existing authentication and request formatting logic remains valid, reducing the learning curve for technical teams within schools. It allows for quick prototyping of audio features for digital textbooks or accessibility tools without needing to learn a proprietary library.

  • Supports standard OpenAI Python and Node.js SDKs
  • No custom library installation required
  • Familiar parameter structure for existing developers

Base URL Change

To direct requests to EdTech Voice Lab, change the API base URL to https://api.playsona101.com/v1. This simple configuration change ensures that all speech generation requests are routed to our cloud infrastructure. Keep your Authorization header format as Bearer <your-api-key>, using the key provided in your dashboard. The endpoint path remains /audio/speech for POST requests. By maintaining this consistency, you avoid breaking changes when switching from testing to production environments. The SDK will automatically handle the JSON body structure required for text-to-speech conversion, including input, voice, and optional speed settings.

Code Examples

Here is a minimal Python example using the OpenAI SDK. Ensure you have the SDK installed via pip install openai. Replace YOUR_API_KEY with your key from the dashboard. The base_url must point to https://api.playsona101.com/v1 to use our voices.

Error Handling

Sound wave illustration for: Error Handling

Handling errors correctly ensures your lesson audio generates without losing credit or timing out unexpectedly. The API returns standard HTTP codes to indicate success or failure, allowing you to build reliable workflows for classroom materials.

Failed requests do not consume your balance. If synthesis fails, the charge is returned in full, so you can safely retry without worrying about wasting your $0.01 per 1,000 characters budget.

Common Errors

The most frequent issue is exceeding the 4096 character limit per request. Other errors include invalid voice names or temporary service unavailability during high load. 400: Invalid input or missing required fields like 'model' or 'voice'. 401: Unauthorized; check that your Bearer token is active and correctly formatted. 429: Too Many Requests; you have hit the 60 requests per minute limit. 500: Internal server error; retry after a short delay. 503: Service Unavailable; the server is busy.

Retry Logic

Implement exponential backoff for transient errors like 500 or 503. For rate limits (429), wait until the Retry-After header duration passes before sending the next request. Start with a 1-second delay. Double the delay for each subsequent retry up to a maximum of 30 seconds. Stop after 3-5 attempts to avoid unnecessary API calls. Note: The API does not guarantee a Retry-After header for all 429 responses.

Status Codes

A 200 OK status indicates successful generation. Any 4xx or 5xx code means the request failed, and you should log the error message for debugging. 200: Success. Audio data is included in the response body. 400: Bad Request. Check your JSON payload and parameter values. 401: Unauthorized. Verify your API key. 429: Rate Limit Exceeded. Slow down your request frequency. 500: Server Error. Try again later. 503: Service Unavailable. The server is busy; retry with backoff. Failed requests are free.

Error Handling

Troubleshooting

Sound wave illustration for: Troubleshooting

This guide addresses common technical hurdles when integrating the EdTech Voice Lab API into your lesson preparation workflow. We focus on specific, measurable behaviors regarding audio fidelity, processing speed, and text constraints to help you plan your integration accurately.

Audio Quality Issues

All generated audio files contain an inaudible watermark indicating synthetic speech. This watermark is standard and does not affect playback quality. If you require specific language clarity, ensure you set the language parameter for non-English Latin-script text, as the system guesses language by default.

Latency Problems

Requests are processed sequentially. Short phrases take a few seconds; long texts take roughly real time (25 characters per second). Under load, requests may wait in a queue, increasing generation time. Requests are processed one after another.

Character Limits

Each API request accepts a maximum of 4096 characters. For longer reading assignments or exam questions, split your text into parts under this limit and join the resulting audio files. Note that spaces and punctuation count toward the character total.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Our intuitive platform helps teachers quickly create engaging lessons without needing technical expertise or special skills.

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. OpenAI API reference: create speech
  3. Node.js documentation
  4. openai-python on GitHub
  5. Creative Commons Attribution 4.0
  6. openai-node on GitHub
  7. LibriTTS-R corpus (OpenSLR 141)
  8. Tether (USDT)
  9. Python documentation
  10. W3C WAI: making audio and video accessible
  11. LibriTTS-R paper (arXiv 2305.18802)
  12. TRON developer hub: TRC-20

More on this site