Developer Guide for Text to Human Voice API Integration

By VoiceFit API editorial team · Updated 2026-11-19

This guide explains how to integrate the VoiceFit API into fitness and meditation apps. You will learn to send text and receive audio files using standard HTTP requests or OpenAI-compatible SDKs. The documentation covers authentication, voice selection, and format options, providing concrete examples for rapid development.

Designed for startup engineers, this reference helps you convert scripts into human-like voiceovers for mobile and web platforms. We detail rate limits, error handling, and text-splitting strategies to ensure reliable audio generation. Follow these steps to implement calm narration or energetic cues with precise control over speed and language.

Developer Guide for Text to Human Voice API Integration

Frequently asked questions

Do I need to install a specific SDK?

No proprietary SDK is required. You can use any HTTP client or the official OpenAI SDKs. Simply configure your library to point to the API base URL https://api.2777bd.info/v1.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work seamlessly. You just need to change the base_url parameter to https://api.2777bd.info/v1 and provide your unique API key. The request shape matches the OpenAI speech endpoint, so your existing code structure remains largely unchanged after this configuration adjustment.

What is the maximum length of input text?

Each API request supports a maximum of 4096 characters in the input field. For longer scripts, you must split the text into chunks of up to 4096 characters, generate audio for each part, and then join the resulting audio files together in your application logic.

How do I handle rate limit errors?

Your key allows 60 requests per minute after the first top-up. If you exceed this, implement exponential backoff in your code. Note that new keys start with a limit of 10 requests per minute. Monitor your usage via the dashboard to avoid interruptions during high-volume generation.

Is the API endpoint secure?

Yes, the endpoint is https://api.2777bd.info/v1/audio/speech. Authentication is handled via the Authorization: Bearer tts-... header. Ensure you keep your API key secure and rotate it regularly. The API key is tied to your account balance and usage limits.

Can I stream the audio in real-time?

No, streaming or WebSocket support is not available. The API returns a complete audio file upon request completion. You must wait for the full response before processing the audio. This means you cannot play partial audio chunks while generation is still in progress.

Do you support SSML tags?

No, SSML support is not provided. The API accepts plain text input. You cannot use SSML tags to control pronunciation, pauses, or emphasis. Voice characteristics are determined by the selected preset voice and speed parameters rather than markup within the text string.

How do I specify a different language?

Include the language field in your request body with the ISO code. If omitted, the system guesses the language, defaulting to English for Latin script. For non-English Latin text, explicitly setting the language parameter ensures accurate pronunciation and correct voice selection.

What happens if I use an unsupported voice?

The API accepts eight specific presets: aria, nova, luna, sage, felix, milo, atlas, and orion. If you provide an invalid voice name, the request will likely fail or return an error. Always check the /v1/voices endpoint to retrieve the current list of valid voices.

Is the response format always JSON?

No, the response contains the audio file itself. Failed requests return an error JSON. The response_format parameter determines the audio type (mp3, wav, opus, flac, pcm). Headers will indicate the content type. You receive the binary audio data directly in the response body for immediate playback or storage.

Can I cancel a request mid-generation?

Requests are processed sequentially. If you send a request, you must wait for the response. There is no webhook or callback to notify you of completion, so you must handle timeouts in your client.

Do I need to handle audio concatenation?

Yes, if your text exceeds 4096 characters. You must split the text, send multiple requests, and then join the resulting audio files. The API does not automatically concatenate long texts. You are responsible for merging the audio segments in your application logic.

Is there a webhook for completion?

The API is synchronous; you receive the audio file directly in the response. You must wait for the request to complete before proceeding. There is no background processing notification, so your application must handle the wait time for generation.

How do I rotate my API key?

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. Ensure your application updates to use the new key before revoking the old one to prevent service interruption.

First request

curl

curl https://api.2777bd.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.2777bd.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.2777bd.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 and Keys

Sound wave illustration for: Authentication and Keys

Access the /get-api-key/ page to create your account via Google or email. Upon signing up, you receive a unique Bearer token starting with 'tts-'. This key authenticates all requests to the API base URL.

Generating Your API Key

Generating Your API Key

Navigate to the key management page on the site. Sign in using your preferred method. The dashboard displays your active key, current balance, and usage statistics immediately.

Bearer Token Usage

Bearer Token Usage

Include your key in the HTTP header for every request. Use the format: Authorization: Bearer tts-<your-key>. Ensure no extra spaces precede the token value to avoid authentication failures.

Key Rotation Policy

