API Documentation for Voice Synthesis Integration

By DubSync AI editorial team · Updated 2026-11-19

This documentation provides the technical specifications for the DubSync AI text-to-speech API, designed for localization agencies and developers integrating voice synthesis into automated dubbing pipelines. You will find precise details on endpoint structures, supported models, and language handling to ensure seamless compatibility with your existing content workflows.

We cover essential integration topics including authentication, rate limits, and error handling, along with ready-to-use code examples in Python, Node.js, and cURL. This guide assumes you have already generated an API key via the dashboard and is intended for engineers building reliable, programmatic audio generation systems without manual overhead.

API Documentation for Voice Synthesis Integration

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.h251.info/v1. You can use this endpoint to send POST requests for audio synthesis or GET requests to retrieve available voices and models. This URL is consistent for all API interactions, ensuring your integration remains stable and predictable across different endpoints.

How do I authenticate my requests?

Include your API key in the Authorization header as a Bearer token: Authorization: Bearer tts-.... Each account has one active key at a time. If you issue a new key, the previous one stops working immediately. Ensure your key is valid to avoid 401 errors.

Which audio formats does the API support?

The API supports mp3, wav, opus, flac, and pcm formats. Specify your preferred format using the response_format field in the request body. This flexibility allows you to integrate the generated audio directly into your existing localization pipelines without needing additional conversion steps.

Can I use the OpenAI SDK with this API?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.h251.info/v1 and using your site's key. The request shape matches the OpenAI speech endpoint exactly. This allows you to reuse existing code and libraries with minimal configuration changes.

How do I specify the language for the speech?

Pass an optional ISO language code in the language field. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly setting the language field ensures accurate pronunciation and voice selection.

What is the character limit per request?

Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. If your text exceeds this length, you must split it into multiple requests and join the resulting audio files to create the final output.

How many requests can I make per minute?

You are limited to 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. This rate limit ensures fair usage and system stability. Exceeding the limit may result in temporary throttling until the window resets.

Does the API support streaming audio?

No, the API does not support streaming, WebSocket, or real-time partial audio. You receive the complete audio file after synthesis. This design suits batch processing workflows typical in localization, where files are generated and then uploaded to your video pipeline.

What happens if a request fails?

Failed requests are free. If synthesis fails, the charge is returned in full. You can retry the request without incurring additional costs. This ensures you only pay for successfully generated audio files, reducing risk during your integration and testing phases.

How do I handle long texts over 4096 characters?

Split your text into parts of up to 4096 characters. Send each part as a separate request and join the resulting audio files. This approach allows you to handle arbitrarily long scripts while staying within the per-request character limit constraints.

Are the voices customizable or cloneable?

No, the API offers eight fixed presets (e.g., aria, nova, felix). There is no custom voice cloning or uploading your own voice. Voices are based on licensed recordings from LibriTTS-R and LibriVox. You cannot design custom voices or clone existing ones.

Is there an SDK specifically for this API?

No, there is no official SDK for this API. Use the OpenAI SDK or plain HTTP requests. The interface matches the OpenAI speech endpoint, making it easy to integrate using standard libraries. No mobile SDK or WordPress plugin is available.

How do I check the status of a request?

The API returns the audio file directly in the response upon success. Failed requests return an error status and are free. Request metadata like time, characters, and status are kept for billing. There is no separate status endpoint; check the HTTP response code.

Can I use the API for real-time dubbing?

No, the API does not support real-time streaming. Synthesis takes time, roughly real-time speed (25 characters per second) for long texts. Requests are processed sequentially, so under load, they may queue. It is best suited for batch processing, not live dubbing.

First request

curl

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

Sound wave illustration for: Authentication and Setup

Accessing the DubSync AI TTS API requires a valid API key, which you generate directly from your dashboard at /get-api-key/. This key serves as the primary credential for all API requests, ensuring secure and tracked usage of your account's character quota. Upon signing in via Google or email, you receive a unique key string beginning with tts-.

