Developer Guide to English Voice API Integration

By AdVoice editorial team · Updated 2026-11-19

This document provides the technical specifications for integrating the AdVoice text-to-speech API into your production workflow. It covers authentication, endpoint structures, and parameter details required to generate high-quality synthetic audio for advertising and radio spots. The guide is designed for developers who need reliable, programmatic access to consistent voice outputs without external dependencies.

Readers will find precise instructions for using the standard HTTP endpoints and the OpenAI-compatible SDK. The content includes concrete examples for request formatting, response handling, and error management. This resource enables freelancers to automate voice generation for commercial content, ensuring predictable performance and accurate character counting for billing purposes.

Developer Guide to English Voice API Integration

Frequently asked questions

How do I get an API key?

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

Does it work with OpenAI SDK?

Yes. The endpoint matches the OpenAI speech endpoint shape. Use the official OpenAI SDKs by changing the base_url to https://api.duogaming.info/v1 and providing your site-specific key. This allows immediate integration without learning a new client library.

What is the base URL?

The API base URL is https://api.duogaming.info/v1. The speech endpoint is POST https://api.duogaming.info/v1/audio/speech. Voice and model metadata are available via GET /v1/voices and GET /v1/models. 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 the model in your request body. The choice does not affect cost, which remains $0.01 per 1,000 characters regardless of the selected model version.

Can I change the voice mid-text?

No. Each request generates audio for a single voice preset. To change voices, split your text into separate requests, specifying the desired voice for each part. You must then join the resulting audio files in your post-processing workflow.

How do I handle long texts?

Split input text into parts of up to 4096 characters. Send each part as a separate POST request to /v1/audio/speech. Join the returned audio files sequentially. This ensures compliance with character limits while maintaining consistent audio quality across segments.

What is the speed range?

The speed parameter accepts values from 0.25 to 4.0. Adjust this value to modify playback rate without affecting pitch. This allows fine-tuning of narration pace for advertising spots or radio content while maintaining the synthetic voice characteristics.

Does it support SSML?

No. The API does not support SSML markup. It accepts plain text input only. If you need specific pauses or emphasis, you must manage timing and audio concatenation in your client application after receiving the generated audio files.

Is streaming supported?

No. The API does not support WebSocket or real-time partial audio streaming. Audio is generated synchronously and returned as a complete file in the response. Requests are processed sequentially, so longer texts may experience queue delays under load.

How do I detect errors?

Check the HTTP status code and response body for error details. Failed requests are free: if synthesis fails, the charge is returned in full. Monitor your dashboard for usage statistics and billing status to ensure account health and credit availability.

What happens on rate limit?

The limit is 60 requests per minute per key. New accounts start with 10 requests per minute until the first top-up. Exceeding the limit results in standard HTTP 429 errors. Implement exponential backoff in your client to handle retries efficiently.

Is there a WebSocket endpoint?

No. The API is purely RESTful. There is no WebSocket endpoint for real-time audio streaming or partial chunk delivery. All interactions occur via standard HTTP POST and GET requests. Use the provided SDKs or plain HTTP for integration.

Can I use custom lexicons?

No. The API does not support custom pronunciation lexicons or phoneme dictionaries. Pronunciation is determined by the engine based on the input text. If specific words need alternative pronunciation, you may need to adjust the input text spelling manually.

Is the API RESTful?

Yes. The API follows standard REST principles using JSON bodies and HTTP methods. Use POST for speech generation and GET for retrieving voices and models. Authentication is handled via Bearer tokens in the Authorization header for each request.

First request

curl

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

Authentication for the AdVoice API relies on a single bearer token passed in the request header. This key authenticates your account and tracks usage against your balance. Include the header Authorization: Bearer tts-<your_key> with every API call to ensure valid requests.

Bearer Token

Bearer Token

Pass the token in the Authorization header as a Bearer token. The format is Bearer tts-<key>. This header authorizes the request and deducts characters from your balance.

Key Management

Key Management

Manage keys via the dashboard at /get-api-key/. You can issue a new key at any time. The previous key becomes invalid immediately upon creation of the new one.