You can issue a new key at any time from the dashboard. The previous key stops working immediately upon generation. Rotate keys if you suspect exposure or for regular security practices.

Quickstart with cURL

Sound wave illustration for: Quickstart with cURL

Begin by sending a POST request to the speech endpoint. This method converts your fitness or meditation script into an audio file, allowing you to integrate voiceovers directly into your mobile app or web platform without managing complex audio infrastructure.

Basic POST Request

Send your text to https://api.2777bd.info/v1/audio/speech. Include your API key in the Authorization header as a Bearer token. The request body must be JSON.

Required JSON Fields

You must provide model (e.g., "tts-1"), input (your script text), and voice (e.g., "luna" for calm narration). Optional fields include response_format, speed, and language.

Response Handling

On success, the API returns the audio file directly in the response body. Failed requests return an error JSON and incur no charge. Ensure your client handles binary audio data correctly.

Using OpenAI SDKs

Sound wave illustration for: Using OpenAI SDKs

Leverage the official OpenAI SDKs by simply pointing them to our infrastructure. Since our endpoint mimics the standard speech API shape, you can reuse existing integration logic with minimal changes to your codebase.

Update the base URL to our API host and inject your unique API key. This approach allows fitness startups to integrate voiceovers into mobile apps without rewriting their entire audio generation pipeline.

Setting Base URL

Configure your SDK client to target our API domain. Replace the default OpenAI base URL with https://api.2777bd.info/v1. This ensures all requests route correctly to our speech synthesis engine.

Configuring Client

Initialize the client with your Bearer token obtained from the dashboard. The SDK handles authentication headers automatically when you provide the key. Ensure you use the standard tts-1 or tts-1-hd model identifiers.

  • Use the same request shape as the OpenAI speech endpoint.
  • Supports standard language and voice parameters.
  • Compatible with Python, Node.js, and other official SDKs.

Code Examples

Below is a Python snippet demonstrating the integration. It sends a text request for a meditation app and receives the audio binary.

```python import openai client = openai.OpenAI( base_url="https://api.2777bd.info/v1", api_key="tts-your-api-key" ) response = client.audio.speech.create( model="tts-1", voice="luna", input="Welcome to your calm session." ) response.stream_to_file("meditation.mp3") ```

Supported Audio Formats

Sound wave illustration for: Supported Audio Formats

Selecting the correct audio format ensures your fitness or meditation app delivers optimal audio quality without unnecessary bandwidth usage. Our TTS API supports four standard formats, allowing you to balance file size and fidelity based on your specific use case, such as background meditation tracks or energetic workout cues.

MP3 Compression

MP3 is the default and most widely compatible format. It offers efficient compression suitable for most mobile applications, keeping data usage low while maintaining clear voice reproduction for narration.

WAV Lossless

Choose WAV for uncompressed, high-fidelity audio. This format is ideal if you need raw audio data for further processing or editing in your production pipeline, ensuring no quality loss during generation.

Opus and FLAC Options

Opus and FLAC are available via the response_format parameter. Both are available via the response_format parameter.

Voice and Language Parameters

Sound wave illustration for: Voice and Language Parameters

Choose from eight presets tailored for fitness or meditation workflows. Female voices like Aria offer clear narration, while Luna suits storytelling. Male options include Felix for energetic cues and Atlas for neutral updates.

Each voice is distinct, ensuring your app’s audio matches the specific mood of the content without requiring additional customization.

Selecting a Voice Preset

Select one of eight voices based on your content type. Use Aria for warm, clear instructions or Felix for upbeat promo segments. Atlas provides a neutral tone suitable for news-style updates, while Orion offers a deep documentary style.

Voices are fixed presets; you cannot customize pitch or timbre beyond the selection.

  • Aria (warm narrator)
  • Nova (bright, upbeat)
  • Luna (soft storytelling)
  • Sage (calm instruction)
  • Felix (energetic promo)
  • Milo (friendly conversation)
  • Atlas (neutral news)
  • Orion (deep documentary)

Setting ISO Language Codes

Specify the language using a two-letter ISO code (e.g., 'en', 'de', 'es'). If omitted, the API guesses the language from the script, defaulting to English for Latin text. Always set the language for non-English Latin scripts to ensure accuracy.

Supported languages include Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, and Turkish.

  • English
  • Spanish
  • German
  • French
  • Italian
  • Japanese
  • Korean
  • Chinese
  • Arabic
  • Hindi
  • Russian
  • Portuguese
  • Turkish
  • Swedish
  • Danish
  • Norwegian
  • Dutch
  • Polish
  • Greek
  • Hebrew
  • Finnish
  • Malay
  • Swahili