The API key is used in the HTTP Authorization header as a Bearer token. For every request to the speech endpoint, include Authorization: Bearer tts-<your_key>. This standard authentication method ensures compatibility with existing tools and SDKs, allowing seamless integration into your localization pipeline without custom header logic.

Generate your API key from the dashboard

Generate your API key from the dashboard

Navigate to the /get-api-key/ page on h251.info to create your credentials. The page displays your active key, current balance, and usage statistics. Accounts created with email and password start without trial credit, while Google sign-ins receive $0.50 in credit valid for 7 days.

Your key is tied to your account on this specific site. You can view your current rate limits and character consumption on the page, helping you plan volume for upcoming dubbing projects.

  • Sign up via Google or email on /get-api-key/
  • View active key, balance, and usage stats
  • Trial credit ($0.50) granted automatically for Google sign-ins

Use Bearer token in the Authorization header

Use Bearer token in the Authorization header

Include your API key in every request using the standard Bearer token format. The header must be set as Authorization: Bearer tts-<your_key>. This ensures that each synthesis request is authenticated and billed correctly against your character allowance.

If the token is missing or invalid, the API returns a 401 Unauthorized error. Ensure your integration passes the header correctly, especially when using custom HTTP clients or scripts in your CI/CD pipeline.

  • Header format: Authorization: Bearer tts-<key>
  • Returns 401 if token is missing or invalid
  • Works with standard HTTP clients and OpenAI SDKs

One active key per account, replaceable instantly

Each account maintains one active API key at a time. If you suspect a leak or need to rotate credentials, you can generate a new key from the dashboard. The old key becomes invalid immediately, ensuring tight control over access.

This simplifies security management for agencies. You do not need to manage multiple concurrent keys or track expiration dates manually. A new key is issued instantly, and you can resume synthesis immediately with the new token.

  • Single active key per account
  • Instant replacement invalidates old key
  • No manual expiration tracking needed

Endpoint and Request Structure

Sound wave illustration for: Endpoint and Request Structure

Synthesize speech by sending a POST request to the audio endpoint. This single endpoint handles all voice generation tasks, accepting your text payload and configuration parameters to return the resulting audio file directly in the response body.

POST /v1/audio/speech for synthesis

Send your text to this endpoint to generate audio files. Requests are processed one after another, so under load a request may wait in a queue. Ensure your input text stays within the 4,096 character limit per request.

JSON body with model, input, voice, format

The request body is a JSON object containing the text to speak, the voice preset, and output format. You can adjust the speed between 0.25 and 4.0 and optionally specify a language ISO code. If omitted, the language is guessed from the script, defaulting to English for Latin text.

  • model: "tts-1" or "tts-1-hd"
  • input: text string (max 4096 chars)
  • voice: one of 8 presets
  • response_format: mp3, wav, opus, flac, or pcm
  • speed: 0.25–4.0
  • language: optional ISO code

OpenAI SDK compatible with base_url change

The endpoint mimics the OpenAI speech structure, allowing you to use official OpenAI SDKs by simply changing the base URL to https://api.h251.info/v1. Pass your API key in the Authorization header as a Bearer token. This enables easy integration into existing pipelines without learning a new library.

Supported Models and Voices

Sound wave illustration for: Supported Models and Voices

The API offers two model identifiers, tts-1 and tts-1-hd, which utilize the identical underlying synthesis engine and share the same pricing structure. This design allows you to select your preferred audio fidelity without managing separate billing tiers or adjusting your integration logic for different cost bases. Both models handle the full range of supported voices and languages with consistent performance characteristics.

All voice generation is processed through a single engine, ensuring uniform quality standards across your localization pipeline. Whether you require standard clarity or enhanced high-definition audio, the technical behavior remains identical, simplifying your testing and deployment processes for consistent dubbing workflows.

tts-1 and tts-1-hd use the same engine and price

Both model identifiers trigger the same synthesis engine and incur identical costs per character. This uniformity means you do not need to maintain separate pricing logic or billing calculations for different audio quality levels within your application.

