TTS API Quickstart: Keys, Endpoints & SDK Setup

By VoxCivic editorial team · Updated 2026-11-18

This documentation provides the technical specifications for the VoxCivic Text-to-Speech API, designed for engineering teams in government services and NGOs. You will find precise details on authentication, endpoint structures, and request parameters required to integrate audio generation into your accessibility pipelines. The guide covers the standard OpenAI-compatible request shape, allowing you to use existing SDKs by simply updating the base URL.

Readers will learn how to manage API keys, handle rate limits, and process large volumes of text efficiently. The page includes concrete code examples in cURL, Python, and JavaScript, along with troubleshooting steps for common errors. All technical details reflect the current API behavior, ensuring your team can deploy consistent, auditable speech synthesis without unnecessary infrastructure complexity.

TTS API Quickstart: Keys, Endpoints & SDK Setup

Frequently asked questions

How do I get an API key?

Sign up on /get-api-key/ using Google or email plus password. Accounts are per site. The dashboard displays your active key, balance, and usage statistics. You can issue a new key at any time, which immediately invalidates the previous one.

What is the base URL for the API?

The API base URL is https://api.u555play.com/v1. Send POST requests to /audio/speech for synthesis. Use GET /v1/voices to list available voices and GET /v1/models to view model details. All requests require a Bearer token in the Authorization header.

Which models are available?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and pricing. Select either model in your request body. The choice does not affect cost or voice options, only the specific audio generation parameters.

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

Both models use the same engine and incur the same price per character. There is no functional difference in cost or voice selection between them. Choose either based on your preference, as they generate audio with identical pricing structures.

How do I specify a voice?

Include one of eight presets in the voice field: aria, nova, luna, sage, felix, milo, atlas, or orion. You can also optionally specify a language ISO code. If omitted, the system guesses the language, defaulting to English for Latin script.

What are the rate limits?

Limits are 60 requests per minute per key. Before the first top-up, the limit is 10 requests per minute. Requests are processed sequentially, so load may cause queuing. Failed requests are free (no charge), but the rate limit behavior for failed requests is not explicitly defined as exempt.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Update the SDK base_url to https://api.u555play.com/v1 and use your VoxCivic key. Official OpenAI SDKs work directly without modification, allowing easy integration into existing Python or Node.js projects.

How do I handle long texts?

Split input text into parts of up to 4096 characters. Send each part as a separate request and join the resulting audio files. This ensures compliance with character limits while allowing you to process documents of any length efficiently.

What happens if the request fails?

Failed requests are free. The charge is returned in full if synthesis fails. You can retry the request without incurring additional costs. This ensures you only pay for successfully generated audio files, protecting your budget during unstable network conditions.

How is the API key secured?

Each account has one active key. You can issue a new key at any time, which immediately invalidates the old one. Pass the key via the Authorization: Bearer header. Store it securely in your environment variables or secret manager.

What formats can I request?

Request audio in mp3, wav, opus, flac, or pcm formats. Specify the desired format in the response_format field. The API returns the audio file directly in the response body, allowing immediate playback or storage without additional conversion steps.

Does the API support streaming?

No, the API does not support streaming, WebSocket, or real-time partial audio. Requests are processed sequentially, and you receive the complete audio file upon completion. This design ensures consistent, auditable output suitable for batch processing large document volumes.

First request

curl

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

VoxCivic authenticates API requests using a single Bearer token sent in the Authorization header. Each account holds one active key; transmitting the correct key grants access to all endpoints. Ensure your client library or HTTP request includes this header for every call.

Key rotation is immediate and atomic. Issuing a new key via the dashboard instantly invalidates the previous one. This allows zero-downtime rotation for large government teams or NGO deployments without interrupting ongoing synthesis jobs if managed correctly.

API Key Header

Include the header Authorization: Bearer tts-<your-key> in every request. The key identifies your account and applies the rate limit of 60 requests per minute.

The key is visible on your dashboard after signing in. It does not expire unless you rotate it or the account is suspended.

  • Header name: Authorization
  • Format: Bearer tts-<key>
  • Case-sensitive