Speed Adjustment Range

Adjust playback speed between 0.25 and 4.0. Use lower speeds for meditation guides to allow listeners to follow along, and higher speeds for quick fitness cues.

The default speed is 1.0. Changes apply immediately to the generated audio file without reprocessing.

  • Minimum: 0.25x
  • Default: 1.0x
  • Maximum: 4.0x
Voice and Language Parameters

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

Rate limits protect API stability during peak usage in your fitness app. Each API key allows 60 requests per minute, ensuring consistent performance for generating voiceovers during user sessions.

60 Requests Per Minute

You can send up to 60 synthesis requests per minute. This limit applies per API key, so manage concurrent calls carefully to avoid throttling during high-traffic periods.

Initial Lower Limit

New accounts start with a lower limit of 10 requests per minute. This threshold increases to 60 requests per minute after your first top-up.

Handling 429 Errors

If you exceed the limit, the API returns a 429 Too Many Requests error. Implement exponential backoff in your client to retry after a short delay, ensuring your app remains responsive.

Error Codes and Handling

Sound wave illustration for: Error Codes and Handling

The API returns standard HTTP status codes to indicate request outcomes. A 200 OK response confirms successful audio generation, while 4xx errors indicate client-side issues such as invalid keys or malformed JSON bodies. The 429 Too Many Requests code appears when you exceed the 60 requests per minute limit, requiring you to pause or implement exponential backoff logic.

Understanding these codes helps you debug integration issues quickly without needing external support. Always check the response body for specific error messages that detail the exact cause, ensuring your application handles failures gracefully before retrying.

Common HTTP Errors

Use standard HTTP status codes to determine the state of your synthesis job. A 401 Unauthorized error means your Bearer token is missing or invalid, while a 400 Bad Request indicates a malformed JSON payload. Ensure your request headers match the expected format exactly to avoid these common pitfalls.

  • 401: Invalid or missing API key
  • 400: Malformed JSON or missing required fields
  • 429: Rate limit exceeded (60 req/min)

Character Limit Exceeded

Each request supports a maximum of 4096 characters in the input field. If your script exceeds this limit, you must split the text into parts of up to 4096 characters and join the resulting audio files. You must split your text into smaller chunks, synthesize each part separately, and then join the resulting audio files using your preferred media library.

  • Max input length: 4096 characters
  • Spaces and punctuation count toward the limit
  • Split long texts and join audio files manually

Invalid Voice Name

The voice parameter must match one of the eight available presets exactly. Using an undefined voice name, such as 'custom-voice', will result in a 400 error. Refer to the /v1/voices endpoint to verify the correct voice IDs before sending your request, ensuring seamless integration with your app's audio output.

  • Valid voices: aria, nova, luna, sage, felix, milo, atlas, orion
  • Case-sensitive matching required
  • Check /v1/voices for the full list

Text Splitting Strategy

Sound wave illustration for: Text Splitting Strategy

Your API accepts a maximum of 4096 characters per request. For scripts exceeding this length, you must split the text into chunks and send multiple POST requests sequentially.

After receiving the audio files, concatenate them in the original order to produce a single continuous audio file for your app.

4096 Character Limit

Each API call processes up to 4096 characters, including spaces and punctuation. If your meditation script is longer, divide it into segments that respect this boundary to ensure successful synthesis.

  • Count spaces and punctuation toward the limit.
  • Send one request per chunk.
  • Maintain original segment order for joining.

Joining Audio Files

The API returns each chunk as a separate audio file. You are responsible for stitching these files together. Use standard audio libraries in your mobile app or web platform to merge them seamlessly.

Latency Considerations

Requests are processed sequentially. Under load, a request may wait in a queue before synthesis begins. For long texts, total generation time is roughly real time (about 25 characters per second), but requests are processed sequentially so under load a request may wait in a queue.

  • Processing is sequential, not parallel.
  • Queuing may occur during high demand.
  • Plan for extended load times in long scripts.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Short phrases typically take a few seconds to generate, while longer texts process at roughly real-time speed.

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-python on GitHub
  3. MDN: Web Speech API
  4. openai-node on GitHub
  5. LibriTTS-R corpus (OpenSLR 141)
  6. W3C WAI: making audio and video accessible
  7. IETF RFC 7845: Ogg Opus
  8. OpenAI API reference: create speech
  9. TRON developer hub: TRC-20
  10. ISO 639 language codes
  11. curl documentation
  12. Node.js documentation

More on this site