You can swap between tts-1 and tts-1-hd in your requests without affecting your overall budget allocation or requiring complex conditional logic in your codebase.

  • Identical synthesis engine for both models
  • Same price: $10 per 1 million characters
  • No separate billing tiers required

8 voices: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, Orion

The API provides eight distinct voice presets, each derived from licensed recordings of public-domain audiobook readings. These voices cover a range of tones, from warm narration to energetic promos.

Female voices include Aria (warm, clear narrator), Nova (bright, upbeat), Luna (soft, storytelling), and Sage (calm, instructional). Male options feature Felix (energetic, promo), Milo (friendly, conversational), Atlas (neutral, news), and Orion (deep, documentary).

Every generated audio file carries an inaudible watermark that marks it as synthetic speech.

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional
  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Voice selection independent of language setting

You can assign any of the eight voices to any of the 23 supported languages. The voice selection is decoupled from the language parameter, allowing flexible combinations for diverse localization projects.

If you do not specify a language code, the system guesses the language based on the text script, defaulting to English for Latin script. For non-English Latin text, explicitly setting the language is recommended to ensure accurate pronunciation.

This independence simplifies your API calls, as you do not need to map specific voices to specific languages manually.

  • Voices can speak any of the 23 supported languages
  • Language guessing defaults to English for Latin script
  • Explicit language setting recommended for non-English text

Audio Formats and Output

Sound wave illustration for: Audio Formats and Output

The API supports five standard audio formats: MP3, WAV, OPUS, FLAC, and PCM. Select the format that best fits your localization pipeline’s storage and playback requirements. Each format is delivered, ensuring compatibility across diverse video editing and broadcasting environments without additional conversion steps.

MP3, WAV, OPUS, FLAC, PCM formats available

Choose from lossy MP3 and OPUS for efficient bandwidth usage, or lossless WAV and FLAC for archival quality. PCM is available for raw data processing. The selection is made via the response_format field in your request payload.

  • MP3 and OPUS for compressed delivery
  • WAV and FLAC for lossless fidelity
  • PCM for uncompressed raw audio streams

Audio returned directly in the response body

The synthesized audio file is returned immediately in the HTTP response body, eliminating the need for polling or secondary download endpoints. This direct delivery streamlines integration with existing dubbing workflows, allowing your system to receive and process the asset in a single API call.

Inaudible watermark marks synthetic speech

Every generated audio file contains an inaudible watermark that identifies the content as synthetic speech. The watermark marks the audio as synthetic speech.

Language Handling and Detection

Sound wave illustration for: Language Handling and Detection

The API automatically detects language from the input script to simplify integration, defaulting to English for Latin characters.

For precise control, you can pass an optional ISO language code in the request body. This is particularly useful when the script contains mixed scripts or ambiguous phrasing that might confuse the detector.

Optional ISO language code in request

Include the language field with a valid ISO 639-1 code (e.g., 'fr', 'de', 'ja') to override automatic detection. This ensures the synthesis engine applies the correct pronunciation for that specific language.

  • Supported codes include ISO 639-1 for Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, and Turkish.

Default detection for Latin script (English)

If the language field is omitted, the system infers the language from the character set. Latin-script text defaults to English unless other cues are present. This works well for standard English text but may misidentify other Latin-based languages.

Explicit setting recommended for non-English Latin text

For languages like Spanish, Italian, or German using Latin characters, explicitly setting the language parameter prevents misidentification as English. This ensures correct accent, rhythm, and pronunciation without requiring manual voice selection. Unsupported languages include Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, and Bengali.

Language Handling and Detection

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

The API enforces a hard limit of 60 requests per minute for each API key. This applies uniformly across all endpoints, including the voice list and model details. Exceeding this threshold will result in HTTP 429 Too Many Requests errors until the window resets.

60 requests per minute per API key

Each active key maintains its own independent counter. If you rotate keys, the new key starts with a fresh quota.

10 requests per minute before first top-up

