Text-to-Speech API for Government Teams: Documentation

By PublicVoice editorial team · Updated 2026-11-18

This documentation provides the essential reference for integrating the PublicVoice TTS API into your government or NGO workflows. You will find clear specifications for generating audio files from text, covering authentication, parameter configuration, and rate limits. The guide is designed for technical teams who need reliable, affordable text-to-speech capabilities for public announcements and accessible content creation.

We use standard OpenAI-compatible endpoints, so existing SDKs work with minimal changes. You can generate audio in 23 languages using eight distinct voice presets, with full control over speed and output format. This page details the technical requirements to help you deploy synthesis solutions efficiently within your existing infrastructure.

Text-to-Speech API for Government Teams: Documentation

Frequently asked questions

How do I get my API key?

Sign up on the /get-api-key/ page using Google or an email and password. Your account is specific to this site. Once registered, you receive a Bearer token starting with 'tts-' to authenticate your requests. You can issue a new key at any time, which immediately invalidates the previous one.

Can I use the OpenAI SDK with your API?

Yes. Our endpoint matches the OpenAI speech endpoint shape. Simply change the SDK's base_url to https://api.play66mb.com/v1 and use your Civichord API key. This allows you to use official OpenAI SDKs without needing a custom client library or complex configuration adjustments.

What is the maximum text length per request?

Each request supports up to 4096 characters of input text. For longer documents, split your text into chunks of this size and join the resulting audio files. Spaces and punctuation count toward this character limit, so plan your splits accordingly to ensure complete sentences.

How do I set the voice language?

Send the optional 'language' field with an ISO code in your JSON body. If omitted, the system guesses the language, defaulting to English for Latin script. Explicitly setting the language is recommended for non-English text to ensure accurate synthesis across our 23 supported languages.

What happens if I exceed the rate limit?

You are limited to 60 requests per minute per key (10 per minute before the first top-up). Requests are processed sequentially, so exceeding limits may cause delays as your request waits in the queue. Failed requests are free.

Can I change my API key?

Yes, you can issue a new API key at any time from your account dashboard. When you generate a new key, the old one stops working immediately. This ensures secure access management for your government team or NGO without needing to wait for manual approval.

How do I handle audio streaming?

We do not offer streaming, WebSocket, or real-time partial audio. The API is synchronous: you send text and receive the complete audio file in the response. For long texts, you must split the input, generate each part, and join the files on your end.

Is the API synchronous or asynchronous?

The API is synchronous. You send a POST request and wait for the complete audio file in the response. Requests are processed one after another, so under load, your request may wait in a queue. This ensures you receive the full file before proceeding.

Do I need to install a specific SDK?

No. You can use the official OpenAI SDKs by adjusting the base_url, or use plain HTTP requests. We do not provide a proprietary SDK, mobile SDK, or WordPress plugin. Standard HTTP libraries in any language are sufficient to integrate our text-to-speech capabilities into your workflow.

How do I detect errors in the response?

Check the HTTP status code and response body for error details. Failed synthesis requests are free, meaning the charge is returned in full. You can also monitor your usage dashboard for any anomalies. Ensure your input text is within the 4096-character limit to avoid errors.

Can I use the same key for multiple projects?

Yes, one active key per account can be used across multiple projects. The rate limit of 60 requests per minute applies to the key itself, shared across all uses. You can monitor your usage and characters left directly from the account dashboard to manage load.

How do I calculate character count accurately?

Count every character, including spaces and punctuation. The price is $0.01 per 1,000 characters. Ensure your text does not exceed 4096 characters per request. Accurate counting helps you manage your budget effectively, especially when processing large documents for public announcements or accessible content.

Is the API available 24/7?

We do not provide an SLA or uptime guarantee. The API is generally available, but requests may queue under load. For critical government services, consider implementing retry logic in your integration to handle potential delays or temporary unavailability without disrupting your workflow significantly.

How do I test my integration?

Sign up to receive $0.50 in trial credit, valid for 7 days. Use the provided curl example on the /get-api-key/ page to send a test request. This allows you to verify voice selection, language settings, and audio format outputs before committing to larger document processing tasks.

First request

curl

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

