Integrate Our Cloud TTS API with cURL or the OpenAI SDK

By CallVoice editorial team · Updated 2026-11-19

This guide shows product teams how to integrate our cloud text-to-speech API into voice bots and IVR systems. You will learn to generate audio files using simple cURL commands or the OpenAI SDK by adjusting the base URL. The workflow is straightforward: send text, receive an audio file.

We focus on reliable, cost-effective synthesis for call centers. You will see how to select from eight preset voices, choose audio formats like MP3 or WAV, and manage rate limits. The guide covers essential endpoints, error handling, and pricing details to help you deploy voice features quickly.

Integrate Our Cloud TTS API with cURL or the OpenAI SDK

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.tg7776.cc/v1. All requests, including speech synthesis and voice listing, use this endpoint. Ensure your client configuration points to this specific domain to interact with the CallVoice text-to-speech service correctly.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work by changing the base_url to https://api.tg7776.cc/v1. You can use the same request shape as the OpenAI speech endpoint, making integration straightforward for existing OpenAI users without needing a custom library.

How do I specify a voice?

Include the voice parameter in your JSON body with one of the eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. These voices are selected based on your audio requirements, such as warm narration or energetic promo styles.

What audio formats are supported?

Supported response formats are mp3, wav, opus, flac, and pcm. Specify your preferred format in the request body. The generated audio file is returned directly in the response, allowing immediate playback or storage by your application.

How do I set the speed?

Use the speed parameter with a value between 0.25 and 4.0. This allows you to adjust the playback rate of the synthesized speech. Default speed is 1.0, but you can slow down or speed up the output as needed.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key. If you exceed this, requests may be queued or rejected. Before your first top-up, the limit is 10 requests per minute. Monitor your usage to ensure smooth integration with your IVR system.

Is the API key case-sensitive?

Yes, your API key is case-sensitive. Include it in the Authorization header as 'Bearer tts-...'. Ensure you copy the key exactly as provided in your account dashboard to avoid authentication errors during your API requests.

How do I handle long texts?

Split texts into parts of up to 4096 characters. Generate audio for each part and join the resulting files. This ensures compliance with the per-request character limit while allowing you to synthesize longer documents or extended conversation scripts.

What is the character limit per request?

Each request supports up to 4096 characters in the input field. Spaces and punctuation count toward this limit. For longer texts, you must split the content into multiple requests and concatenate the audio outputs manually.

Can I use a different SDK?

You can use any HTTP client or SDK that supports JSON requests. The endpoint follows the standard OpenAI speech shape, so any tool capable of sending POST requests with the correct headers and body will work effectively.

Do I need to install any libraries?

No specific library is required if you use plain HTTP. If using the OpenAI SDK, you need to install it via pip. Otherwise, standard HTTP libraries in your preferred language are sufficient for making requests to the API.

How do I authenticate requests?

Include your API key in the Authorization header using the format 'Bearer tts-...'. One active key per account is allowed. If you issue a new key, the old one stops immediately, so update your configuration promptly.

What is the maximum speed?

The maximum speed is 4.0. You can adjust the speed parameter from 0.25 to 4.0. This allows fine-tuning of the speech rate to match your specific use case, such as fast news updates or slow instructional guides.

How do I get a list of voices?

Send a GET request to /v1/voices. This endpoint returns available voices, languages, formats, and pricing information. Use this to verify supported options before integrating the text-to-speech service into your product or application workflow.

First request

curl

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

Get your API key

Sound wave illustration for: Get your API key

Accessing the CallVoice API requires a valid authentication key. Navigate to the /get-api-key/ page to create your account. This is the single step needed before you can begin sending synthesis requests.

Sign up on the /get-api-key/ page

Sign up on the /get-api-key/ page

Visit the dedicated key management page to register your account. The interface provides immediate access to your credentials and usage dashboard upon completion.

Use Google or email + password

Use Google or email + password

Choose your preferred authentication method during registration. You can sign in securely using your Google account or create a standard account with an email address and password.

Copy your Bearer token

Once registered, locate your unique API key on the dashboard. Copy this token to use as the Authorization: Bearer value in your request headers for all API calls.

Make your first request with cURL

Sound wave illustration for: Make your first request with cURL

To start synthesizing speech, send a POST request to https://api.tg7776.cc/v1/audio/speech. You must include your API key in the Authorization header as a Bearer token. This endpoint accepts text input and returns the generated audio file directly.

POST to /v1/audio/speech

Construct your request with the full API base URL. Ensure your Bearer token is valid and active. The endpoint processes the text and returns the audio data.