Single Key Limit

Each account maintains one active key. Only one key is valid at any given moment. This ensures clear attribution of usage to a single account.

  • Issue a new key via the dashboard.
  • Old key stops working immediately.
  • One active key per account.

Endpoint Structure

Sound wave illustration for: Endpoint Structure

The API exposes three primary endpoints for managing synthesis requests and metadata. All endpoints require Bearer token authentication in the header. The base URL is https://api.duogaming.info/v1. Requests follow standard JSON formatting compatible with existing HTTP clients.

Speech POST

Send text to generate audio. POST to /v1/audio/speech. Accepts model, input, voice, format, and speed. Returns an audio file directly. Supports mp3, wav, opus, flac, and pcm outputs.

  • Endpoint: POST /v1/audio/speech
  • Body: JSON with text and voice selection
  • Output: Raw audio binary or error JSON

Voices GET

Retrieve available voice presets and their attributes. GET /v1/voices returns a list of eight voices with language support details. Use this to verify voice availability before synthesis.

  • Endpoint: GET /v1/voices
  • Returns: List of voice IDs, languages, formats, and price
  • Use: Verify supported languages and voice types

Models GET

Check available model versions. GET /v1/models lists supported engines. Currently, tts-1 and tts-1-hd are available with identical pricing and engine quality. Use this to confirm model availability.

  • Endpoint: GET /v1/models
  • Returns: List of model IDs
  • Use: Confirm model availability

Request Parameters

Sound wave illustration for: Request Parameters

Configure the synthesis request by selecting the engine model, defining the input text, and choosing a voice preset. The API accepts tts-1 or tts-1-hd for identical engine performance. Text input is limited to 4096 characters per request; longer scripts must be split and concatenated client-side.

Model Selection

Choose between tts-1 and tts-1-hd. Both models use the same underlying engine and pricing tier. Select tts-1-hd if you prefer the HD model; it uses the same engine and pricing as tts-1.

Input Text

Pass the script as a UTF-8 string in the input field. Spaces, punctuation, and numbers count toward the character limit. The system processes requests sequentially, so large batches may queue. Ensure text is plain ASCII or Unicode; special symbols are rendered as spoken words.

  • Maximum length: 4096 characters
  • Spaces and punctuation count as characters
  • Plain text only; no SSML tags

Voice ID

Assign one of eight presets using the voice parameter. Select based on tonal requirements: aria for clear narration, felix for energetic promos, or atlas for neutral news-style reads. Each voice supports all 23 languages, but set the language code explicitly for non-English scripts to ensure accurate pronunciation.

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

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in the format specified by the response_format parameter. Each response contains the binary audio data. This allows seamless integration into existing advertising pipelines without manual conversion steps.

MP3 Output

MP3 is the default format, offering a balance between file size and quality. It is ideal for web-based ad delivery and general audio playback. The compressed format reduces bandwidth usage while maintaining clear voice clarity for commercial spots.

  • Default response format
  • Optimized for web delivery
  • Standard compatibility

WAV Output

WAV provides uncompressed, lossless audio suitable for high-fidelity radio spots. This format preserves the full quality of the synthetic voice, ensuring no degradation during broadcast. It is preferred for professional audio editing and mastering workflows.

  • Lossless audio quality
  • Ideal for radio production
  • No compression artifacts

Opus/FLAC/PCM

Opus offers high efficiency at low bitrates. FLAC provides lossless compression, reducing storage needs without sacrificing quality. PCM returns raw audio data, useful for specialized processing or immediate playback in audio software.

  • Opus: efficient streaming
  • FLAC: lossless compression
  • PCM: raw audio data

OpenAI SDK Usage

Sound wave illustration for: OpenAI SDK Usage

AdVoice maintains full compatibility with the official OpenAI Python and Node.js SDKs. Developers achieve this by overriding the default API base URL to point to the AdVoice infrastructure, ensuring seamless integration without requiring custom client libraries or middleware layers.

Base URL Change

