API Documentation for Text-to-Speech Generation

By PageVoice editorial team · Updated 2026-11-19

This documentation guides self-publishers and audiobook creators through the PageVoice TTS API. You will learn how to generate professional audio files from text using standard HTTP requests or the OpenAI SDK. The guide covers authentication, voice selection, and formatting options tailored for long-form content creation without requiring complex engineering.

We focus on practical workflows for converting manuscripts into speech. You will find specific details on character limits, rate limits, and available audio formats. This resource helps you understand the technical constraints and licensing mechanics so you can produce audiobooks efficiently using no-code tools and clear API integration steps.

API Documentation for Text-to-Speech Generation

Frequently asked questions

How do I generate an API key?

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

Can I use the OpenAI Python SDK?

Yes. The API uses the same request shape as the OpenAI speech endpoint. You can use the official OpenAI SDKs by changing the base_url to https://api.playsala.info/v1 and providing your site-specific key via the Authorization header.

What is the maximum input length?

Each request supports up to 4096 characters of text. For longer texts, split the content into parts of this size and join the resulting audio files. Spaces and punctuation count toward the character limit.

Which audio formats are supported?

You can request output in mp3, wav, opus, flac, or pcm formats. Specify your preferred format using the response_format field in the JSON body of your POST request to the /v1/audio/speech endpoint.

How do I handle rate limits?

The limit is 60 requests per minute per key (10 before the first top-up). Requests are processed sequentially, so under load, your request may wait in a queue. Failed requests do not consume your limit or credit.

Is the API compatible with cURL?

Yes. You can use cURL to send POST requests to https://api.playsala.info/v1/audio/speech. Include your Bearer token in the Authorization header and provide the text, voice, and format parameters in the JSON body.

Do I need to split text manually?

The API does not split text automatically. You must split input longer than 4096 characters into multiple requests. Generate each part separately and then join the resulting audio files to create the final audiobook chapter.

How do I authenticate my requests?

Include an Authorization header with the value Bearer tts-... where ... is your unique API key. One active key exists per account. You can generate a new key at any time, which instantly stops the old one.

What happens if I exceed the limit?

Requests are processed sequentially. If you exceed the 60 requests per minute limit, your requests will wait in a queue. Failed synthesis requests are free and return a full charge refund if applicable.

Can I change my voice mid-sentence?

No. Each request generates audio for a single voice preset. To change voices, you must send separate requests for each segment and join the audio files. There is no mid-sentence voice switching capability.

Does the API support streaming audio?

No. The API returns the complete audio file in the response body. There is no streaming, WebSocket, or real-time partial audio support. You receive the full file only after synthesis completes.

Is there a WebSocket endpoint?

No. The API uses standard HTTP POST requests for speech generation. There is no WebSocket endpoint for streaming or real-time audio delivery. All interactions are request-response based via the REST API.

How do I get the list of voices?

Send a GET request to /v1/voices. This endpoint returns available voices, languages, formats, and pricing information. You can use this data to select from the eight available presets for your text-to-speech generation.

What is the endpoint for models?

Use the GET /v1/models endpoint to retrieve model information. The available models are tts-1 and tts-1-hd, which use the same engine and pricing. Both models support the same voice presets and formats.

First request

curl

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

Getting Your API Key

Sound wave illustration for: Getting Your API Key

To begin using PageVoice, visit the /get-api-key/ page and create an account using either your Google credentials or a standard email and password. This account is specific to the playsala.info storefront. The system generates a unique API key for your requests, allowing you to start synthesizing audio immediately after verification.

Signing up for an account

Signing up for an account

Accounts created with Google receive a $0.50 trial credit valid for 7 days, providing approximately 50,000 characters. Email-based accounts start without trial credit. You can top up later using USDT on the TRON network, with a minimum deposit of $5.

Locating your key in the dashboard

Locating your key in the dashboard

Once logged in, the dashboard displays your active API key, current balance, and character usage statistics. The key is presented in a format starting with tts-. You can copy this directly into your applications or documentation for immediate use.

Managing active keys

The system supports one active key per account at any time. If you suspect a key has been compromised or wish to rotate it, you can issue a new key from the dashboard. The previous key becomes invalid immediately upon issuance of the new one, ensuring secure access control.

First API Request

Sound wave illustration for: First API Request

To generate audio, send a POST request to https://api.playsala.info/v1/audio/speech. The API accepts JSON input and returns an audio file directly in the response body, requiring no complex streaming setup for standard audiobook production workflows.

Curl command example

Use this command to test synthesis immediately. Replace YOUR_API_KEY with your credential from the dashboard.

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

JSON body structure

The request body is a standard JSON object. It defines the model, text input, voice selection, and output format.

  • model: "tts-1" or "tts-1-hd"
  • input: string (max 4096 characters)
  • voice: one of 8 presets
  • response_format: mp3, wav, opus, flac, or pcm
  • speed: 0.25–4.0
  • language: optional ISO code