Key Rotation

Generate a new key from the dashboard. The old key stops working immediately.

This is useful for security audits or when distributing keys to different sub-teams within an organization.

Security

Store keys in environment variables or secure secret managers. Do not expose them in client-side code or public repositories.

Request metadata is kept for billing but input text is not used for training.

  • No shared keys per endpoint
  • Single active key per account

Endpoints

Sound wave illustration for: Endpoints

The API exposes three primary endpoints for speech synthesis, voice configuration, and model details: POST /v1/audio/speech, GET /v1/voices, and GET /v1/models. All requests use JSON bodies and require the Authorization: Bearer header with your unique API key. Base URL: https://api.u555play.com/v1.

Speech Endpoint

POST /v1/audio/speech converts text to audio. Send a JSON body with model, input, voice, response_format, and optional speed or language. Returns the audio binary directly.

  • Endpoint: POST /v1/audio/speech
  • Accepts JSON; returns audio file

Voices Endpoint

GET /v1/voices lists available voices, supported languages, and formats. Use this to verify compatibility before synthesis. Supports 23 languages and 8 voice presets.

  • Endpoint: GET /v1/voices
  • Returns voice metadata and language support

Models Endpoint

GET /v1/models returns available model IDs (tts-1, tts-1-hd). Both use the same engine and pricing. Use this to confirm model availability for your integration.

  • Endpoint: GET /v1/models
  • Returns model IDs and metadata
Endpoints

Request Parameters

Sound wave illustration for: Request Parameters

Configure the synthesis request by selecting the model, voice, and input text. The API accepts standard parameters compatible with the OpenAI speech endpoint structure.

Model Selection

Choose between "tts-1" or "tts-1-hd". Both models use the same engine and pricing structure, allowing you to select based on quality preference without cost variation.

Voice Selection

Select one of eight preset voices from the GET /v1/voices endpoint. Voices are eight presets with specific characteristics (e.g., aria is a warm narrator, atlas is neutral news). If the language is not specified, the system guesses it from the script, defaulting to English for Latin text.

  • aria: warm, clear narrator
  • nova: bright, upbeat
  • atlas: neutral, news
  • orion: deep, documentary

Input Text

The input field accepts up to 4096 characters per request. Spaces and punctuation count toward this limit. For documents exceeding this length, split the text into parts and join the resulting audio files sequentially.

Response Format

Sound wave illustration for: Response Format

The API returns synthesized audio directly in the response body as binary data. The content type matches the requested response_format (e.g., audio/mpeg for MP3, audio/wav for WAV). Clients must handle this binary data appropriately, such as saving it to a file or piping it to a playback buffer. No additional JSON wrapper contains the audio itself.

Audio Binary

Audio data is delivered upon successful synthesis; typical speed is roughly real-time, but short phrases may take a few seconds. Ensure your client handles binary streams correctly to avoid corruption. Supported formats include MP3, WAV, OPUS, FLAC, and PCM.

Error Codes

Errors are returned as standard HTTP status codes with a JSON body describing the issue. Failed requests incur no charge, and the balance remains unchanged. Common errors include invalid input parameters, malformed JSON, or unsupported voice IDs.

  • 400 Bad Request: Invalid input parameters or malformed JSON.
  • 401 Unauthorized: Missing or invalid API key.
  • 429 Too Many Requests: Exceeded 60 requests per minute limit.
  • 500 Server Error: Internal synthesis failure; retry is recommended.

Metadata

While the audio is binary, the HTTP response headers may contain usage metadata for debugging. Request metadata, including timestamp and character count, is logged server-side for billing purposes but is not included in the immediate response payload.

Rate Limits

Sound wave illustration for: Rate Limits

VoxCivic enforces a rate limit of 60 requests per minute for established keys. New accounts without a top-up start with a reduced limit of 10 requests per minute. Each API call, whether successful or failed, consumes one unit of this allowance.

Requests Per Minute

