Cloud Text-to-Speech API: Integration Guide for Developers

By SmartVoice editorial team · Updated 2026-11-19

This guide provides a clear, step-by-step reference for indie developers integrating SmartVoice’s text-to-speech API into smart home and IoT applications. You will find concrete examples for authentication, request formatting, and error handling, along with specific details on supported languages, voices, and audio formats. The content is designed to help you build localized voice assistants with consistent quality and predictable performance.

We focus on practical integration using standard HTTP requests and the official OpenAI SDKs, ensuring you can get started quickly without managing complex infrastructure. Whether you are generating short wake-word responses or longer instructional audio, this page covers the essential parameters, rate limits, and pricing models needed to deploy reliable speech synthesis in your device firmware or backend services.

Cloud Text-to-Speech API: Integration Guide for Developers

Frequently asked questions

How do I get an API key?

Visit https://6game.info/get-api-key/ to sign up using Google or an email and password. Your account page displays your unique API key, current balance, and usage statistics. Each account is tied to a specific site, so ensure you are on the correct domain. You can issue a new key at any time, which immediately invalidates the previous one.

What is the base URL for the API?

The API base URL is https://api.6game.info/v1. You send POST requests to https://api.6game.info/v1/audio/speech for speech generation. Other endpoints include GET /v1/voices for voice details and GET /v1/models for model information. This structure mirrors the OpenAI speech endpoint, allowing you to use standard HTTP clients or compatible SDKs.

Which SDKs are compatible?

The API follows the same request shape as the OpenAI speech endpoint. Therefore, the official OpenAI SDKs work perfectly by changing the base_url to https://api.6game.info/v1. You can also use any standard HTTP client library. There is no proprietary SDK, so you rely on these established tools for integration.

How do I specify the voice?

Include a voice parameter in your JSON body, selecting from eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. You can also optionally specify an ISO language code to guide the synthesis. If omitted, the system guesses the language, defaulting to English for Latin script text.

Can I change the audio speed?

Yes, you can adjust the speed using the speed parameter in your request. The acceptable range is 0.25 to 4.0. A value of 1.0 represents normal speed. Adjusting this allows you to create faster announcements or slower, clearer instructions for your smart home or IoT applications.

What happens if I exceed the rate limit?

The rate limit is 60 requests per minute per key. Before your first top-up, it is 10 requests per minute. If you exceed this, requests may be queued or rejected. Failed requests do not incur charges. Monitor your usage on the account page.

How do I handle errors in my code?

The API returns standard HTTP status codes for errors. Failed synthesis requests are free, and any charges are returned in full. You should implement retry logic for transient errors. Check the response body for specific error details. Since requests are processed sequentially, high load may cause delays, so handle timeouts appropriately.

Is the API synchronous or asynchronous?

The API is synchronous. You send a POST request and wait for the audio file in the response. Requests are processed one after another, so under load, a request may wait in a queue. For very long texts, you must split the text and join the resulting audio files yourself.

What is the maximum text length?

Each request can contain up to 4096 characters of input text. Spaces and punctuation count toward this limit. For longer texts, you should split the content into chunks of 4096 characters or less, generate audio for each chunk, and then join the audio files in your application logic.

Can I use the API with Python?

Yes, you can use Python with the official OpenAI SDK or any HTTP library. Simply configure the base_url to https://api.6game.info/v1. Pass your API key in the Authorization header. This allows you to integrate text-to-speech into your Python-based services.

How do I specify the output format?

Use the response_format parameter in your JSON body. Supported formats are mp3, wav, opus, flac, and pcm. Choose the format that best suits your application’s needs. MP3 is efficient for storage, while WAV or PCM might be preferred for raw audio processing.

Do I need to install extra libraries?

You do not need a proprietary library. You can use the official OpenAI SDK or any standard HTTP client. For Python, this means installing the openai package or using requests. No additional SmartVoice-specific libraries are required.

Is JSON the only request format?

Yes, the API expects a JSON body for POST requests. The body must include the model, input text, voice, response_format, and optionally speed and language. This structure is identical to the OpenAI speech endpoint, ensuring compatibility with existing tools and SDKs that support this JSON schema.

How do I rotate my API key?

You can issue a new API key at any time from your account page. When you generate a new key, the old one stops working immediately. This allows you to rotate keys securely without downtime. You only have one active key per account, so update your applications promptly after rotation.

First request

curl

