API Documentation for Text-to-Speech Integration

By VocalCore editorial team · Updated 2026-11-18

This guide helps product teams integrate VocalCore’s text-to-speech API into IVR systems, voice assistants, and automated phone menus. You will find the exact endpoints, parameters, and code examples needed to generate audio from text. We cover authentication, rate limits, and error handling so you can build reliable voice experiences without guessing the details.

We provide clear instructions for both direct HTTP requests and OpenAI SDK integration. You will learn how to select voices, manage keys, and handle common errors. This documentation is designed for developers who want a straightforward, reliable solution for converting text into speech for their customer experience workflows.

API Documentation for Text-to-Speech Integration

Frequently asked questions

Which model should I use for IVR?

Both tts-1 and tts-1-hd use the same engine and price. Choose based on your preference for audio quality, as latency is identical. tts-1 is standard, while tts-1-hd is available for your requests. Since IVR systems often prioritize response time, tts-1 is typically preferred. Both models support all eight voice presets and handle the 23 supported languages effectively for automated phone menus.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work perfectly. You only need to change the base_url to https://api.3537br.com/v1 and use your VocalCore API key. This allows you to use the same code structure as OpenAI, making integration straightforward for teams already familiar with their Python SDK without learning a new library.

What is the maximum character limit?

Each request supports up to 4096 characters. Spaces and punctuation count toward this limit. If your script exceeds this length, you must split the text into smaller parts. The API does not handle long-form generation automatically, so your application should manage splitting and joining the resulting audio segments.

How do I specify a language?

Include the optional language field with an ISO code in your JSON body. If omitted, the system guesses the language based on the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly setting the language ensures accurate pronunciation and prevents misinterpretation by the synthesis engine.

Does the API support SSML?

No, the API does not support SSML. You cannot use phoneme dictionaries or custom pronunciation lexicons either. Voice design features like emotion tags are also unavailable. Your input is strictly plain text. You control pacing and emphasis primarily through speed adjustments and voice selection rather than markup tags.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key. If you exceed this, requests may wait in a queue. Under load, processing happens sequentially, so delays are possible. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed. Monitor your usage to avoid bottlenecks.

Can I stream audio in real-time?

No, streaming and WebSocket support are not available. The API returns the complete audio file after synthesis finishes. You cannot receive partial audio chunks. This means your IVR system must wait for the full response before playing the audio, which fits standard request-response patterns but does not support real-time streaming.

How do I handle long texts?

Split your text into parts of up to 4096 characters. Send each part as a separate request. Then, join the resulting audio files in your application. This manual splitting ensures you stay within character limits. The API does not automatically split or join audio, so your code must orchestrate this workflow.

Is the audio returned as a URL or binary?

The generated audio is returned directly in the response body as binary data. No URL is provided for storage. The audio is not stored on our servers after the response is sent. You must handle the binary data immediately in your application to play it or save it to your own infrastructure.

Do I need to install a specific SDK?

No, you do not need a specific SDK. You can use the OpenAI SDK or plain HTTP requests. Since the endpoint shape matches OpenAI, you can use standard HTTP libraries in any language. This flexibility allows you to integrate VocalCore into your existing tech stack without adding new dependencies.

How do I rotate my API key?

You can issue a new key at any time from your account dashboard. When you generate a new key, the old one stops working immediately. This ensures secure rotation without overlap. You only have one active key per account, so update your applications promptly after issuing a new key to avoid interruptions.

What formats are best for phone systems?

We support mp3, wav, opus, flac, and pcm via our standard API. For IVR systems, mp3 and wav are common choices due to broad telephony compatibility. Mp3 offers efficient file sizes, while wav provides uncompressed audio. Choose the format that aligns with your specific provider’s requirements. All formats are generated with no additional configuration needed.

Can I adjust the speed dynamically?

Yes, you can adjust speed between 0.25 and 4.0. This allows you to control the pacing of the speech dynamically per request. Faster speeds reduce latency, while slower speeds improve clarity. This feature lets you fine-tune the user experience for different IVR prompts without changing the voice or model.

Are there any known bugs?

We don’t publish a static list of known bugs. The system processes requests sequentially, so delays may occur under load. Rate limits are enforced strictly, and failed requests are free. For issues, contact support via email. We do not offer SLA guarantees or uptime promises, so plan for potential variability in response times during high traffic.

First request

curl

curl https://api.3537br.com/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.3537br.com/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.3537br.com/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 is handled via a Bearer token in the Authorization header. This key identifies your account and tracks usage against your balance.