Each request consumes one unit of your per-minute allowance. This limit applies per API key, so multiple keys can parallelize throughput. If you exceed 60 requests per minute, subsequent requests will receive a 429 Too Many Requests error until the window resets.

Queue Behavior

Requests are processed sequentially within the processing pipeline. Under heavy load, a request may wait in a queue before synthesis begins. This can increase latency, particularly for longer texts, as the system processes jobs one after another rather than in parallel batches.

Burst Limits

There is no specific hard cap on burst size beyond the per-minute limit. However, because processing is sequential, a sudden burst of 60 requests will result in significant queuing delay. For consistent throughput, spread requests evenly across the minute.

Rate Limits

Code Examples

Sound wave illustration for: Code Examples

The API accepts standard JSON bodies, allowing you to use existing OpenAI SDKs by simply pointing them to the VoxCivic base URL. This ensures consistent behavior across languages without requiring custom client libraries.

Below are minimal examples for generating speech. Each request includes the required model, input, and voice fields. Responses return binary audio data directly.

cURL Command

Use this command to test the endpoint immediately. Replace YOUR_API_KEY with your key from the dashboard.

```bash curl -X POST https://api.u555play.com/v1/audio/speech \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "Text to speak", "voice": "nova", "response_format": "mp3"}' \ --output speech.mp3 ```

Python SDK

Install the OpenAI Python package. Configure the client to use the VoxCivic API base URL. The usage mirrors the standard OpenAI TTS interface.

```python from openai import OpenAI client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.u555play.com/v1") response = client.audio.speech.create( model="tts-1", voice="nova", input="Text to speak" ) response.stream_to_file("output.mp3") ```

JavaScript SDK

Import the OpenAI JavaScript package and set the base URL to the VoxCivic API endpoint. Pass your API key and generate the audio file.

```javascript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.u555play.com/v1' }); const response = await client.audio.speech.create({ model: 'tts-1', voice: 'nova', input: 'Text to speak' }); const buffer = await response.arrayBuffer(); ```

Troubleshooting

Sound wave illustration for: Troubleshooting

This section addresses frequent integration hurdles, focusing on validation failures and latency issues that commonly arise during high-volume document processing for accessibility workflows.

Common Errors

A 401 error indicates an invalid or expired API key. Ensure the header is correctly formatted as Authorization: Bearer tts-.... If you rotated your key, the old one becomes invalid immediately, so verify your credentials in the dashboard before retrying.

  • 400: Invalid JSON or missing required fields like input or voice.
  • 402: Insufficient balance; top-up via USDT (TRC-20) to resume service.
  • 429: Rate limit exceeded (60 requests/minute); implement exponential backoff.

Timeouts

Short phrases typically generate in seconds, but long documents may experience delays due to queue processing. Requests are handled sequentially under load.

  • Increase client-side timeout to at least 30 seconds for complex requests.
  • Monitor the HTTP status code to distinguish between processing and failure.

Invalid Inputs

The API rejects text exceeding 4096 characters per request. Ensure your input is within limits and that the language code matches the text script if not English.

  • Unsupported languages return a 400 error; verify against the 23 supported list.
  • Special characters are supported, but ensure proper JSON encoding.
Troubleshooting

Best Practices

Sound wave illustration for: Best Practices

Optimize workflow efficiency by handling input limits and response reliability correctly. These practices ensure consistent audio generation for large document batches without unnecessary API overhead.

Chunking Long Text

Split text into segments of 4096 characters or fewer. Generate each segment separately and join the resulting audio files to create a continuous output. This prevents truncation and allows for parallel processing if needed.

Error Handling

Implement retry logic for transient failures. Failed requests are free, so you can safely retry without incurring extra charges. Always check the HTTP status code and response body for specific error details before retrying.

Caching

Cache generated audio files for identical text inputs to reduce redundant API calls. Since the API is deterministic, the same input text and voice will produce the same output, allowing you to serve cached audio for repeated requests.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Our team unites government services and NGOs to deliver meaningful public outcomes for every citizen served.

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

More on this site