Developer Guide for IoT Text to Speech API

By SmartVoice editorial team · Updated 2026-11-19

This guide shows IoT developers how to integrate natural-sounding speech into smart home devices, kiosks, and voice assistants using the VoxaHome REST API. You will find concrete steps for authentication, endpoint usage, and SDK configuration, along with examples for 23 languages including Hindi. Everything you need to generate audio from text is here, tailored for startups building voice-first products.

You will learn how to handle requests, manage keys, and troubleshoot common issues without unnecessary complexity. The documentation covers rate limits, response formats, and data privacy policies so you can deploy confidently. Whether you are prototyping or scaling, this page gives you the technical details to get audio generation working quickly and reliably.

Developer Guide for IoT Text to Speech API

Frequently asked questions

How do I get an API key?

Sign up on our /get-api-key/ page using Google or email. Accounts are per site. You will receive one active key per account, visible on your dashboard alongside your balance and usage statistics.

What is the base URL?

The API base URL is https://api.tk6666.info/v1. You can use the official OpenAI SDKs by changing the base_url to this address and providing your site-specific key for authentication.

Which models are available?

We offer two models: 'tts-1' and 'tts-1-hd'. Both use the same engine and have identical pricing. You can check available models via the GET /v1/models endpoint.

How do I specify a voice?

Include the 'voice' field in your JSON body with one of eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. List all voices using the GET /v1/voices endpoint.

Can I change the language?

Yes, set the optional 'language' field to an ISO code. If omitted, the system guesses the language from the script, defaulting to English for Latin text. Supported languages include Hindi, Spanish, and German.

What formats are supported?

You can request audio in mp3, wav, opus, flac, or pcm formats. Specify the desired format using the 'response_format' field in your request body to match your IoT device requirements.

What is the character limit?

Each request accepts up to 4096 characters of input text. For longer texts, split them into parts, generate audio for each, and join the resulting files. Spaces and punctuation count toward the limit.

How do I handle errors?

Failed requests are free, with charges returned in full. Monitor your dashboard for usage status. If synthesis fails, no credit is deducted. Ensure your text is under 4096 characters and your key is valid.

Is there an SDK?

We do not have an official custom SDK. However, the API matches the OpenAI speech endpoint shape, so you can use the official OpenAI SDKs by pointing them to our base URL.

What are the rate limits?

You are limited to 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. Exceeding this may result in queued processing or temporary throttling.

How is data used?

Input text is used only to produce audio and is not used for training. Generated audio is returned in the response and not stored. We keep request metadata for billing purposes only.

Can I use multiple keys?

Each account has one active key. You can issue a new key at any time, which immediately stops the old one. This allows you to rotate keys or generate new ones as needed.

How do I rotate keys?

Generate a new key via your dashboard. The new key becomes active immediately, and the old one stops working at once. This ensures seamless transition without downtime for your IoT applications.

What is the response time?

Typical speed is roughly real-time, about 25 characters per second. Short phrases take a few seconds. Requests are processed sequentially, so under load, a request may wait in a queue.

First request

curl

curl https://api.tk6666.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.tk6666.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.tk6666.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 and Keys

Sound wave illustration for: Authentication and Keys

Secure your IoT audio pipeline by generating a unique API key via the /get-api-key/ dashboard. You can authenticate using Google or a standard email account, ensuring your smart home devices and kiosks have access to the TTS engine from day one.

Get Your API Key

Get Your API Key

Navigate to the dashboard to create your key. It acts as the single credential for all requests. Start with the free trial credit to test voice quality before scaling to production deployments.

  • One active key per account
  • Instant generation via dashboard
  • Free trial credit included for Google sign-ins

Bearer Token Usage

Bearer Token Usage

Include your key in the HTTP header as Authorization: Bearer tts-.... This standard method ensures secure transmission over HTTPS for all voice synthesis requests from your IoT infrastructure.

Key Rotation

Rotate keys anytime from the dashboard. The old key stops immediately, providing instant security updates without downtime for your connected devices.

Endpoints and Methods

Sound wave illustration for: Endpoints and Methods

The API exposes three core endpoints for IoT integration. POST /v1/audio/speech handles the synthesis, while GET /v1/voices and GET /v1/models provide metadata for configuration.

These endpoints allow your smart home devices or kiosks to fetch available voices and model details before generating audio content.