The API key is the sole credential for authenticating your requests. Generate yours on the /get-api-key/ page by signing in with Google or creating an email account. Each account holds one active key at a time, which appears alongside your balance and usage statistics.

API Key Generation

API Key Generation

Keys are created instantly upon account setup. Use the key displayed in your dashboard for all API calls. If you lose access or suspect a breach, you can generate a new key immediately.

Bearer Token Format

Bearer Token Format

Include your key in the Authorization header using the Bearer scheme. The format is Authorization: Bearer tts-your-api-key-here. Ensure no extra spaces or characters are included in the token string.

Key Rotation

You may issue a new key at any time via the dashboard. When a new key is generated, the previous one stops working immediately. This ensures tight control over access for large government teams without waiting for expiration periods.

Base URL

Sound wave illustration for: Base URL

All API requests are directed to https://api.play66mb.com/v1. This base URL serves as the foundation for both the speech synthesis endpoint and the metadata endpoints that list available voices and models. Using a consistent base ensures your government or NGO applications can easily switch between standard HTTP calls and our compatible SDK wrappers.

Endpoint Structure

The primary endpoint for generating audio is POST https://api.play66mb.com/v1/audio/speech. This endpoint accepts JSON payloads containing your text, chosen voice, and desired output format. For management tasks, such as retrieving the list of 23 supported languages and 8 voice presets, use GET https://api.play66mb.com/v1/voices.

OpenAI SDK Compatibility

Our endpoint structure mirrors the OpenAI speech API, allowing you to use the official OpenAI SDKs with minimal configuration. Simply update the base_url to https://api.play66mb.com/v1 and provide your Civichord API key. This compatibility lets government teams leverage existing codebases and familiar developer workflows without learning a new proprietary protocol.

Versioning

The API version is embedded directly in the base URL path (/v1/). Currently, we support version 1 of the speech endpoint. By including the version in the path, we ensure clear separation between different API iterations. If we introduce breaking changes in future versions, they will be accessible via new path segments (e.g., /v2/).

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts text input up to 4,096 characters per request. For longer documents, split the text into chunks and join the resulting audio files. Spaces and punctuation count toward this limit.

Use "tts-1" for standard quality or "tts-1-hd" for enhanced clarity. Both engines use the same pricing and voice presets.

Model Selection

Select "tts-1" for standard generation or "tts-1-hd" for higher fidelity. Both models share identical pricing and voice options, allowing you to switch without changing your integration logic.

  • tts-1: Standard quality, real-time speed
  • tts-1-hd: Enhanced clarity, same price

Input Text Limits

Each request supports a maximum of 4,096 characters. Longer texts must be split into smaller segments. The API does not handle chunking automatically; your application should join the resulting audio files.

Voice Selection

Choose from eight presets tailored for clear public communication. Voices include female options like Aria and Nova, and male options like Felix and Atlas. Any voice can speak any of the 23 supported languages.

  • Aria: Warm, clear narrator
  • Nova: Bright, upbeat
  • Felix: Energetic, promo
  • Atlas: Neutral, news

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in five standard formats, allowing you to choose the best balance between file size and compatibility for your government or NGO distribution channels. Each request must specify the desired format via the response_format parameter.

MP3 Output

MP3 is one of the available formats and offers the best compression for web delivery and mobile apps. It is ideal for public announcement systems where bandwidth might be limited, ensuring fast loading times for digital signage or online accessibility portals.

WAV Output

WAV provides uncompressed audio. Use this format when you need pristine quality for archival purposes or integration with legacy broadcasting equipment that does not support compressed codecs. Files will be larger, so plan your storage accordingly.

Opus and FLAC Options

Opus offers superior compression for voice, making it excellent for low-bandwidth mobile data connections in field operations. FLAC provides lossless compression, retaining all audio data, suitable for high-quality internal archives.

Speed Control

Sound wave illustration for: Speed Control

The API accepts a speed parameter ranging from 0.25 to 4.0, allowing government teams to precisely adjust the playback rate of generated audio files. This feature ensures that public announcements, emergency alerts, or accessible content for visually impaired citizens are delivered at a comfortable, understandable pace.

Speed Range

