Text-to-Speech API: Integration Guide for Developers

By SpeakTone editorial team · Updated 2026-11-19

This guide helps content creators and language learning platforms integrate our cloud text-to-speech API. You will find everything needed to turn scripts into natural audio files using tools you already know. We cover authentication, request structures, and SDK compatibility so you can scale your voice content without complex infrastructure.

You can use the official OpenAI SDKs by simply changing the base URL. The documentation includes concrete examples for Python and cURL, explaining how to handle rate limits, errors, and audio format selection. Whether you are building a mobile app or a web platform, this page provides the exact endpoints and parameters to get started quickly.

Text-to-Speech API: Integration Guide for Developers

Frequently asked questions

How do I get an API key?

Sign up at https://wondercase.info/get-api-key/ using Google or email and password. Accounts are per site. The page displays your key, balance, trial status, and characters left. You can issue a new key at any time, which immediately stops the old one.

What is the base URL?

The API base URL is https://api.wondercase.info/v1. Send POST requests to https://api.wondercase.info/v1/audio/speech. Use GET /v1/voices for voice details and GET /v1/models for model information. Authentication requires an Authorization header with your Bearer token.

Which SDKs are supported?

The official OpenAI SDKs work by changing the base_url to https://api.wondercase.info/v1 and using your site key. We do not provide an official SDK of our own. You can also use plain HTTP requests or any standard HTTP client library.

How do I change the base URL?

Configure your SDK or HTTP client to point to https://api.wondercase.info/v1. For OpenAI SDKs, set the base_url parameter to this address. Ensure your Authorization header uses a key starting with 'tts-'. This directs requests to our specific infrastructure.

What models are available?

Two models are available: 'tts-1' and 'tts-1-hd'. They use the same engine and have the same price. You can list available models by sending a GET request to /v1/models. Both models support all eight voice presets and all supported languages.

What is the character limit?

Each request supports up to 4096 characters of input text. For longer texts, split them into parts of this size and join the resulting audio files. Spaces and punctuation count toward the character limit. Failed requests do not consume your character allowance.

How do I set the speed?

Include the 'speed' field in your request body with a value between 0.25 and 4.0. The default speed is 1.0. Adjusting speed affects the generation time but keeps the voice characteristics consistent. This allows you to create faster or slower narration.

What formats are supported?

Supported response formats are mp3, wav, opus, flac, and pcm. Specify your preferred format using the 'response_format' field in the request body. MP3 is suitable for web delivery, while WAV and FLAC offer lossless quality. PCM provides raw audio data.

What are the rate limits?

You are limited to 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. Requests are processed sequentially, so under load, you may experience queueing. Failed requests are free, but the rate limit applies to all requests.

How do I handle errors?

Failed requests are free, and the charge is returned in full. If synthesis fails, you will receive an error response without consuming characters. Check your balance and key validity. Ensure your text does not exceed 4096 characters per request.

Can I use the OpenAI SDK?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.wondercase.info/v1. Use your SpeakTone key (starting with 'tts-') for authentication. The request shape matches the OpenAI speech endpoint. This allows you to use familiar tools with our API.

Is there a curl example?

The /get-api-key/ page displays a ready curl example. It shows how to send a POST request with your key, model, voice, input text, and desired format. You can copy and modify this example to start generating audio immediately in your terminal.

How do I list voices?

Send a GET request to /v1/voices. This endpoint returns details about all eight voice presets, including their names, gender, and supported languages. You can also check available formats and pricing information through this same endpoint for quick reference.

What is the response format?

The response contains the generated audio file in your requested format (mp3, wav, opus, flac, or pcm). Each generated file carries an inaudible watermark that marks it as synthetic speech. The audio is returned directly in the response body for immediate use.

First request

curl

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

Authentication

Sound wave illustration for: Authentication

Access the SpeakTone API using a single active API key. You can generate or rotate this key directly from your account dashboard at /get-api-key/. Each account holds only one valid key at a time, ensuring simple and secure authentication without complex token management.

Your key identifies your account and tracks usage against your balance. Keep it secure, as anyone with the key can consume your credit. You can issue a new key at any moment; the previous one becomes invalid immediately, allowing instant revocation if needed.

API Key Usage

API Key Usage

Include your API key in the HTTP request header. The system validates this token against your account to authorize the request and deduct characters from your balance. Ensure the key is transmitted securely, preferably over HTTPS.

  • Start with 'Bearer ' followed by your key string.
  • Keys are unique to your account on wondercase.info.
  • One active key per account.

Bearer Token

Bearer Token

Use the standard HTTP Authorization header format. This ensures compatibility with most HTTP clients and SDKs. The token must be passed with every request to the speech endpoint.

The format is strict: 'Authorization: Bearer tts-xxxxx'. Do not include extra spaces or quotes unless required by your specific client library.

  • Header name: Authorization
  • Prefix: Bearer
  • Format: Bearer tts-your-api-key-here