Bearer token header

Include your key exactly as Authorization: Bearer tts-... in every request. This simple header ensures your API calls are authenticated and billed correctly to your account.

One active key per account

Each account holds a single active API key. If you lose it or suspect a leak, you can generate a new one immediately.

Key rotation process

When you issue a new key, the old one stops working instantly. Update your IVR or voice assistant configuration promptly to avoid service interruption during rotation.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

The VocalCore API is structured around three primary endpoints that allow your integration to function smoothly. You interact with the speech generation engine, retrieve available voice configurations, and check model details through dedicated HTTP routes.

Each endpoint serves a specific role in the workflow: creating audio files, discovering voice options, and verifying model availability. This separation keeps your implementation clean and predictable.

POST /v1/audio/speech

This is the core endpoint for generating audio. Send a JSON payload with your text, voice selection, and format preferences to receive the audio file in the response body. It supports standard formats like MP3, WAV, Opus, FLAC, and PCM.

GET /v1/voices

Use this endpoint to retrieve the list of available voices, languages, and formats. It helps you dynamically populate your UI dropdowns with valid options without hardcoding values. Each voice has a specific preset name like 'aria' or 'nova'.

GET /v1/models

Retrieve the current model identifiers (tts-1 and tts-1-hd) and their associated pricing details. This ensures your application always uses the correct model string for requests and helps you display accurate cost estimates to your users.

Endpoints Overview

Request Parameters

Sound wave illustration for: Request Parameters

Configure your synthesis requests using three core parameters: model, voice, and audio settings. The API accepts "tts-1" or "tts-1-hd"; both utilize the same engine and pricing tier, so you may choose either without performance differences. Select one of eight preset voices, such as "aria" for warm narration or "atlas" for neutral news delivery, to match your IVR tone.

Model: tts-1 or tts-1-hd

Both model identifiers trigger the identical synthesis engine and incur the same cost of $10 per million characters. You do not need to switch between them for quality variations; they are functionally equivalent. Choose either based on your preference for the parameter name, ensuring consistency across your integration.

Voice selection (8 presets)

Choose from eight licensed voices designed for specific tones, ranging from energetic promo styles to calm instructional narration. Each voice supports all 23 languages, including English, Spanish, German, and Japanese. If you omit the language code, the system guesses the language from the script, defaulting to English for Latin text.

  • Aria: Warm, clear narrator
  • Felix: Energetic, promo style
  • Atlas: Neutral, news delivery
  • Nova: Bright, upbeat tone

Speed and language codes

Adjust the playback speed between 0.25 and 4.0 to fit your conversation design constraints. Provide an ISO language code (e.g., "es" for Spanish) to ensure accurate synthesis, especially for non-English Latin scripts. This prevents the system from defaulting to English pronunciation for ambiguous text inputs.

Response Formats

Sound wave illustration for: Response Formats

The API returns raw binary audio data directly in the response body, allowing you to save the file immediately without extra parsing. You control the output format by setting the response_format parameter, choosing between lossy compression or uncompressed quality based on your IVR bandwidth and storage needs.

MP3, WAV, Opus, FLAC, PCM

Select mp3 or opus for efficient bandwidth usage during high-volume IVR calls. Choose wav, flac, or pcm if your phone system requires uncompressed audio. All formats are generated using the same engine, so audio quality differences depend only on the compression type you select.

Binary audio response

The response body contains the raw audio bytes, not a JSON object. Ensure your HTTP client handles binary data correctly and saves the file with the correct extension matching your chosen format. This direct delivery minimizes latency, keeping your voice assistant responses fast and responsive.

Error JSON responses

If synthesis fails, the API returns a standard JSON error object with an HTTP status code (e.g., 400 or 500). Failed requests are free, so you can retry or adjust parameters without incurring charges. Always check the status code before processing the binary payload.

Rate Limits

Sound wave illustration for: Rate Limits

Understanding rate limits helps you plan your IVR traffic without unexpected interruptions. VocalCore processes requests sequentially, meaning each synthesis job is handled one after another. This design ensures consistent quality but requires your integration to respect the defined boundaries.

The limits vary based on your account status. New accounts start with a low threshold, while active accounts enjoy higher throughput. Knowing these constraints allows your product team to implement appropriate retry logic and manage queue behavior effectively.

60 requests per minute

Once your account is active and funded, you can send up to 60 requests per minute. This throughput is sufficient for most mid-scale IVR deployments, allowing your system to generate audio for phone menus or voice assistant responses without significant bottlenecking.

  • Limit: 60 requests per minute per key
  • Applies to all active accounts with sufficient balance
  • Resets every 60 seconds