JSON body with model and voice

Include the model ("tts-1" or "tts-1-hd"), input text (up to 4096 characters), and voice preset. You can also specify response_format (e.g., mp3, wav) and speed (0.25–4.0).

  • model: "tts-1" or "tts-1-hd"
  • input: your text string
  • voice: e.g., "nova", "atlas"
  • response_format: mp3, wav, opus, flac, or pcm

Receive audio file in response

The API returns the audio file directly in the response body. Failed requests are free, meaning no charge is applied if synthesis fails. For longer texts, split into chunks under 4096 characters and join the resulting audio files.

Use the OpenAI SDK

Sound wave illustration for: Use the OpenAI SDK

Configure the OpenAI SDK to point at our infrastructure by overriding the base URL. This allows you to use standard client libraries without rewriting request logic, leveraging the same HTTP shape we provide for the speech endpoint.

Pass your credentials via the Authorization header. The SDK handles the JSON serialization automatically, so you can focus on defining the voice and input text parameters.

Our API mirrors the OpenAI tts-1 and tts-1-hd structure exactly. Use the official openai Python or Node.js packages, setting the base URL to https://api.tg7776.cc/v1 to route requests correctly.

Change base_url to api.tg7776.cc/v1

Update your SDK configuration to direct traffic to our API gateway. For Python, initialize the client with base_url="https://api.tg7776.cc/v1" and provide your Bearer token.

This single change redirects all standard TTS calls to our service while keeping the familiar OpenAI SDK interface intact for your IVR or voice bot workflows.

  • Set base_url to https://api.tg7776.cc/v1
  • Include Authorization: Bearer tts-your-key
  • Use standard OpenAI SDK versions

Use standard OpenAI TTS parameters

Pass model, input, voice, and response_format as you would for OpenAI. The SDK validates these fields before sending the request.

You can also specify speed (0.25–4.0) and an optional language ISO code to control voice pacing and force language detection for non-English text.

  • model: "tts-1" or "tts-1-hd"
  • voice: one of 8 presets
  • input: text string up to 4096 chars
  • response_format: mp3, wav, opus, flac, or pcm

Same request shape as OpenAI

The JSON payload structure matches the OpenAI speech endpoint exactly. You do not need to map fields or handle custom headers beyond authentication.

This compatibility means existing OpenAI code snippets work out-of-the-box after changing the base URL and API key, simplifying integration for product teams.

  • Identical JSON body structure
  • Standard HTTP POST method
  • No custom field mapping required

Supported voices and models

Sound wave illustration for: Supported voices and models

Our API supports two models: 'tts-1' and 'tts-1-hd'. Both use the same underlying engine and pricing ($10 per 1 million characters). The primary difference is the model identifier; both use the same engine and audio quality. Use 'tts-1-hd' for critical IVR menus where clarity is paramount, or 'tts-1' for bulk content generation to optimize costs.

You have access to 8 preset voices, designed for specific tonal needs in call centers. These include female voices like Aria (warm narrator) and Nova (bright, upbeat), and male voices like Felix (energetic promo) and Atlas (neutral news). Each voice can speak any of the 23 supported languages, allowing flexible localization without hiring additional talent.

tts-1 and tts-1-hd models

Both models deliver human-sounding speech with a typical speed of roughly 25 characters per second. They are functionally identical in processing, ensuring consistent behavior across quality tiers. Failed requests are free, reducing risk during integration testing.

8 preset voices available

Voices are based on licensed recordings from LibriTTS-R and LibriVox. Every generated file carries an inaudible watermark marking it as synthetic. This ensures transparency for end-users while maintaining a professional tone suitable for business applications.

You can mix voices within a single audio file by splitting text into multiple requests and joining the resulting audio files. This allows dynamic voice changes for different sections of an IVR menu or audiobook.

  • 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

Choose voice by name

Specify the voice by its exact name in the voice field of your request. The system handles language detection automatically if the language field is omitted, defaulting to English for Latin script. For non-English Latin text, explicitly set the language parameter to ensure accurate pronunciation.

Each voice supports all 23 listed languages, including Arabic, Chinese, Spanish, and Hindi. You do not need separate voices for each language; the same voice adapts to the input script.

Audio formats and settings

Sound wave illustration for: Audio formats and settings

Send your text and receive audio in MP3, WAV, OPUS, FLAC, or PCM formats via the response_format field. Choose the format that best fits your IVR system’s requirements.

MP3, WAV, OPUS, FLAC, PCM