Key Management

You can generate a new API key from your dashboard at any time. When you issue a new key, the old one stops working immediately. This is useful if you suspect a leak or need to rotate credentials for security.

There is no limit to how many times you can rotate your key. Each new key is valid until you generate another one.

Keep your key in environment variables or secure configuration files, not in public code repositories.

  • Rotate keys anytime via dashboard.
  • Old key invalidates immediately.
  • No limit on rotations.

Speech Endpoint

Sound wave illustration for: Speech Endpoint

To generate audio, send a POST request to https://api.wondercase.info/v1/audio/speech. The API accepts text input and returns an audio file directly in the response body, making integration straightforward for content creators and language learning platforms.

This endpoint handles the core synthesis task, converting your script into natural speech. You define the voice, speed, and output format within the JSON payload, allowing you to scale voice content without managing complex infrastructure.

POST Request

Send your synthesis request to the speech endpoint using the HTTP POST method. Ensure your API key is included in the Authorization header as a Bearer token to authenticate the request.

JSON Body

The request body must be valid JSON containing the text to be spoken and the desired voice settings. You can specify the model, voice preset, audio format, and optional speed or language parameters.

Keep input text under 4,096 characters. For longer scripts, split the text into parts and join the resulting audio files sequentially.

  • "model": "tts-1" or "tts-1-hd"
  • "input": your text string
  • "voice": e.g., "aria", "nova", "felix"
  • "response_format": mp3, wav, opus, flac, or pcm
  • "speed": 0.25 to 4.0

Response Format

On success, the API returns the audio file directly in the response body with the appropriate content type header. You can save this data to a file or stream it directly to your application.

If synthesis fails, the request is free, and the charge is returned in full. Check the status code and error message for details.

Parameters

Sound wave illustration for: Parameters

Configure your synthesis requests by selecting the engine model, choosing a specific voice preset, and adjusting the playback speed to match your content's pacing needs.

Model Selection

Use the model field to select between tts-1 or tts-1-hd. Both options utilize the same underlying engine and incur identical pricing, so you can switch freely without affecting your cost per character.

Voice Selection

Assign the voice parameter to one of eight presets, such as aria for warm narration or atlas for neutral news delivery. You can also optionally specify a language ISO code (e.g., de, ja) to ensure correct pronunciation, especially for Latin-script texts that aren't English.

  • aria: warm, clear narrator
  • nova: bright, upbeat
  • luna: soft, storytelling
  • sage: calm, instructional
  • felix: energetic, promo
  • milo: friendly, conversational

Speed Control

Adjust the speed parameter within the range of 0.25 to 4.0 to alter the audio tempo. This allows you to speed up language learning drills or slow down complex explanations without re-generating the entire file with a different voice.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

SpeakTone’s API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing OpenAI SDKs with minimal changes. You simply update the base URL to point to our API endpoint, enabling seamless integration into your current Python or JavaScript workflows without rewriting client logic.

This compatibility means you can generate natural audio files using the same familiar tools, scaling your content creation process efficiently. Whether you are building a language learning platform or generating voiceovers for scripts, the transition is straightforward and requires only a configuration adjustment.

Base URL Change

To use the OpenAI SDK with SpeakTone, change the base_url configuration to https://api.wondercase.info/v1. This directs all requests to our infrastructure while maintaining the standard request shape. Ensure your API key is passed via the Authorization header as Bearer tts-....

SDK Compatibility

The official OpenAI SDKs work directly because our endpoint accepts identical JSON bodies. You can use standard parameters like model, input, voice, and response_format. This compatibility extends to both Python and JavaScript SDKs, allowing you to leverage existing code structures for TTS generation without custom adapters.

Code Example

  • Initialize the OpenAI client with base_url='https://api.wondercase.info/v1' and your tts-... API key.
  • Call `client.audio.speech.create(model='tts-1', voice='nova', input='Hello world', response_format='mp3')`.
  • Save the binary response to an audio file for playback or distribution.
  • Handle potential rate limits by implementing simple retry logic for 429 status codes.

Audio Formats

Sound wave illustration for: Audio Formats

You choose the output format via the response_format field. This determines the encoding and compression of the generated audio file. Selecting the right format balances file size, quality, and compatibility with your target platform.

Our API supports five distinct formats, allowing you to optimize storage costs or ensure playback across diverse devices. All formats are generated with the same high-quality engine, differing only in their container and codec structure.

MP3 Support

MP3 is a widely supported audio format for web players and mobile apps. It offers a good balance between file size and audio quality, making it ideal for general content creation and language learning platforms.

Use mp3 for broad compatibility. The file size is smaller than uncompressed formats, reducing bandwidth costs during delivery.

  • Best for web players and mobile apps

WAV Support

