Complete API Documentation for Text to Speech Synthesis

By ZenVoice editorial team · Updated 2026-11-19

This documentation provides a complete reference for integrating the ZenVoice API into meditation and wellness applications. It covers authentication, endpoints, parameters, and error handling, enabling product teams to turn scripts into calming or energizing audio efficiently.

Designed for developers building fitness platforms, this guide explains how to use the OpenAI-compatible SDK, handle long texts, and manage rate limits. You will find concrete examples for Python and JavaScript, along with details on voice selection and output formats.

Complete API Documentation for Text to Speech Synthesis

Frequently asked questions

How do I authenticate with the API?

Send your API key in the request header as Authorization: Bearer tts-.... You receive one active key per account. If you issue a new key, the previous one stops immediately. This ensures secure access for your meditation app’s audio generation workflows.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Change the SDK’s base_url to https://api.299bt.info/v1 and use your site’s key. This allows you to leverage existing OpenAI SDK code for your wellness platform’s audio integration.

What is the maximum text length?

Each request supports up to 4096 characters. Spaces and punctuation count toward this limit. For longer scripts, split the text into parts and join the resulting audio files. This ensures consistent audio quality for extended meditation sessions.

How do I change the API base URL?

Update your client configuration to point to https://api.299bt.info/v1. This is required when using the OpenAI SDK or making direct HTTP requests. Ensure your authentication header remains valid for this specific base URL to avoid connection errors.

What voices are available?

Eight presets are available: Aria, Nova, Luna, and Sage (female); Felix, Milo, Atlas, and Orion (male). Voices are based on licensed recordings from LibriTTS-R and LibriVox. Each voice offers a distinct tone suitable for different meditation or fitness contexts.

How do I get a list of voices?

Make a GET request to /v1/voices. This endpoint returns available voices, languages, formats, and pricing details. Use this data to dynamically populate your app’s voice selection interface, ensuring users choose the most appropriate tone for their content.

What happens if I hit the rate limit?

The limit is 60 requests per minute per key (10 before the first top-up). Requests are processed sequentially, so exceeding the limit may cause queuing delays. Monitor your usage via the dashboard to maintain smooth audio generation for your users.

Are failed requests free?

Yes. If synthesis fails, the charge is returned in full. This protects your budget during testing or if temporary network issues occur. You only pay for successfully generated audio files, ensuring cost efficiency for your product team.

How do I handle long texts?

Split texts into chunks of up to 4096 characters. Generate audio for each chunk separately, then join the files. This approach manages the character limit while maintaining audio continuity for longer guided meditations or fitness instructions.

What audio formats are supported?

Supported formats include MP3, WAV, OPUS, FLAC, and PCM. Choose based on your app’s playback requirements. MP3 offers compression, while WAV and FLAC provide higher fidelity. OPUS is a supported format for efficient compression.

Can I use OPUS format?

Yes, OPUS is a supported response format. It provides efficient compression suitable for web delivery. Select it via the response_format parameter in your request body. This helps reduce bandwidth usage while maintaining acceptable audio quality for your users.

How do I rotate my API key?

Issue a new key from your account dashboard. The new key becomes active immediately, and the old one stops working at once. This allows seamless rotation without downtime. Revoke the old key if it was compromised or is no longer needed.

What is the speed range?

Speed ranges from 0.25 to 4.0. Adjust this parameter to control the pacing of the speech. Slower speeds suit meditation, while faster speeds work for fitness cues. This flexibility helps tailor the audio experience to your specific content type.

Do I need to specify the language?

It is optional. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language parameter to ensure accurate pronunciation and tone for your global audience.

First request

curl

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

ZenVoice API secures your integration with a single Bearer token. Pass this key in the Authorization header of every request to the API base URL. This token is the only credential needed to authenticate your account and access your generated audio assets.

Bearer Token Usage

Bearer Token Usage

Include your token as Authorization: Bearer tts-... in every HTTP request. The API validates this header before processing synthesis. If the token is missing or invalid, the request fails immediately without consuming characters from your balance.

One Key Per Account

One Key Per Account