Modify the base_url parameter in your SDK initialization to https://api.duogaming.info/v1. This directs all subsequent requests to the AdVoice endpoint while preserving the standard request shape expected by the OpenAI client.

SDK Compatibility

The API implements the same JSON body structure as the OpenAI speech endpoint. Consequently, existing code utilizing the official OpenAI SDKs requires minimal adjustment. You simply swap the authentication header and update the base URL to route traffic correctly.

Example Code

The following snippet demonstrates a standard integration using the OpenAI Python library. It sends a text request and returns the audio file directly to your local environment.

  • import openai
  • client = openai.OpenAI(base_url="https://api.duogaming.info/v1", api_key="tts-...")
  • audio = client.audio.speech.create(
  • model="tts-1",
  • voice="nova",
  • input="Generate a commercial spot for Q3 sales."
  • )
OpenAI SDK Usage

Error Handling

Sound wave illustration for: Error Handling

Errors are returned as standard JSON objects with an HTTP status code. Failed requests are free: if synthesis fails, the charge is returned in full.

Implement retry logic with exponential backoff to handle transient issues. The following sections detail the specific error scenarios you will encounter during integration.

Rate Limit

Requests exceeding 60 per minute return HTTP 429. This limit applies per API key, so ensure your implementation respects the retry-after header.

New accounts start with a stricter 10 requests per minute limit until the first top-up is processed.

  • HTTP 429 Too Many Requests
  • Retry after header included in response

Invalid Input

The API returns HTTP 400 if the input text exceeds 4096 characters or if the voice ID is not one of the eight supported presets.

Ensure the model field is set to tts-1 or tts-1-hd. Incorrect fields result in immediate rejection without character consumption.

  • HTTP 400 Bad Request
  • Check character count limits

Server Error

Internal server errors return HTTP 500. These are rare but may occur during high load when the queue is full.

Failed synthesis requests are free. If the server returns an error, no charge is applied to your balance.

  • HTTP 500 Internal Server Error
  • No charge for failed requests

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a strict rate limit of 60 requests per minute per active key. This ceiling ensures stable processing for high-volume advertising workflows and prevents burst overloads during peak production hours. Each character beyond the 4096 limit requires a separate request, so plan your payload splitting accordingly.

60 RPM

Under normal operation, each key allows up to 60 synthesis requests within a one-minute window. This limit applies globally to the key, regardless of the model (tts-1 or tts-1-hd) used. Exceeding this threshold results in a 429 Too Many Requests error until the window resets.

Initial Limit

New keys start with a reduced limit of 10 requests per minute. This restriction remains in effect until the first top-up is processed. Once a minimum $5 USDT transfer is confirmed on the TRON network, the limit automatically increases to the standard 60 RPM.

Queue Behavior

Requests are processed sequentially. If the queue is full, new requests wait in line rather than failing immediately. Short phrases may experience slight delays during high load, but long-text generation typically proceeds at real-time speed.

Language Handling

Sound wave illustration for: Language Handling

Language detection relies on script analysis, defaulting to English for Latin text. For non-English Latin-script content, explicitly setting the language code ensures accurate pronunciation.

Auto Detection

The API infers language from the input script. Latin characters default to English, while other scripts trigger their respective language models.

Explicit Code

Pass the language parameter with an ISO code (e.g., de, fr) to override auto-detection. This is critical for mixed-language texts or ambiguous scripts.

Script Guessing

Scripts are analyzed to assign the correct voice model. If the script is ambiguous or unsupported, the request may fail or produce unintended audio.

  • Supported: Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish
  • Not supported: Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, Bengali

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Her tone delivers consistent quality for English-language advertising, ensuring the message remains engaging without sounding overly artificial.

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. LibriTTS-R corpus (OpenSLR 141)
  3. LibriVox public-domain audiobooks
  4. IETF RFC 7845: Ogg Opus
  5. W3C WAI: making audio and video accessible
  6. Node.js documentation
  7. openai-node on GitHub
  8. FFmpeg documentation
  9. Tether (USDT)
  10. TRON developer hub: TRC-20
  11. curl documentation
  12. LibriTTS-R paper (arXiv 2305.18802)

More on this site