Synthetic Voice API Quickstart Guide: Integrate with OpenAI SDKs

By SynthData Labs editorial team · Updated 2026-11-18

This guide shows you how to integrate our synthetic voice API into your ML pipeline using familiar tools. You will learn to generate high-quality audio datasets for training speech models by sending text and receiving files via standard endpoints. We use the same request shape as OpenAI, so you can leverage existing OpenAI SDKs with a simple base URL change.

Designed for product teams building data-centric applications, this page covers authentication, parameter tuning, and error handling. You will see concrete cURL examples and Python snippets for generating MP3, WAV, and other formats. By the end, you will know how to manage keys, handle rate limits, and understand the pricing model for scaling your synthetic audio production.

Synthetic Voice API Quickstart Guide: Integrate with OpenAI SDKs

Frequently asked questions

How do I get my API key?

Sign up on /get-api-key/ using Google or email. Your key appears on the dashboard, starting with 'tts-'. You can issue a new key at any time; the old one stops immediately. One active key per account is supported for all your projects.

Can I use the OpenAI Python SDK?

Yes. Change the base URL to https://api.seeu168casino.com/v1 and use your site's key. The request shape matches the OpenAI speech endpoint, so standard SDKs work directly without modification.

What is the maximum text length per request?

The input field supports up to 4096 characters per request. For longer texts, split them into parts of this length and join the resulting audio files. Spaces and punctuation count toward the limit.

Does the API support streaming audio?

No. The API returns the complete audio file in the response body. There is no WebSocket or real-time partial audio streaming available. You must wait for the full synthesis to complete before receiving the response.

How do I specify the language for non-English text?

Include the optional 'language' field with an ISO code. If omitted, the API guesses the language, defaulting to English for Latin script. Explicitly setting it ensures accuracy for non-English Latin-script text.

Can I change the voice after the request is sent?

No. The voice is determined by the 'voice' field in the JSON body at request time. You cannot change it mid-stream or after submission. You must send a new request with the desired voice preset.

What happens if I exceed the rate limit?

You are limited to 60 requests per minute per key (10 before first top-up). Exceeding this may cause requests to queue or fail. Failed requests are free, so you are not charged for rejected attempts.

Is the audio file returned in the response body?

Yes. The generated audio is returned directly in the HTTP response body. The file is not stored on our servers; it is returned immediately upon successful synthesis. Supported formats include mp3, wav, opus, flac, and pcm.

Do I need to install any specific libraries?

No specific library is required. You can use the official OpenAI SDKs by adjusting the base URL, or use plain HTTP requests. No proprietary SDK or mobile library is needed to interact with the API.

Can I use the same key for multiple projects?

Yes. One active key is issued per account and can be used across multiple projects. You can rotate the key anytime if needed, and the old key will stop working immediately upon issuing a new one.

How do I rotate my API key?

Issue a new key from your dashboard at any time. The new key becomes active immediately, and the old one stops working at once. This allows seamless rotation without downtime for your applications.

Is the API endpoint versioned?

Yes. The endpoint is https://api.seeu168casino.com/v1/audio/speech. The version 'v1' is included in the path. Use this base URL for all requests to ensure compatibility with the current API structure.

Can I send JSON or form data?

The API expects a JSON body for requests. Fields like 'model', 'input', and 'voice' are sent as JSON. Form data is not mentioned as a supported format, so use JSON for standard interactions.

What is the default response format?

If not specified, the default format is mp3 (per the OpenAI SDK default). You can choose from mp3, wav, opus, flac, or pcm by setting the 'response_format' field. MP3 is suitable for most use cases and balances quality with file size.

First request

curl

curl https://api.seeu168casino.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.seeu168casino.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.seeu168casino.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 sent in the Authorization header. Use Authorization: Bearer tts-... with your unique API key. This key identifies your account and tracks usage against your balance.

Each account holds one active key. You can rotate it instantly without downtime, ensuring secure access to the synthetic speech endpoints.

Bearer Token Usage

Bearer Token Usage

Include your key in every request header as Authorization: Bearer tts-.... The API validates this token to authorize synthesis and deduct characters from your balance.

Keys work seamlessly with the OpenAI SDK by setting the base URL to https://api.seeu168casino.com/v1.

  • Format: Authorization: Bearer tts-...
  • Required for all POST and GET requests

Key Management

Key Management

Your account dashboard displays your current key, balance, and usage stats. One key is active per account.