POST /v1/audio/speech

Send text and receive an audio file. This endpoint accepts a JSON body with fields like model, input, voice, response_format, speed, and language. It returns the synthesized audio directly in the response.

Use this for generating voiceovers for smart speakers, kiosk announcements, or voice assistant responses. The endpoint supports formats like mp3, wav, opus, flac, and pcm.

  • Accepts JSON body with TTS parameters
  • Returns audio file directly in response
  • Supports multiple audio formats
  • Ideal for generating voice content for IoT devices

GET /v1/voices

Retrieve a list of available voices, their associated languages, supported formats, and pricing information. This helps you select the right voice for your specific use case.

Use this endpoint to dynamically fetch voice options based on the language requirements of your IoT device or application.

  • List of 8 voice presets
  • Language and format support details
  • Pricing information per voice
  • Dynamic voice selection for IoT

GET /v1/models

Fetch details about available TTS models, including tts-1 and tts-1-hd. Both models use the same engine and pricing, allowing you to choose based on quality preferences.

This endpoint is useful for ensuring your IoT devices are using the latest available models for optimal audio quality.

  • Details of tts-1 and tts-1-hd models
  • Same engine and pricing for both models
  • Helps in model selection for IoT
  • Ensures use of latest models

Request Parameters

Sound wave illustration for: Request Parameters

The API requires a model name, input text, and voice selection. Supported models are tts-1 and tts-1-hd, using the same engine and price. Input text is limited to 4,096 characters per request; longer texts must be split and joined by the client.

Voice selection determines the speaker's character, while the optional language field ensures correct pronunciation. If language is omitted, the system guesses from the script, defaulting to English for Latin text. Always set the language for non-English Latin-script inputs to avoid errors.

Model Selection

Choose between tts-1 and tts-1-hd. Both models use the same underlying engine and pricing structure ($0.01 per 1,000 characters). Select tts-1-hd if you prefer the HD model, as both use the same engine and pricing.

Input Text Limits

Each request accepts up to 4,096 characters. Spaces and punctuation count toward this limit. For announcements longer than this, split the text into chunks, generate audio for each, and concatenate the results in your IoT firmware or backend service.

  • Limit: 4,096 characters per request
  • Spaces and punctuation count as characters
  • Split and join manually for longer content

Voice and Language

Select one of eight voice presets, such as atlas for news or nova for upbeat prompts. The optional language field accepts ISO codes. Without it, Latin text defaults to English. Explicitly set the language for non-English Latin scripts to ensure accurate synthesis.

  • 8 voice presets available
  • Optional language field for ISO codes
  • Default language for Latin script is English

Response Formats

Sound wave illustration for: Response Formats

The API returns audio files in MP3, WAV, OPUS, FLAC, or PCM formats, allowing you to balance bandwidth and quality for your IoT device. MP3 is efficient for bandwidth-constrained devices, while WAV offers uncompressed clarity for local kiosks. PCM is available for raw processing pipelines.

MP3, WAV, OPUS, FLAC, PCM

Select the format via the response_format parameter. MP3 provides the smallest file size, ideal for devices with limited storage or bandwidth. WAV and FLAC offer lossless quality for high-fidelity voice assistants. OPUS balances efficiency and quality, while PCM delivers raw uncompressed audio data.

  • MP3: Efficient for bandwidth-constrained smart home devices
  • WAV: Uncompressed audio for local playback
  • OPUS: Efficient codec for voice assistants
  • FLAC: Lossless compression
  • PCM: Raw audio data for custom processing

Audio Stream Handling

For long texts exceeding 4096 characters, the API returns a single concatenated audio file if the input is split internally, or you can split the text client-side and join the resulting audio files. The response includes the audio data directly in the body, so no additional streaming endpoints are needed.

Error Responses

If synthesis fails, the request is free, and you receive a JSON error object with a status code and message. Common errors include invalid voice IDs, text exceeding character limits, or rate limit exceeded. Check the response body for details to adjust your client logic accordingly.

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

SDK Integration

Sound wave illustration for: SDK Integration

Our API mirrors the OpenAI speech endpoint shape, allowing you to reuse existing OpenAI SDKs with minimal changes. This compatibility simplifies integration for IoT teams already familiar with standard HTTP client patterns.

OpenAI SDK Compatibility