Each account holds exactly one active API key. You cannot generate multiple simultaneous keys for the same account. All requests using this key share the same rate limits and billing history, ensuring simple tracking for your product team.

Key Rotation

You can issue a new key at any time via your dashboard. When a new key is generated, the previous one stops working immediately. This allows you to revoke access instantly if a key is compromised without waiting for expiration.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

The ZenVoice API provides three core endpoints to manage synthesis and discovery. The primary endpoint handles audio generation, while the discovery endpoints list available voices and model configurations. All requests require a Bearer token in the Authorization header.

POST /v1/audio/speech

Send text and receive an audio file. This endpoint accepts JSON with fields like model, input, voice, and response_format. It supports up to 4096 characters per request and returns the synthesized audio directly in the response body.

GET /v1/voices

Retrieve a list of all available voice presets, their associated languages, supported formats, and pricing details. This helps product teams select the right tone, such as Luna for storytelling or Felix for energetic promos, without making unnecessary API calls.

GET /v1/models

Fetch the current model identifiers and configurations. This endpoint returns the available models, such as tts-1 and tts-1-hd, allowing developers to verify supported engines and ensure compatibility with their integration setup.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts two model variants: tts-1 and tts-1-hd. Both use the same underlying engine and pricing, allowing you to switch quality levels without changing your integration logic. This consistency simplifies development for meditation and fitness apps where audio fidelity matters but cost predictability is key.

Model Selection

Send either tts-1 or tts-1-hd in the model field. There is no performance difference in latency or voice characteristics; the choice is purely for future-proofing or specific format requirements. Both models support the full range of voices and languages described in the voices endpoint.

Input Text Limit

Each request accepts up to 4096 characters for the input field. Spaces, punctuation, and emojis count toward this limit. For longer scripts, such as full meditation sessions, split the text into chunks and join the resulting audio files sequentially. This ensures consistent generation speed and avoids timeout errors.

  • Maximum 4096 characters per request
  • Spaces and punctuation count as characters
  • Split longer texts manually or via SDK

Voice Choice

Select from eight licensed voices: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, or Orion. Each voice has a distinct tone, from calm narration to energetic prompts. Use the GET /v1/voices endpoint to see available options. You can also optionally specify a language ISO code to guide the synthesis engine, though it often guesses correctly from the script.

  • 8 distinct voice presets available
  • Voice selection via voice parameter
  • Optional language code for non-English Latin text
  • All voices support 23 languages

Response Formats

Sound wave illustration for: Response Formats

The API returns audio in standardized formats, allowing your meditation or fitness app to handle playback efficiently. Each format balances file size, compatibility, and quality, ensuring smooth delivery to your users without unnecessary data overhead.

MP3 Output

MP3 is a widely supported format, suitable for playback on iOS and Android devices. It offers a good balance between file size and audio quality, making it suitable for on-demand playback in wellness applications.

WAV Output

WAV provides uncompressed, high-fidelity audio perfect for offline playback or archival purposes. Use this format when you need the highest possible quality without compression artifacts, such as for premium meditation sessions or high-end fitness equipment.

OPUS and FLAC Options

OPUS is a supported format that offers efficient compression. FLAC provides lossless compression, preserving every detail of the synthetic voice for professional editing or high-res audio players without the bulk of uncompressed WAV files.

Rate Limits

Sound wave illustration for: Rate Limits

Rate limits ensure fair usage and stable synthesis performance. Your API key allows 60 requests per minute, sufficient for most production workflows. Requests are processed one after another, so under load a request may wait in a queue.

New accounts begin with a lower threshold of 10 requests per minute until the first top-up is processed. This prevents sudden load spikes during initial testing phases.

60 Requests Per Minute

The standard limit is 60 requests per minute per key. Each request consumes one unit of this quota, regardless of text length or voice selected. This allows for rapid iteration during development and smooth operation in live meditation or fitness apps.

10 Requests Before Top-Up

Accounts starting with the free trial credit are restricted to 10 requests per minute. This limit lifts automatically once a USDT top-up is confirmed on the TRON network. It ensures stable performance even for new users testing the API.

Queue Handling