10 requests before top-up

Before your first top-up, your account is limited to 10 requests per minute. This lower threshold helps you test the integration with your existing trial credit ($0.50) without overwhelming the queue during initial development phases.

Queue behavior under load

Because requests are processed sequentially, a burst of simultaneous requests may wait in a queue. Short phrases typically take a few seconds to generate, while longer texts take roughly real-time duration (about 25 characters per second of audio). Under heavy load, you may experience slight delays as the queue clears.

  • Requests are processed one after another
  • Short phrases take a few seconds
  • Long texts take roughly real-time duration
Rate Limits

Curl Example

Sound wave illustration for: Curl Example

Use curl to verify your key works immediately. This minimal command sends a short text string to the TTS endpoint and saves the resulting audio file.

The command uses the standard Bearer token header for authentication. Replace YOUR_API_KEY with the key found on your /get-api-key/ dashboard.

Basic speech generation

Run this command to generate a 10-second MP3 clip. It demonstrates the core POST request structure required for all integration tests.

Header configuration

Include Authorization: Bearer YOUR_API_KEY in the header. The API rejects requests without this specific Bearer token format.

Input text payload

Pass the text via `--data '{"model":"tts-1","input":"Hello world","voice":"nova","response_format":"mp3"}'`. Ensure the text stays under 4096 characters.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

The VocalCore API mirrors the OpenAI speech endpoint structure, allowing your team to reuse existing OpenAI SDK clients with minimal configuration changes. By simply updating the base URL to https://api.3537br.com/v1, you can leverage familiar libraries for IVR audio generation without learning a new integration pattern.

Base URL modification

Update your SDK client's base URL to https://api.3537br.com/v1. This ensures all requests route through our endpoint while maintaining compatibility with standard OpenAI SDK methods. You must also include your unique Bearer token in the Authorization header for authentication.

Client initialization

Initialize the OpenAI client using your API key. Ensure you pass the modified base URL during initialization so that all subsequent speech generation calls target VocalCore’s infrastructure. This setup allows your product team to maintain standard code structures for voice assistant workflows.

Code snippet example

Use the audio.speech.create() method to generate audio. The response contains binary data; save it directly using write_to_file() rather than streaming, as this is a non-streaming endpoint. This approach efficiently handles the audio file for your IVR system.

import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'tts-your-key-here', baseURL: 'https://api.3537br.com/v1' }); const response = await client.audio.speech.create({ model: 'tts-1', voice: 'nova', input: 'Welcome to customer support.', response_format: 'mp3' }); await response.writeToFunction(fs.createWriteStream('output.mp3'));

OpenAI SDK Integration

Error Handling

Sound wave illustration for: Error Handling

Synthesizing speech for IVR systems requires robust error handling to ensure smooth customer experiences. Understanding how VocalCore reports issues helps your team maintain reliable audio generation workflows without unexpected interruptions.

HTTP status codes

We use standard HTTP status codes to indicate request outcomes. A 200 status confirms successful audio generation. Non-2xx codes indicate specific issues such as invalid parameters or temporary service unavailability.

  • 200: Success
  • 400: Bad Request (invalid parameters)
  • 401: Unauthorized (invalid key)
  • 429: Too Many Requests (rate limit exceeded)
  • 500: Internal Server Error

Error message structure

All errors return a JSON object containing an error field. This object includes a code for programmatic handling and a message describing the issue in plain English. Failed synthesis requests are free, so no charge is applied.

Retry logic recommendations

For transient 5xx errors, implement exponential backoff with jitter. If you receive a 429 rate limit error, wait before retrying, as requests are processed sequentially. For IVR systems, consider caching audio for static prompts to reduce API calls.

  • Use exponential backoff for 5xx errors
  • Respect Retry-After headers if provided
  • Cache static IVR prompts to minimize requests

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Design intuitive voice flows that guide callers smoothly to their desired outcome without unnecessary detours or repetition.

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. MDN: Web Speech API
  3. LibriTTS-R paper (arXiv 2305.18802)
  4. FFmpeg documentation
  5. Tether (USDT)
  6. W3C WAI: making audio and video accessible
  7. OpenAI API reference: create speech
  8. openai-python on GitHub
  9. Creative Commons Attribution 4.0
  10. Python documentation
  11. TRON developer hub: TRC-20
  12. ISO 639 language codes

More on this site