Keys are tied to specific sites; ensure you use the key generated on the correct domain.

Key Rotation

You can issue a new key at any time via the dashboard. The old key stops working immediately.

This allows instant revocation if a key is compromised, with no service interruption for new requests using the fresh key.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

The API exposes three core endpoints for generating and managing synthetic speech. The primary generation endpoint accepts text and parameters to return audio files, while the discovery endpoints provide metadata about available voices and model configurations. This structure allows product teams to easily integrate TTS capabilities into their ML workflows using standard HTTP clients or the OpenAI SDK.

All endpoints require authentication via a Bearer token in the Authorization header. The API follows a consistent request shape, making it straightforward to swap base URLs and leverage existing SDK integrations without rewriting client logic.

POST /v1/audio/speech

This is the main endpoint for generating audio. Send a JSON body with the text input, voice selection, and desired format to receive an audio file. It supports text up to 4096 characters per request.

Use this endpoint to augment your training datasets with synthetic speech. The API processes requests sequentially, so longer texts should be split into parts and joined client-side for consistent results.

  • Accepts JSON bodies with input, voice, model, and response_format fields.
  • Returns audio data directly in the response body.
  • Supports MP3, WAV, OPUS, FLAC, and PCM formats.

GET /v1/voices

Retrieve a list of all available voice presets, their associated languages, and supported output formats. This endpoint helps you select the appropriate voice for your dataset requirements without guessing IDs.

Use this to verify language support before sending generation requests, ensuring your synthetic data matches the target linguistic profile.

  • Lists all 8 available voice presets.
  • Shows supported languages and formats for each voice.
  • Provides pricing information per character.

GET /v1/models

Returns the available model identifiers, such as 'tts-1' and 'tts-1-hd'. Both models use the same engine and pricing, allowing you to choose based on specific quality preferences or SDK compatibility needs.

This endpoint confirms the model IDs compatible with the OpenAI SDK structure, ensuring smooth integration for teams already familiar with standard TTS patterns.

  • Returns 'tts-1' and 'tts-1-hd' model IDs.
  • Both models share the same engine and price.
  • Compatible with standard OpenAI SDK request shapes.

Quickstart with cURL

Sound wave illustration for: Quickstart with cURL

Generate synthetic speech instantly using standard HTTP requests. This guide shows how to send text and receive audio files suitable for ML dataset augmentation.

Use the provided cURL examples to verify your API key and understand the request structure before integrating into your Python or Node.js workflows.

Basic Request

Send a POST request to the speech endpoint with your text and voice selection. The API returns the audio file directly in the response body.

Example: `curl -X POST https://api.seeu168casino.com/v1/audio/speech -H "Authorization: Bearer tts-..." -d '{"model": "tts-1", "input": "Hello world", "voice": "nova"}'`

Parameters Explained

Specify model (tts-1 or tts-1-hd), input text (max 4096 chars), and voice (e.g., aria, nova, felix). Include response_format (mp3, wav, opus, flac, pcm) and optional speed (0.25–4.0) or language ISO code.

Each character counts toward your $0.01/1000 characters billing. Failed requests incur no charge.

  • model: tts-1 or tts-1-hd
  • voice: 8 presets available
  • response_format: mp3, wav, opus, flac, pcm
  • speed: 0.25 to 4.0

Response Format

Successful responses return the audio file with appropriate MIME headers. Failed requests return JSON error details but remain free.

Long texts should be split into 4096-character chunks and joined client-side for seamless playback.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

To use the OpenAI SDKs, set the base URL to https://api.seeu168casino.com/v1. This allows you to send requests using the standard library while leveraging our TTS endpoint.

Pass your API key via the Authorization header. The SDK handles serialization, letting you focus on generating synthetic audio for your ML datasets.

Base URL Configuration

Initialize your client with the modified base URL. This directs all speech requests to our infrastructure without changing the SDK's core behavior.

Code Example

```python from openai import OpenAI client = OpenAI( base_url="https://api.seeu168casino.com/v1", api_key="tts-your-api-key" ) audio = client.audio.speech.create( model="tts-1", voice="aria", input="Synthetic data for model training." ) audio.write_to_file("output.mp3") ```

Compatibility Notes

The request shape matches the OpenAI speech endpoint. Standard libraries work seamlessly. We do not offer a proprietary SDK, so you rely on the official OpenAI client.

  • Use the official OpenAI SDK for Python or Node.js.
  • Ensure your API key starts with 'tts-'.