New accounts created with email and password begin without trial credit and are limited to 10 requests per minute. Accounts signed in with Google receive a $0.50 trial but still start at the 10 RPM limit. The limit increases to 60 RPM immediately after the first successful top-up of $5 or more via USDT (TRC-20).

  • Email/password accounts start at 10 RPM.
  • Google sign-in accounts start at 10 RPM.
  • Limit raises to 60 RPM after first $5+ top-up.

Requests processed sequentially under load

Requests are processed one after another, meaning that under high load, a request may wait in a queue. Typical speed is roughly real-time, but short phrases may take a few seconds to generate. If your pipeline sends multiple requests rapidly, consider adding a small delay to avoid hitting the 60 RPM limit or experiencing delays due to queuing.

Error Handling and Retries

Sound wave illustration for: Error Handling and Retries

Synthesizing audio over a network involves inevitable hiccups. The API uses standard HTTP status codes to indicate success or failure, allowing your integration logic to handle responses gracefully without complex parsing. Understanding these codes ensures your dubbing pipeline remains robust against temporary network issues or malformed input.

Standard HTTP status codes for errors

The API returns standard HTTP status codes to indicate the outcome of your request. A 400 Bad Request occurs if your JSON structure is invalid or if you specify an invalid voice. Other codes, such as 401 or 429, indicate authentication or rate limit issues respectively.

  • 200: Request processed successfully
  • 400: Invalid JSON or invalid voice parameter
  • 401: Invalid or expired API key
  • 429: Rate limit exceeded (60 req/min)

Failed requests are free and refunded

If synthesis fails due to server-side errors, the charge is returned in full. This ensures you only pay for successfully generated audio files, protecting your budget during unexpected downtime or processing errors.

Check response body for detailed error messages

The response body contains detailed error messages to help you debug issues quickly. Always inspect this content to identify specific problems like invalid character counts or unsupported parameters, enabling faster resolution in your automation workflows.

Code Examples and SDKs

Sound wave illustration for: Code Examples and SDKs

DubSync AI’s API is compatible with standard OpenAI SDKs, allowing seamless integration into existing localization pipelines. By adjusting the base URL, you can utilize familiar client libraries for rapid prototyping or production deployment without learning a new interface.

For custom workflows, plain HTTP requests offer full control over headers and payload structures. This approach is ideal for environments where lightweight clients are preferred or when integrating with legacy systems that do not support the OpenAI SDK pattern.

cURL example for quick testing

Use cURL to verify your API key and voice selection before building your application. This method provides immediate feedback on request structure and response formats.

  • Replace YOUR_API_KEY with your actual token from the dashboard.
  • Adjust the voice parameter to one of the 8 available presets.
  • Set response_format to your preferred audio type (e.g., mp3).

Python and Node.js OpenAI SDK integration

Import the official OpenAI SDK and set base_url to https://api.h251.info/v1. This allows you to use the same code structure for speech synthesis as you would for other OpenAI services.

  • Install the openai package via pip or npm.
  • Initialize the client with your API key and the custom base URL.
  • Call the audio.speech.create() method with your text and voice parameters.

Plain HTTP requests for custom pipelines

Send a POST request to /v1/audio/speech with a JSON body containing model, input, voice, and response_format. Include your API key in the Authorization header.

  • Ensure the Authorization header uses the Bearer scheme.
  • Handle the binary audio response directly in your pipeline.
  • Monitor rate limits to avoid delays in bulk processing jobs.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This allows you to test multiple voices without immediate financial commitment, ensuring the selected tone matches your creative vision before scaling up.

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. FFmpeg documentation
  4. LibriTTS-R corpus (OpenSLR 141)
  5. Node.js documentation
  6. LibriVox public-domain audiobooks
  7. OpenAI API reference: create speech
  8. IETF RFC 7845: Ogg Opus
  9. Creative Commons Attribution 4.0
  10. TRON developer hub: TRC-20
  11. Python documentation
  12. openai-node on GitHub

More on this site