Agency Guide: TTS API Quickstart & Curl Examples

By SpotSynth editorial team · Updated 2026-11-18

This guide helps ad agencies and radio producers generate synthetic voiceovers instantly without booking studio talent. You will find concrete curl examples, SDK integration steps, and clear parameters for the SpotSynth TTS API. Everything is structured to fit directly into your existing production workflows.

Use this reference to switch from slow human casting to affordable, consistent TTS generation. You will learn how to manage keys, handle voice selection, and process audio formats like MP3 and WAV. The documentation covers rate limits, error codes, and text splitting so you can scale your ad spot production efficiently.

Agency Guide: TTS API Quickstart & Curl Examples

Frequently asked questions

Do I need to install a specific SDK library?

No proprietary SDK is required. You can use the official OpenAI SDKs by changing the base_url to https://api.xgoal808casino.com/v1. Alternatively, you may use plain HTTP requests to interact with the API. This allows flexibility in choosing your preferred programming language and library for integration.

Can I use Python or JavaScript with this API?

Yes, you can use Python or JavaScript. Since the API follows the same request shape as the OpenAI speech endpoint, official OpenAI SDKs work seamlessly. You simply need to configure the base_url to point to our API endpoint, enabling easy integration into your existing codebases.

What is the base_url for the OpenAI SDK?

The base_url for the OpenAI SDK is https://api.xgoal808casino.com/v1. By setting this URL in your SDK configuration, you can use standard methods like creating a speech file. This ensures compatibility with existing OpenAI SDK implementations without requiring significant code changes.

How do I set the language explicitly in the code?

Include the language field in your JSON request body with the desired ISO code. If omitted, the system guesses the language, defaulting to English for Latin script. Explicitly setting it ensures accurate pronunciation for non-English texts, such as Spanish or Japanese, avoiding misinterpretation.

Is the API key sent in the header or body?

The API key is sent in the HTTP header. Include Authorization: Bearer tts-... in your request headers. This standard authentication method ensures secure access to the API. Ensure your key is active and correctly formatted to avoid authentication errors during your synthesis requests.

Can I send multiple voices in one request?

No, each request supports only one voice. You must specify a single voice preset from the eight available options. To generate audio with different voices, you need to send separate requests for each voice. This ensures consistent audio output per generation task.

How do I handle the audio file in my code?

The API returns the audio file directly in the response body. You can save this binary data to a file. Supported formats include mp3, wav, opus, flac, and pcm. Handle the response data according to your chosen response_format setting in the request.

Does the API return metadata with the audio?

The response primarily contains the audio file itself. Request metadata like time and status is kept for billing purposes but is not included in the audio response. For detailed usage stats, check your account dashboard or billing section after the request completes successfully.

What happens if I hit the rate limit?

You are limited to 60 requests per minute per key. If you exceed this, subsequent requests may queue or fail. New accounts start with 10 requests per minute. Monitor your usage to ensure smooth operation, especially during high-volume ad spot generation campaigns.

Can I use the same key for testing and production?

Yes, you can use the same key for both testing and production. Each account has one active key. If needed, you can issue a new key at any time, which immediately invalidates the old one. This simplifies management across different environments.

Is there a webhook for long text processing?

No, there is no webhook support. You must handle long texts by splitting them into parts of up to 4096 characters. Generate audio for each part and join the files in your code. This client-side approach ensures you control the final assembly of the audio.

Do I need to parse JSON for the audio URL?

No, the audio is returned directly in the response body, not as a URL. You do not need to parse JSON for a link. Simply write the response content to a file or process it as binary data according to your selected response format.

How do I specify the speed of the voice?

Include the speed field in your JSON request body. The value must be between 0.25 and 4.0. This allows you to adjust the pacing of the synthetic voice to fit your ad spot timing.

What is the maximum speed multiplier?

The maximum speed multiplier is 4.0. You can set the speed parameter up to this limit to accelerate the voice output. Ensure the audio remains intelligible at higher speeds.

First request

curl

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

Get Your API Key

Sound wave illustration for: Get Your API Key

Sign up at /get-api-key/ using Google or email to access your unique API key. This key authenticates your requests to the TTS endpoint, enabling instant voice generation for your ad spots. Accounts are per-site, ensuring secure isolation for your agency’s projects.

Sign up with Google or email

Sign up with Google or email