Required fields explanation

The model, input, and voice fields are mandatory. The input field holds your manuscript text, capped at 4096 characters per request. voice selects the preset, such as "aria" for narration. response_format defaults to mp3 but can be changed to wav or flac for higher fidelity.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

The OpenAI Python or Node.js SDKs integrate seamlessly by overriding the default API endpoint. This allows you to reuse familiar libraries without rewriting HTTP clients, ensuring consistent authentication and error handling patterns across your audiobook generation pipeline.

Simply configure the SDK to point to the PageVoice API base URL. The request shape remains identical to the standard tts-1 endpoint, making migration for existing OpenAI users straightforward while leveraging our specific voice presets and pricing model.

Changing the base URL

Set the SDK’s base_url to https://api.playsala.info/v1. This redirects all speech synthesis requests to our infrastructure while maintaining the standard JSON payload structure expected by the official OpenAI clients.

  • Python: OpenAI(base_url='https://api.playsala.info/v1', api_key='tts-...')
  • Node.js: new OpenAI({ baseURL: 'https://api.playsala.info/v1', apiKey: 'tts-...' })

Authentication header setup

Pass your unique API key in the Authorization header as a Bearer token. The header format is Authorization: Bearer tts-.... Ensure your key is active and has sufficient balance before synthesis begins.

  • Format: Authorization: Bearer tts-your-api-key-here
  • One key per account; new keys invalidate the old one immediately.

Code snippet examples

Use the standard client.audio.speech.create() method. Pass your text, selected voice (e.g., aria), and desired output format. The SDK handles the HTTP POST to v1/audio/speech and returns the audio stream or file.

Example: `client.audio.speech.create(model='tts-1', voice='aria', input='Hello world', response_format='mp3')`. This returns a binary stream ready for saving as an audio file for your audiobook chapter.

Available Voices

Sound wave illustration for: Available Voices

PageVoice provides eight distinct voice presets derived from licensed LibriTTS-R recordings and LibriVox public-domain audiobook readings. These voices cover a range of narrative styles, allowing self-publishers to match the audio tone to their book’s genre without hiring voice actors.

List of 8 presets

Select from four female and four male voices, each designed for specific audiobook contexts. The library includes Aria, Nova, Luna, and Sage for female roles, and Felix, Milo, Atlas, and Orion for male roles.

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional
  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Voice characteristics

Every generated audio file carries an inaudible watermark marking it as synthetic speech. The voices are based on licensed recordings, ensuring legal clarity for commercial audiobook distribution.

Gender and tone options

Each voice can speak any of the 23 supported languages. If the language is not specified, the system guesses it from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language parameter to ensure accuracy.

Audio Formats

Sound wave illustration for: Audio Formats

The API supports five output formats: MP3, WAV, OPUS, FLAC, and PCM. Each serves different distribution needs, from web streaming to archival masters. You specify the format via the response_format parameter in your request.

Choosing the right format depends on your final delivery method. MP3 offers the smallest file size for web use, while WAV and FLAC provide lossless quality for audiobook platforms. PCM is raw audio for further processing.

MP3, WAV, OPUS, FLAC, PCM

MP3 is compressed and ideal for quick downloads. WAV and FLAC are uncompressed or losslessly compressed, preserving every detail. OPUS offers high efficiency at low bitrates. PCM provides raw, uncompressed data.

Select formats based on your platform’s requirements. Most audiobook distributors accept MP3 or WAV. If you need to edit the audio later, FLAC or WAV prevents quality loss during re-encoding.

  • MP3: Best for web streaming and small files.
  • WAV: Lossless, standard for many audiobook platforms.
  • FLAC: Lossless compression, smaller than WAV.
  • OPUS: Efficient compression, good for low bandwidth.
  • PCM: Raw audio, no compression, largest files.

Choosing the right format

For self-published audiobooks, MP3 is often sufficient and widely compatible. If your distributor requires lossless audio, choose WAV or FLAC. Use PCM only if you plan to process the audio further in software like Audacity.

Consider the balance between quality and storage. Lossless formats preserve the nuance of the TTS engine’s output, while compressed formats save bandwidth and storage space without significant audible loss for most listeners.

  • Use MP3 for general web distribution.
  • Use WAV or FLAC for lossless archival.
  • Use PCM for post-processing workflows.

Quality vs. file size

Lossless formats (WAV, FLAC) produce larger files but retain full audio fidelity. Compressed formats (MP3, OPUS) reduce file size significantly with minimal perceptible quality loss for speech. PCM files are the largest.