Values below 1.0 slow the speech, while values above 1.0 accelerate it. The default speed is 1.0. You can fine-tune this for different dialects or accessibility needs within the 23 supported languages.

Adjusting Pace

Include the speed field in your JSON request body alongside model, input, and voice. For example, set speed: 0.8 for slower, clearer announcements in community settings, or speed: 1.2 for quick status updates.

Impact on Quality

Extreme speeds may slightly alter natural intonation but remain intelligible. Requests are processed sequentially, so under load a request may wait in a queue.

Speed Control

Error Handling

Sound wave illustration for: Error Handling

When a request fails, the API returns an error code and the charge is returned in full. This ensures you are never billed for audio that was not successfully generated. Common issues include invalid model names or exceeding the 4096 character input limit.

Common Error Codes

Use standard HTTP status codes to diagnose issues. A 400 error indicates invalid parameters, such as an unsupported voice or format. A 401 error means your API key is missing or invalid. A 500 error suggests a temporary server issue, which you can retry.

  • 400 Bad Request: Invalid input parameters.
  • 401 Unauthorized: Invalid or expired API key.
  • 500 Internal Server Error: Temporary service issue.

Rate Limit Errors

You are limited to 60 requests per minute per key. If you exceed this, you receive a 429 Too Many Requests error. New accounts start with a 10 requests per minute limit until the first top-up is processed.

  • Standard limit: 60 requests/minute.
  • New account limit: 10 requests/minute.
  • Limit resets every 60 seconds.

Retry Logic

Implement exponential backoff for 429 and 500 errors. Since requests are processed sequentially, long texts may queue behind other users. Retry after a short delay to avoid overwhelming the queue during peak usage.

  • Use exponential backoff for retries.
  • Retry on 429 and 500 errors.
  • Wait briefly to respect queue order.

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a strict rate limit of 60 requests per minute per key, ensuring stable performance for large government teams. Before your first top-up, this limit is lower at 10 requests per minute, which is suitable for initial testing but may require pacing during bulk audio generation projects.

Requests Per Minute

Each API key is capped at 60 requests per minute. This limit applies across all concurrent connections from your account. If you exceed this threshold, the API will reject further requests until the window resets.

  • Standard limit: 60 requests/minute.
  • Pre-top-up limit: 10 requests/minute.
  • Limit is per key, not per IP.

Queue Behavior

Requests are processed sequentially. Under heavy load, your synthesis job may wait in a queue before processing begins. Longer texts take more time to generate, roughly real-time speed, so plan your submission schedule accordingly to avoid delays in your announcement pipeline.

Burst Limits

There is no separate hard burst limit beyond the per-minute cap. However, sudden spikes in traffic may cause temporary throttling if the server is already busy processing previous requests. For consistent throughput, space out your API calls evenly rather than sending them all at once.

Example Code

Sound wave illustration for: Example Code

Integrate public announcement systems quickly with these ready-to-use snippets. Use the provided curl command for immediate testing or embed the Python and JavaScript examples directly into your internal tools for automated document-to-audio workflows.

Ensure your API key is correctly formatted as a Bearer token in the Authorization header. These examples demonstrate the standard request structure compatible with the OpenAI SDK or raw HTTP clients.

Curl Example

Send a simple synthesis request to generate MP3 audio from text. Replace YOUR_API_KEY with your actual key from the dashboard.

Python OpenAI SDK

Use the official OpenAI Python library by pointing it to our base URL. This allows you to handle audio bytes directly in your Python scripts for backend processing.

JavaScript Example

Integrate TTS into web dashboards or notification systems using the fetch API. The example shows how to handle the audio stream response for immediate playback or download.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Each account has one active key, which can be regenerated at any time.

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. LibriVox public-domain audiobooks
  3. Tether (USDT)
  4. openai-node on GitHub
  5. W3C WAI: making audio and video accessible
  6. LibriTTS-R paper (arXiv 2305.18802)
  7. FFmpeg documentation
  8. Python documentation
  9. TRON developer hub: TRC-20
  10. LibriTTS-R corpus (OpenSLR 141)
  11. curl documentation
  12. openai-python on GitHub

More on this site