Use Google for immediate access with a $0.50 trial credit (valid 7 days). Email sign-ups start without trial credit but offer the same reliable API access. Both methods generate a single active key for your account.

Locate key in dashboard

Locate key in dashboard

Your dashboard displays your active API key, current balance, and usage statistics. Copy the key starting with tts-... to use in your Authorization: Bearer header. The dashboard also shows a ready curl example for quick testing.

  • View real-time character usage and balance
  • Copy key directly from the secure interface

Revoke and replace keys instantly

Generate a new key at any time to invalidate the old one immediately. This ensures your ad campaigns remain secure without downtime. Use this feature if a key is exposed or if you want to rotate credentials for different project teams.

First Request with Curl

Sound wave illustration for: First Request with Curl

Start by sending a simple POST request to our speech endpoint. You will receive a binary audio file that you can save directly or pipe into your ad production pipeline. This approach works instantly for any script under 4,096 characters.

The request requires specific JSON fields to define the output. You must provide the text, select a voice preset, and choose the model. The API handles the synthesis and returns the audio data in your chosen format.

Basic POST request example

Here is a minimal curl command to generate a 5-second radio spot. Replace YOUR_API_KEY with your credential from the dashboard.

```bash curl -X POST "https://api.xgoal808casino.com/v1/audio/speech" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "This is a test spot.", "voice": "nova", "response_format": "mp3"}' \ -o output.mp3 ```

The response contains the raw audio bytes. Save them to a file for immediate playback or further editing in your DAW.

Required JSON fields

The model field accepts tts-1 or tts-1-hd. Both use the same engine and pricing structure, so you can switch based on your quality needs without code changes.

The input field takes your script text. Keep it under 4,096 characters. The voice field requires one of the eight presets, such as nova for upbeat spots or atlas for news-style reads.

You must specify response_format. Supported formats include mp3, wav, opus, flac, and pcm. The speed parameter is optional, defaulting to 1.0, with a range of 0.25 to 4.0.

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

Response format handling

The API returns the audio file directly in the response body. No JSON wrapper surrounds the binary data for standard formats like MP3 or WAV.

For mp3 and wav, you can save the output directly to disk. Use opus or flac for web-optimized or lossless broadcast quality respectively.

If you need raw PCM data, specify pcm in the format field. Ensure your playback system supports the selected bit depth and sample rate.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

Integrating SpotSynth with existing workflows is straightforward because our API mirrors the OpenAI speech endpoint structure. You do not need a custom library or proprietary SDK; simply redirect your standard OpenAI client to our base URL.

This compatibility allows ad agencies to maintain their current codebase while gaining access to our high-quality synthetic voices. It ensures consistent behavior across different development environments without requiring significant refactoring efforts.

Change base_url to our endpoint

Update your client configuration to point to https://api.xgoal808casino.com/v1. This single change redirects all standard speech generation requests to our infrastructure while preserving the familiar request body structure you already use for other TTS services.

  • Base URL: https://api.xgoal808casino.com/v1

Use official SDKs seamlessly

Leverage the official OpenAI SDKs by adjusting the base URL. Since the request shape matches exactly, your existing scripts for generating radio spots or ad copy will function without modification to the core logic.

  • Compatible with official OpenAI Python and JavaScript SDKs

Authentication header setup

Include your unique API key in the standard authorization header. Ensure the key starts with tts- and is passed as a Bearer token to authenticate your requests correctly against our rate limits.

  • Header: Authorization: Bearer tts-your-api-key-here

Supported Audio Formats

Sound wave illustration for: Supported Audio Formats

Our API supports five audio formats, allowing you to select the optimal output for your specific advertising workflow. Each format balances file size, quality, and compatibility differently, ensuring your radio spots and digital ads load efficiently while maintaining broadcast standards.

MP3 for web delivery

MP3 is the standard for digital ad delivery. It offers high compression with minimal quality loss, making it ideal for streaming on websites, social media, and mobile apps. This format keeps file sizes small, making it ideal for web delivery.

WAV for broadcast quality

WAV provides uncompressed, studio-grade audio. It is the preferred choice for radio stations and professional post-production workflows where every detail matters. Use WAV when submitting final spots to broadcasters or when further editing in DAWs is required to ensure pristine sound.

FLAC and OPUS options

FLAC offers lossless compression, preserving exact audio data with smaller files than WAV. OPUS is a supported format for web-optimized audio. Both formats give you flexibility beyond standard MP3 or WAV requirements.