curl https://api.6game.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.6game.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.6game.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 is handled via a Bearer token passed in the Authorization header. This single key grants access to your account's balance and usage limits for all API requests.

Bearer token in header

Bearer token in header

Include Authorization: Bearer tts-... in every HTTP request. The API validates this token before processing synthesis tasks, ensuring only authorized devices or servers can generate audio.

One active key per account

One active key per account

Each account holds exactly one active API key. There are no separate keys for different projects or environments within the same account; all traffic shares the same rate limits and balance.

Rotate keys as needed

You can issue a new key at any time from the dashboard. The previous key stops working immediately upon rotation, providing a clean security boundary without downtime for existing integrations.

First Request with cURL

Sound wave illustration for: First Request with cURL

Generate audio with a single POST request to the speech endpoint. The API accepts plain text and returns an audio file directly in the response, making it easy to integrate into smart home voice assistants or IoT dashboards without complex streaming setups.

POST to /v1/audio/speech

Send your request to https://api.6game.info/v1/audio/speech with your Bearer token in the Authorization header. The endpoint accepts JSON payloads and returns the synthesized audio file immediately, ensuring straightforward integration for indie developers building localized voice features.

JSON body with input text

Include your text in the input field, limited to 4096 characters per request. For longer scripts, split the text into chunks and join the resulting audio files. The system handles character counting accurately, including spaces and punctuation, for precise billing.

Specify voice and format

Choose from eight distinct voices like Aria or Felix, adjusting speed between 0.25 and 4.0. Select formats such as MP3, WAV, or OPUS to optimize file size for your IoT devices, ensuring efficient bandwidth usage while maintaining clear audio quality for voice commands.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

The SmartVoice API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing OpenAI SDK clients with minimal configuration. This compatibility simplifies integration for developers already familiar with OpenAI’s ecosystem, requiring only a base URL adjustment.

By pointing the SDK’s base URL to https://api.6game.info/v1, you can leverage standard OpenAI libraries for authentication and request handling. This approach ensures consistent behavior and reduces the learning curve for IoT projects relying on established client libraries.

Change base_url to api domain

Update your SDK configuration to use https://api.6game.info/v1 as the base URL. This directs all requests to our TTS endpoint while maintaining the standard header structure required for authentication.

Ensure your API key is passed via the Authorization: Bearer header. The SDK will handle the rest, ensuring requests reach the correct smart home voice service.

  • Base URL: https://api.6game.info/v1
  • Header: Authorization: Bearer <your-key>

Use official OpenAI SDKs

Leverage official OpenAI SDKs for your preferred language (Python, Node.js, etc.). These libraries provide robust error handling and automatic retries, which are crucial for reliable IoT voice assistants.

Since the request shape is identical, you can switch providers or scale your solution without rewriting core integration logic, preserving your existing codebase structure.

Compatible request shape

The API accepts the same JSON body as OpenAI’s speech endpoint, including model, input, voice, and response_format. This compatibility allows you to swap endpoints without altering your payload construction logic.

Simply replace the model identifier with tts-1 or tts-1-hd and ensure the voice parameter matches one of our eight presets. The SDK handles serialization, ensuring your smart home device receives valid audio data.

Supported Formats

Sound wave illustration for: Supported Formats

SmartVoice supports five audio formats: MP3, WAV, OPUS, FLAC, and PCM. This range allows you to balance compatibility and file size for your specific deployment environment. Each format serves a distinct purpose in embedded systems and web applications.

MP3, WAV, OPUS, FLAC, PCM

MP3 offers broad compatibility with minimal storage overhead. WAV and FLAC provide lossless quality for archival or high-fidelity playback. OPUS is a supported format, while PCM delivers raw, uncompressed data for direct hardware processing.

  • MP3: Balanced quality and size.
  • WAV/FLAC: Lossless fidelity.
  • OPUS: Efficient compression.
  • PCM: Raw audio data.

Choose based on device needs

Select formats that match your target hardware’s capabilities. Resource-constrained devices may benefit from OPUS or MP3, while systems with ample storage can utilize FLAC for pristine audio quality. Ensure your player supports the chosen codec.

Smaller files for IoT

For IoT applications, bandwidth and storage are critical. Smaller files like MP3 or OPUS reduce transmission time and conserve memory. This efficiency ensures faster response times for voice assistants in smart home environments.

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a strict rate limit of 60 requests per minute per active key. This ensures fair usage across all indie developers and keeps the service reliable for your smart home voice assistants. If you exceed this threshold, the API returns a 429 error until the window resets.