Use the official OpenAI SDKs by simply overriding the base URL. The request structure is identical, meaning you can switch providers or test locally without rewriting your voice synthesis logic. This standardization reduces development time for voice assistant implementations.

  • Compatible with OpenAI SDKs
  • Identical JSON request body structure
  • Standard Bearer token authentication

Base URL Configuration

Point your SDK client to https://api.tk6666.info/v1 instead of the default OpenAI endpoint. Ensure your API key starts with 'tts-' and is passed in the Authorization header. This single configuration change routes all speech requests to our infrastructure.

Code Examples

Here is a quick Python snippet using the OpenAI library to generate speech for a smart speaker:

import openai client = openai.OpenAI(base_url="https://api.tk6666.info/v1", api_key="tts-your-key") response = client.audio.speech.create(model="tts-1", voice="nova", input="Welcome to your smart home.", response_format="mp3") response.stream_to_file("output.mp3")

SDK Integration

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

VoxaHome enforces a rate limit of 60 requests per minute per API key. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed, preventing sudden bursts from overwhelming the queue during initial integration tests.

60 Requests Per Minute

Each active API key allows a maximum of 60 synthesis requests within any 60-second window. This limit applies globally to the key, so if you deploy multiple smart speakers or kiosks, they share this quota. Exceeding the limit results in a 429 Too Many Requests error, so plan your batch sizes accordingly.

  • Limit: 60 requests/minute per key (after first top-up)
  • Initial limit: 10 requests/minute for new accounts
  • Applies to all endpoints consuming characters

Queue Behavior

Requests are processed sequentially, not in parallel. If you send 60 requests instantly, the last one must wait for the first 59 to complete. Long texts take longer to generate (roughly 25 characters per second), so a single long request might hold the queue for several seconds, potentially blocking subsequent calls until it finishes.

  • Processed one after another
  • Long texts block the queue longer
  • Short phrases take a few seconds

Monitoring Usage

You can track your current usage and remaining characters via the /get-api-key/ dashboard. The dashboard shows real-time character counts and request status, helping you stay within your budget. Since failed requests are free, you can monitor error rates to adjust your retry logic without wasting credits.

Troubleshooting

Sound wave illustration for: Troubleshooting

Integration hiccups are common when moving from development to production. This guide covers frequent issues specific to IoT deployments, ensuring your devices handle audio generation gracefully without blocking the user experience.

Common Errors

A 400 status indicates invalid input, such as text exceeding 4096 characters or an unsupported voice. Always validate your payload before sending. A 401 error means your Bearer token is missing or expired; rotate keys immediately if unauthorized access is suspected.

  • Check character count limits strictly
  • Verify token format and expiration

Timeout Handling

Synthesis takes roughly real-time duration. For long texts, expect delays proportional to length. If your device waits too long, implement a non-blocking call. Do not assume instant response for complex narratives.

Retry Logic

Use exponential backoff for transient errors. Since requests queue under load, immediate retries may fail. Wait briefly before re-attempting to avoid overwhelming the API endpoint during peak usage times.

Security and Data

Sound wave illustration for: Security and Data

Your IoT devices communicate securely over HTTPS, ensuring that your text payloads and generated audio streams remain encrypted in transit. This simple layer protects your smart home data from eavesdropping as it moves between your cloud infrastructure and the API.

We prioritize simplicity and transparency in how we handle your information.

HTTPS Encryption

All API requests and responses are transmitted over HTTPS. This ensures that your text inputs and resulting audio files are encrypted during transfer, keeping your smart home commands and voice outputs secure between your device and our servers.

Data Retention Policy

Generated audio is returned directly in the response and is not stored on our servers. We retain only the request metadata—such as timestamp, character count, and status code—necessary for accurate billing and usage tracking.

No Training Usage

The text you send is used exclusively to generate the requested audio file. We do not use your input data or generated audio to train our models or improve our voice engines, ensuring your content remains yours.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Choose voices with clear enunciation to cut through ambient noise effectively.

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. Tether (USDT)
  3. openai-python on GitHub
  4. IETF RFC 7845: Ogg Opus
  5. curl documentation
  6. Node.js documentation
  7. Python documentation
  8. MDN: Web Speech API
  9. ISO 639 language codes
  10. LibriTTS-R paper (arXiv 2305.18802)
  11. TRON developer hub: TRC-20
  12. LibriVox public-domain audiobooks

More on this site