Select the output format that matches your telephony infrastructure. MP3 offers efficient compression, while WAV and FLAC provide lossless quality. PCM is available for raw audio processing.

  • MP3: Compressed, widely supported
  • WAV: Lossless, standard for telephony
  • FLAC: Lossless compression
  • OPUS: Efficient for web apps
  • PCM: Raw uncompressed audio

Speed control from 0.25 to 4.0

Adjust speech rate between 0.25 and 4.0 to fit your menu structure. Slower speeds improve clarity for complex instructions, while faster speeds reduce wait times for simple prompts.

Optional language ISO code

Set the language parameter with an ISO code to ensure correct pronunciation. Without it, the system guesses the language, defaulting to English for Latin script text.

Audio formats and settings

Handling errors and limits

Sound wave illustration for: Handling errors and limits

Each API key allows 60 requests per minute. New accounts start with a 10 requests per minute limit until the first top-up is processed.

60 requests per minute limit

Requests are counted per key. If you exceed 60 requests in a minute, the API returns a 429 status code. New accounts begin with a 10 requests per minute limit, which increases automatically after the first top-up.

Queue behavior under load

Requests are processed sequentially. Under high load, your request may wait in a queue before synthesis begins. This can increase latency for long texts, as generation typically takes about 25 characters per second.

Standard HTTP error codes

The API returns standard HTTP codes. Use 401 for authentication failures, 429 for rate limits, and 400 for invalid parameters. Failed synthesis requests are free and the charge is returned in full.

Voices endpoint details

Sound wave illustration for: Voices endpoint details

The GET /v1/voices endpoint provides a complete list of available preset voices, their supported languages, and output formats. This is the primary way to discover which voice suits your specific IVR or voice bot context without guessing.

GET /v1/voices for available options

Call your endpoint to retrieve the full catalog of eight preset voices, including Aria, Nova, Luna, Sage, Felix, Milo, Atlas, and Orion. Each response includes the voice ID required for the voice parameter in your synthesis requests.

  • Returns all eight preset voices with their unique IDs.
  • Lists all 23 supported languages for each voice.
  • Shows available output formats for each voice.

Check language support per voice

Every voice supports all 23 listed languages, allowing you to deploy multilingual voice bots with a single voice ID. If you do not specify the language field, the API guesses the language from the script, defaulting to English for Latin text.

  • Support 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.

View format and price info

The endpoint also returns metadata on supported audio formats (mp3, wav, opus, flac, pcm) and confirms the current pricing structure. This allows your integration to dynamically select formats based on bandwidth or quality requirements before making the synthesis request.

Models endpoint details

Sound wave illustration for: Models endpoint details

CallVoice provides a single high-quality engine accessible through two model identifiers: tts-1 and tts-1-hd. Both models utilize the exact same synthesis technology, ensuring consistent voice quality and latency characteristics. You can query the available models by sending a GET request to the /v1/models endpoint.

GET /v1/models for engine info

Use this endpoint to verify the available model versions and their identifiers. The response confirms that tts-1 and tts-1-hd are the active models, allowing your integration to dynamically adapt if new models are added in the future.

  • Returns a list of available model IDs
  • Confirms the single underlying engine for both models
  • No additional configuration required for either model

Difference between tts-1 and tts-1-hd

The distinction lies solely in the model identifier; both use the same engine, audio quality, and processing speed. Both models generate identical speech characteristics for the same input text, voice, and format settings. Choose tts-1 for standard billing or tts-1-hd if your workflow specifically requires the HD model identifier.

  • Identical synthesis engine and output quality
  • Differentiated only by the rate charged per character
  • Both support all 8 preset voices and 5 audio formats

Same engine, different price

Since the engine is the same, tts-1-hd carries a premium rate compared to tts-1. For cost-sensitive IVR deployments or high-volume voice bots, tts-1 is the standard choice. The pricing structure remains transparent: $10 per 1 million characters for both models, applied according to the model ID you select.

  • Standard rate: $0.01 per 1,000 characters
  • Both models are billed at the same rate: $10 per 1 million characters.
  • No performance difference in generation time or latency

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Modernize your IVR content without expensive studio sessions.

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. IETF RFC 7845: Ogg Opus
  4. Tether (USDT)
  5. LibriVox public-domain audiobooks
  6. Python documentation
  7. MDN: Web Speech API
  8. W3C WAI: making audio and video accessible
  9. curl documentation
  10. openai-python on GitHub
  11. ISO 639 language codes
  12. TRON developer hub: TRC-20

More on this site