Voice Selection Parameters

Sound wave illustration for: Voice Selection Parameters

The API provides eight distinct voice presets tailored for advertising and radio production, allowing you to match the exact tonal requirements of each script. These voices cover a wide spectrum of styles, from warm narrators to energetic promo speakers, ensuring consistent quality across all your campaigns.

8 preset voices available

You can choose from female voices like Aria (warm, clear narrator) and Nova (bright, upbeat), or Luna (soft, storytelling) and Sage (calm, instructional). Male options include Felix (energetic, promo), Milo (friendly, conversational), Atlas (neutral, news), and Orion (deep, documentary).

  • 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

Gender and tone options

Each voice is based on licensed recordings from LibriTTS-R, ensuring high-quality synthetic speech. You can select the voice that best fits your brand’s voice, whether you need a neutral news anchor or a deep documentary narrator, without the lag of human casting.

Voice ID usage in requests

Include the voice parameter in your JSON body with the specific voice ID (e.g., "aria", "nova"). This parameter works alongside language and speed to fine-tune the output. If language is not set, the system guesses it from the script, defaulting to English for Latin text.

Voice Selection Parameters

Text Length Limits

Sound wave illustration for: Text Length Limits

Each API call accepts a maximum of 4096 characters for the input field. Spaces and punctuation count toward this limit, so plan your script segments accordingly to avoid truncation errors during production.

4096 characters per request

The API enforces a hard cap of 4096 characters per single POST request. If your script exceeds this, you must split the text manually or via your own preprocessing logic before sending it to the endpoint.

  • Count spaces and punctuation as characters.
  • Ensure no single request payload exceeds 4096 chars.

Splitting long scripts

For longer radio spots or ad campaigns, divide your text into chunks of up to 4096 characters each. Submit these chunks as separate requests in sequence. This ensures consistent processing and avoids payload limits.

Joining audio parts

Receive individual audio files for each chunk. Your application should then concatenate these files into a single continuous audio track. This approach maintains audio quality and allows for precise control over the final output timing.

Rate Limits and Throttling

Sound wave illustration for: Rate Limits and Throttling

Rate limits are enforced per API key to ensure consistent performance during high-volume ad production. Under normal conditions, you can send up to 60 requests per minute, which is sufficient for most agency workflows. Each request is processed sequentially, meaning complex scripts may experience slight delays if the queue is busy.

For new accounts, the limit is restricted to 10 requests per minute until the first top-up is credited. This ensures fair usage during the trial phase. Once you add funds via USDT (TRC-20), the full 60 requests/minute limit is immediately available.

60 requests per minute

Standard accounts can process 60 requests per minute. This allows agencies to generate multiple voiceovers for A/B testing or radio spot variations quickly.

  • Limit applies per active API key.
  • Requests are processed sequentially.

10 requests before top-up

New accounts start with a 10 requests per minute limit. This restriction lifts automatically once your first USDT top-up is confirmed.

Handling queue delays

Under heavy load, requests may wait in a queue. Longer texts take more time to synthesize, potentially increasing wait times.

Error Handling and Codes

Sound wave illustration for: Error Handling and Codes

Synthesizing audio for broadcast requires handling occasional API hiccups gracefully. Understanding response codes and refund policies ensures your production pipeline remains cost-effective and predictable, even when input constraints are breached.

Common HTTP error codes

A 400 Bad Request signals invalid JSON or missing fields, while a 401 Unauthorized indicates an invalid API key. These errors are immediate; check your payload structure or key validity before retrying.

Failed request refunds

If synthesis fails due to server-side issues, the charge is returned in full. You are only billed for successfully generated audio files, ensuring you pay strictly for usable output.

Debugging input errors

Ensure your text stays within the 4096-character limit. Verify that the voice ID exists in /v1/voices and that the language code matches your script if not using Latin default guessing.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. If a synthesis fails, you are not charged, so you can retry without financial penalty.

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. TRON developer hub: TRC-20
  4. IETF RFC 7845: Ogg Opus
  5. Python documentation
  6. OpenAI API reference: create speech
  7. W3C WAI: making audio and video accessible
  8. LibriTTS-R corpus (OpenSLR 141)
  9. ISO 639 language codes
  10. Creative Commons Attribution 4.0
  11. FFmpeg documentation
  12. Tether (USDT)

More on this site