For voiceovers, the difference between lossless and high-bitrate MP3 is often negligible to the human ear. However, for critical audio work, lossless formats ensure no data is discarded. Always test your chosen format with your target platform’s specifications.

  • Lossless formats preserve all audio data.
  • Compressed formats reduce storage and bandwidth needs.
  • PCM files are significantly larger than MP3.
Audio Formats

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a standard rate limit of 60 requests per minute for each active key. This ceiling ensures stable synthesis performance, especially when processing the longer texts typical in audiobook production. Requests are processed sequentially, so the actual time to generate audio depends on the text length and current server load.

New accounts start with a stricter limit of 10 requests per minute until the first top-up is completed. This prevents rapid consumption of the free trial credit. Once you add funds via USDT on the TRON network, the limit automatically increases to the standard 60 requests per minute, allowing for faster batch processing of chapters or scenes.

You may experience slight delays if your request joins a queue during peak usage. The system processes requests one after another, so generation time scales with text length. For long documents, splitting text into chunks of up to 4,096 characters helps manage throughput and avoids exceeding single-request limits while maintaining consistent audio quality.

60 requests per minute

The standard limit allows 60 requests per minute per key. This supports efficient batch processing for audiobook chapters, where multiple segments are synthesized in quick succession.

Limit for new accounts

Accounts created without a top-up are limited to 10 requests per minute. This restricts rapid consumption of the $0.50 trial credit. The limit lifts automatically after a successful USDT top-up.

Handling queue delays

Requests are processed sequentially. Under load, a request may wait in a queue before synthesis begins. Longer texts take more time to generate, so plan your batch sizes accordingly.

  • Split long texts into 4,096-character chunks to manage throughput.
  • Top up to increase the rate limit from 10 to 60 requests per minute.
  • Use the OpenAI SDK’s retry logic to handle temporary queue waits.

Error Handling

Sound wave illustration for: Error Handling

Understanding error responses ensures your audiobook production workflow remains uninterrupted. Our API provides clear feedback when synthesis fails, allowing you to distinguish between temporary glitches and account-specific issues without losing billing integrity.

Common error codes

The API returns standard HTTP status codes to indicate request status. A 4xx error typically signals an authentication or configuration issue, such as an invalid key or unsupported voice selection. A 5xx error indicates a transient server-side problem during audio generation.

  • 401 Unauthorized: Invalid or expired API key.
  • 400 Bad Request: Missing required fields like model or input.
  • 503 Service Unavailable: Temporary overload in the synthesis queue.

Retry logic for failures

Implement exponential backoff for transient 5xx errors. Since failed requests do not consume your credit, you can safely retry without financial penalty. For 4xx errors, verify your request payload before retrying to avoid repeated failures.

  • Retry on 503 with 1s, 2s, 4s intervals.
  • Do not retry 400 errors without payload correction.
  • Log all failures for billing audit.

Character limit errors

Each request supports a maximum of 4096 characters. Exceeding this limit returns a 400 error. Split your manuscript into chunks below this threshold, generate audio for each, and join the files client-side to produce the final audiobook chapter.

  • Limit: 4096 characters per request.
  • Includes spaces and punctuation.
  • Split logic should preserve sentence boundaries.

Long Text Processing

Sound wave illustration for: Long Text Processing

For audiobooks exceeding 4096 characters, you must split the input text into smaller chunks and process each separately. The API returns individual audio files for each segment, which you then join to create the final file.

This approach ensures reliable synthesis, as the engine processes requests sequentially. For long texts, generation takes roughly real-time (25 characters per second), so plan your workflow accordingly to avoid queue delays during peak usage.

Splitting text into chunks

Divide your manuscript into segments of up to 4096 characters. Ensure breaks occur at natural sentence boundaries to maintain audio continuity. Each chunk is sent as a separate POST request to the speech endpoint.

  • Calculate character counts including spaces and punctuation.
  • Maintain consistent voice and speed settings across all requests.

Joining audio files

The API returns distinct audio files for each chunk. You must concatenate these files locally or via your pipeline to produce the complete audiobook chapter or book.

  • Use tools like ffmpeg or standard audio libraries.
  • Ensure consistent format (e.g., all MP3 or WAV) before merging.

Managing 4096 character limit

Each request is strictly limited to 4096 characters. Exceeding this limit will result in an error. Plan your chunking strategy to minimize the number of API calls while staying within the constraint.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Credits are automatically added to your balance within minutes of transfer confirmation.

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. W3C WAI: making audio and video accessible
  3. FFmpeg documentation
  4. Node.js documentation
  5. LibriTTS-R corpus (OpenSLR 141)
  6. OpenAI API reference: create speech
  7. openai-node on GitHub
  8. IETF RFC 7845: Ogg Opus
  9. LibriTTS-R paper (arXiv 2305.18802)
  10. LibriVox public-domain audiobooks
  11. TRON developer hub: TRC-20
  12. openai-python on GitHub

More on this site