Request Parameters

Sound wave illustration for: Request Parameters

Configure your synthesis requests by selecting a model and voice that match your dataset requirements. The API supports two model variants, each with identical engine performance and pricing, allowing you to choose based on specific quality needs without affecting your character-based billing.

Model Selection

You can choose between "tts-1" and "tts-1-hd" in the model field. Both models use the same underlying engine and are priced identically at $0.01 per 1,000 characters. The distinction lies only in the audio fidelity characteristics, so select the variant that best suits your training data standards without worrying about cost differences.

Voice Selection

The API provides eight distinct voice presets, ranging from warm narrators to energetic promo speakers. You specify the desired voice using the voice parameter. Each voice is capable of speaking all 23 supported languages, ensuring consistent character quality across your multilingual synthetic datasets.

  • Female: aria, nova, luna, sage
  • Male: felix, milo, atlas, orion

Speed and Language

Adjust the speaking rate using the speed parameter, which accepts values between 0.25 and 4.0. This allows you to create varied pacing for your audio samples. You can also explicitly set the language using an ISO code to ensure accurate pronunciation, especially for Latin-script texts that might otherwise default to English.

Request Parameters

Response Formats

Sound wave illustration for: Response Formats

The API returns synthesized audio directly in the response body, allowing your application to stream or save the file immediately. Each generated file contains an inaudible watermark marking it as synthetic speech, which helps identify AI-generated content without affecting playback quality.

MP3 Output

MP3 is the default format, offering a good balance between file size and quality. It is widely supported by media players and web browsers, making it ideal for quick prototyping and general-purpose applications.

WAV Output

WAV provides uncompressed, high-quality audio suitable for professional editing or analysis. This format preserves the full fidelity of the generated speech, ensuring no data loss during post-processing or integration with other audio tools.

OPUS, FLAC, PCM

OPUS offers efficient compression, while FLAC provides lossless compression for archival. PCM delivers raw, uncompressed audio data, which is useful for low-level audio processing.

  • OPUS: Efficient compression for streaming
  • FLAC: Lossless compression for archival
  • PCM: Raw, uncompressed data

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

SynthData Labs provides scalable synthetic audio generation for ML training datasets. Our API handles volume efficiently, but understanding limits ensures smooth integration for your product team’s data pipelines.

60 Requests Per Minute

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

Queue Behavior

Requests are processed sequentially. If you send multiple requests simultaneously, they wait in a queue. Longer texts take longer to generate, roughly 25 characters per second, which may extend queue wait times.

Handling 429 Errors

Exceeding the limit returns a 429 error. Implement exponential backoff in your script to retry after the limit resets. Failed synthesis requests are free, so retrying is safe if the error was due to a temporary queue delay.

Error Handling

Sound wave illustration for: Error Handling

Synthetic voice generation relies on precise request formatting and network stability. When inputs deviate from expected parameters, the API returns specific HTTP status codes to guide immediate correction without consuming your character balance.

Common Error Codes

The API uses standard HTTP codes to indicate success or failure. A 200 OK response confirms audio generation, while 400 Bad Request indicates invalid JSON, missing fields, or unsupported parameters. A 401 Unauthorized error means your Bearer token is missing or invalid.

  • 400: Invalid input format or unsupported voice/model combination.
  • 401: Missing or incorrect Authorization header.
  • 429: Rate limit exceeded (60 requests/minute).

Retry Logic

Implement exponential backoff for transient network issues or 429 Rate Limit errors. Since requests are processed sequentially during high load, short delays between retries prevent overwhelming the queue. Avoid rapid-fire retries, as they may accumulate and exceed your per-minute limit.

Free Failed Requests

If synthesis fails due to invalid parameters or internal errors, the charge is returned in full. You only pay for successfully generated audio files. This ensures your dataset augmentation budget is strictly tied to usable output, protecting your costs during development.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. We build natural sounding synthetic speech datasets for machine learning models.

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. Creative Commons Attribution 4.0
  3. IETF RFC 7845: Ogg Opus
  4. FFmpeg documentation
  5. Python documentation
  6. TRON developer hub: TRC-20
  7. openai-python on GitHub
  8. OpenAI API reference: create speech
  9. LibriTTS-R paper (arXiv 2305.18802)
  10. curl documentation
  11. Node.js documentation
  12. Tether (USDT)

More on this site