Requests exceeding the per-minute limit are placed in a processing queue. They are handled sequentially, which may introduce slight delays during high traffic. Typical generation speed is roughly real-time, so queueing usually adds minimal latency for short phrases.

  • Requests are processed in the order received.
  • Delays are proportional to queue length and text duration.
Rate Limits

Error Handling

Sound wave illustration for: Error Handling

When synthesis fails, the API returns a standard HTTP error code along with a descriptive message. These errors typically stem from invalid parameters, such as an unsupported voice or malformed JSON, rather than service outages. Check the response body for specific details to correct your request payload immediately.

Common Error Codes

The most frequent issues involve exceeding the 4096-character input limit or providing an invalid voice identifier. A 400 Bad Request indicates a syntax error, while a 401 Unauthorized signals an expired or incorrect Bearer token. Always validate your input payload before sending it to the endpoint.

  • 400: Invalid JSON or missing required fields
  • 401: Invalid or expired API key
  • 429: Rate limit exceeded (60 req/min)
  • 500: Internal server error during synthesis

Retry Logic

Implement exponential backoff for transient 5xx errors, starting with a 1-second delay and doubling for each subsequent attempt. Since requests are processed sequentially, avoid parallel retries to prevent duplicate charges. Limit retries to three attempts before alerting your product team.

Free Failed Requests

If synthesis fails, the charge is returned in full. This applies to both API errors and transient processing failures. You can verify the status of any request through your account dashboard, where failed attempts are clearly marked as zero-cost, ensuring your meditation app's budget remains accurate.

SDK Integration

Sound wave illustration for: SDK Integration

The API mirrors the OpenAI speech endpoint structure, allowing teams to leverage existing OpenAI SDKs with minimal code changes. This compatibility simplifies integration for product teams already familiar with standard TTS workflows, ensuring a smooth transition from script to audio without learning a new client library.

By adjusting the base URL, developers can use their preferred SDK to handle requests efficiently. This approach maintains consistency with industry standards while providing the specific voice options and licensing details relevant to meditation and fitness applications.

OpenAI SDK Compatibility

The endpoint accepts the same request shape as the OpenAI speech API. This means you can use the official OpenAI SDKs for Python or JavaScript by changing the base URL. Simply point the client to our base URL and pass your API key.

  • Compatible with official OpenAI Python and JS SDKs
  • Same request structure as OpenAI /v1/audio/speech
  • No custom client library required

Base URL Configuration

Configure your SDK client to use https://api.299bt.info/v1 as the base URL. This directs all requests to our infrastructure while maintaining the standard JSON format. Ensure your Authorization header includes your Bearer token prefixed with tts-.

  • Base URL: https://api.299bt.info/v1
  • Auth Header: Bearer tts-<your-key>
  • Standard JSON body format

Python and JS Examples

Below are minimal examples showing how to initialize the client and generate audio. These snippets demonstrate the simplicity of integrating ZenVoice into your existing meditation or fitness app codebase.

```python import openai client = openai.OpenAI(base_url="https://api.299bt.info/v1", api_key="tts-...") response = client.audio.speech.create(model="tts-1", voice="luna", input="Relax and breathe.", response_format="mp3") response.write_to_file("output.mp3") ```

Long Text Handling

Sound wave illustration for: Long Text Handling

Generating audio for longer meditation scripts or fitness routines requires handling text that exceeds the single-request limit. The API processes input in discrete chunks, ensuring consistent voice quality throughout the entire session.

Character Limits

Each API call accepts a maximum of 4,096 characters, including spaces and punctuation. This limit applies per request, so longer scripts must be divided before submission to ensure successful synthesis.

Splitting Text

Split your script into logical segments, such as individual meditation instructions or exercise cues. Ensure each part stays within the 4,096-character boundary. This approach allows your application to manage the flow of audio segments seamlessly.

Joining Audio

Once you receive the audio files for each segment, your backend can concatenate them into a single continuous track. This method maintains the natural pacing of the voice without requiring complex streaming infrastructure, keeping integration simple for product teams.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This tone aligns well with structured yoga instructions or reflective journaling prompts that require a grounded atmosphere.

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

More on this site