Before your first top-up, new accounts are limited to 10 requests per minute. This lower cap allows you to test integration without immediate pressure. Once you add USDT, the limit increases to the standard 60 requests per minute.

60 requests per minute

Each active API key is allowed 60 requests per minute. This limit applies globally to your key, covering all models and voices. For most IoT applications, this throughput is sufficient for generating short voice prompts or status updates.

If you need higher throughput, consider splitting your requests or using multiple keys, though each account is limited to one active key at a time. Rotate your key if you need to issue a new one for a different environment.

  • Limit: 60 requests/minute per key
  • Applies to all models and voices
  • Reset every 60 seconds

10 requests before top-up

New accounts start with a reduced limit of 10 requests per minute. This allows you to verify your integration setup without exceeding your free trial credit. You can top up with USDT to unlock the full 60 requests/minute capacity.

Top-ups are processed automatically within minutes after your TRC-20 transfer. Once credited, your rate limit increases immediately, and you can proceed with higher volume generation.

  • Initial limit: 10 requests/minute
  • Unlocks after USDT top-up
  • No minimum top-up amount

Queueing under load

Requests are processed sequentially during high load. If you send many requests simultaneously, they may queue behind previous tasks. This ensures consistent voice quality and prevents system overload.

Longer texts take more time to generate, so under heavy load, your request may wait in the queue. Plan your integrations to account for this latency, especially for time-sensitive voice responses in your smart home devices.

  • Requests processed sequentially
  • Queueing under high load
  • Latency increases with volume
Rate Limits

Error Handling

Sound wave illustration for: Error Handling

When integrating SmartVoice into smart home devices, predictable error responses help maintain a smooth user experience. Understanding the specific HTTP status codes allows your application to handle failures gracefully without unnecessary retries or user confusion.

400 for invalid input

A 400 error indicates that the request body is malformed. This typically happens if the input text exceeds the 4096-character limit or if the voice parameter references an unknown preset. Check your payload structure against the OpenAI-compatible schema.

401 for bad key

The 401 Unauthorized error occurs when the Authorization: Bearer header is missing or contains an invalid API key. Ensure your key is active and correctly passed in every request. If you rotated your key, the old one stops immediately.

429 for rate limit

A 429 response means you have exceeded the limit of 60 requests per minute. If your account has not yet topped up, the limit is stricter at 10 requests per minute. Implement exponential backoff to handle queueing under load.

Model Selection

Sound wave illustration for: Model Selection

Choose between two engine configurations for your smart home voice assistant. Both models deliver consistent audio quality suitable for localized voice responses, but they offer different processing characteristics.

tts-1 standard model

The standard model processes text efficiently, making it ideal for quick, real-time responses in IoT devices where latency matters. It handles the 4096-character limit.

tts-1-hd high quality

The HD variant provides enhanced audio fidelity. Use this when voice clarity is prioritized over raw processing speed.

Same price for both

Both models are priced identically at $10 per million characters. You can switch between them without affecting your billing.

Voice Parameters

Sound wave illustration for: Voice Parameters

Configure voice parameters to tailor audio output for your IoT devices. The API accepts a voice preset name and a speed multiplier, allowing you to adjust playback rate between 0.25x and 4.0x. This flexibility ensures voices fit your application's context, from slow instructional guides to rapid status updates.

Set voice by name

Select from eight distinct voices, including Aria, Nova, Luna, Sage, Felix, Milo, Atlas, and Orion. Each voice offers a specific tonal quality, such as warm narration or energetic promo styles. Pass the voice identifier in the request body to generate audio with the desired character.

  • Female voices: Aria, Nova, Luna, Sage
  • Male voices: Felix, Milo, Atlas, Orion
  • All voices support all 23 languages

Adjust speed 0.25–4.0

The speed parameter accepts values from 0.25 to 4.0. Use lower speeds for clear instructional content and higher speeds for quick notifications. The system processes requests sequentially, so faster speeds reduce generation time, helping you stay within rate limits during high-volume IoT updates.

Optional language code

You can optionally specify a language using its ISO code. If omitted, the system guesses the language from the text script, defaulting to English for Latin text. For non-English Latin scripts, explicitly setting the language ensures accurate synthesis, as any voice can speak any supported language.

  • Supported languages include English, German, French, Spanish, and 19 others
  • Voice selection is independent of language

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. When a voice assistant confirms a locked door or adjusts the thermostat, consistency in timbre reinforces trust.

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

More on this site