WAV provides uncompressed, high-quality audio. It is ideal for professional editing workflows where lossless quality is required. Files are larger but retain full fidelity.

Use wav if you need to process the audio further in a Digital Audio Workstation (DAW).

  • Lossless quality
  • Ideal for editing

OPUS, FLAC, PCM

OPUS offers high-quality compression at small file sizes, suitable for streaming or efficient storage. FLAC provides lossless compression, smaller than WAV but identical in quality. PCM outputs raw, uncompressed audio data.

Choose OPUS for efficient storage, FLAC for archival quality, or PCM for direct signal processing.

  • OPUS: efficient compression
  • FLAC: lossless compression
  • PCM: raw audio data
Audio Formats

Rate Limits

Sound wave illustration for: Rate Limits

SpeakTone enforces a rate limit of 60 requests per minute per API key. This limit applies to all requests, including those that fail. Failed requests are free, but they still count toward your rate limit usage. If you exceed this limit, requests will be queued or rejected until the window resets.

60 Requests Per Minute

The standard rate limit is 60 requests per minute. This ensures fair usage across all accounts. If you need higher throughput, consider splitting long texts into smaller chunks or using multiple keys.

Initial Limit

New accounts start with a lower limit of 10 requests per minute. This applies until you make your first top-up. Once you add funds, your limit increases to the standard 60 requests per minute.

Limit Increase

To increase your rate limit, simply top up your account. The limit increases immediately after the transfer is confirmed. There is no maximum limit, so you can scale as needed.

Error Handling

Sound wave illustration for: Error Handling

Synthesis failures are free, so you won’t be charged for wasted characters. The API returns clear status codes to help you debug issues like invalid text or network timeouts quickly.

Common Errors

Most errors stem from exceeding the 4096-character limit or using an unsupported voice ID. Ensure your input text is valid and your API key is active. Failed requests are refunded instantly.

  • Input text exceeds 4096 characters
  • Invalid or expired API key
  • Unsupported voice ID provided

Status Codes

Standard HTTP codes indicate success (200) or client errors (400, 401, 429). A 429 error means you have hit the rate limit of 60 requests per minute.

  • 200: Success
  • 400: Bad Request
  • 401: Unauthorized
  • 429: Rate Limit Exceeded

Retry Logic

Implement exponential backoff for 429 errors to avoid hammering the server. Since requests are processed sequentially, brief pauses help prevent queueing delays during high load.

  • Wait 1 second before retrying
  • Double wait time on each failure
  • Stop after 5 attempts

Voices Endpoint

Sound wave illustration for: Voices Endpoint

The /v1/voices endpoint provides a complete list of available voice presets, their associated languages, supported audio formats, and pricing details. Use this endpoint to dynamically populate your application's voice selection menu before making synthesis requests.

This endpoint ensures you always have accurate information about which voices support which languages and formats, simplifying integration for content creators and language learning platforms.

GET /v1/voices

Send a GET request to https://api.wondercase.info/v1/voices with your Bearer token. The response returns a JSON object listing all 8 available voices, their metadata, and supported configurations.

This data helps you build a responsive UI that accurately reflects available options without hardcoding voice names or formats.

  • Returns JSON array of voice objects
  • Includes voice ID, name, gender, and supported languages
  • Shows supported output formats (mp3, wav, opus, flac, pcm)
  • Displays price per character for each voice

List Available Voices

The endpoint lists 8 distinct voice presets, categorized by gender and tone. Each voice has a unique ID used in the voice parameter of the speech endpoint.

You can filter or sort the results in your application to help users find the right voice for their content, such as choosing a calm voice for instructional videos or an energetic one for promotions.

  • 8 presets: aria, nova, luna, sage, felix, milo, atlas, orion
  • Clear categories: female (warm, bright, soft, calm) and male (energetic, friendly, neutral, deep)
  • Each voice is linked to a specific tone and use case
  • Voice IDs are stable and documented in the main endpoint

Language Support

All 8 voices can speak any of the 23 supported languages. The endpoint details which languages each voice supports, though technically any voice can handle any supported language.

If the language parameter is omitted in the speech request, the system guesses the language from the script. For non-English Latin-script text, explicitly set the language code to avoid misinterpretation.

  • 23 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
  • Any voice can speak any supported language
  • Language guessing defaults to English for Latin script
  • Explicit language code recommended for non-English Latin text

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Requests are sent via simple HTTP calls, allowing you to use tools you already know.

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. MDN: Web Speech API
  3. IETF RFC 7845: Ogg Opus
  4. Node.js documentation
  5. LibriTTS-R paper (arXiv 2305.18802)
  6. LibriVox public-domain audiobooks
  7. Tether (USDT)
  8. ISO 639 language codes
  9. OpenAI API reference: create speech
  10. LibriTTS-R corpus (OpenSLR 141)
  11. openai-node on GitHub
  12. W3C WAI: making audio and video accessible

More on this site