Text-to-Speech API Documentation and Quickstart

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

This guide provides the essential integration steps for the SmartTTS Labs text-to-speech API, designed specifically for indie developers building smart home hubs and IoT devices. You will find precise specifications for endpoints, request parameters, and response formats, ensuring seamless audio generation within constrained environments.

Learn how to authenticate with Bearer tokens, manage API keys, and handle rate limits efficiently. The documentation covers practical SDK integration using the OpenAI client library and includes ready-to-use cURL examples. All technical details align with our predictable pricing model for reliable synthetic voice delivery.

Text-to-Speech API Documentation and Quickstart

Frequently asked questions

What is the API endpoint?

Send a POST request to https://api.lv177casino.com/v1/audio/speech. The JSON body accepts model, input, voice, response_format, speed, and language parameters. This endpoint handles text-to-speech synthesis, returning the generated audio file directly in the response body for immediate use in your IoT or smart home application.

How do I authenticate?

Include your API key in the request header as Authorization: Bearer tts-.... You receive one active key per account. If you need a new key, issuing it immediately invalidates the previous one, ensuring only one active credential exists at any time for your integration.

Can I use the OpenAI SDK?

Yes. The API uses the same request shape as the OpenAI speech endpoint. Simply change the SDK's base_url to https://api.lv177casino.com/v1 and provide your site-specific key. This allows you to use official OpenAI SDKs without modifying your existing code structure significantly.

What is the maximum input length?

Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. For longer texts, split the content into chunks of 4096 characters or less, generate audio for each part, and join the resulting audio files in your application.

Which audio formats are supported?

You can request audio in mp3, wav, opus, flac, or pcm formats via the response_format field. Choose opus or mp3 for efficient bandwidth usage on IoT devices, or wav and flac for high-fidelity requirements. PCM is available for raw audio processing pipelines.

What are the rate limits?

The limit is 60 requests per minute per key. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed. Requests are processed sequentially, so under load, synthesis may wait in a queue before generating audio.

How do I handle errors?

If synthesis fails, the request charge is returned in full. Failed requests do not incur costs. Monitor your response status codes to detect issues. Since requests are queued, ensure your client handles temporary delays gracefully without assuming immediate failure for high-volume bursts.

Can I change the base URL?

Yes, if you are using an SDK. Set the base_url configuration to https://api.lv177casino.com/v1. This ensures all SDK requests route to our infrastructure. Direct HTTP clients should use this base URL for all endpoint calls, such as /audio/speech or /voices.

Is SSML supported?

No. The API does not support SSML markup. You must provide plain text input. If you need specific pacing or pronunciation, adjust the speed parameter between 0.25 and 4.0, or select a voice preset that matches the desired tone and style.

How do I rotate my API key?

Issue a new key from your account dashboard. The new key becomes active immediately, and the old key stops working at once. This allows seamless rotation without downtime. Ensure your IoT devices update their configuration to use the new key before the old one expires.

What happens on rate limit exceed?

Requests are processed sequentially and may wait in a queue. The rate limit is 60 requests per minute per key. Under load, a request may wait in the queue before processing. While the API enforces this 60 req/min limit, the specific HTTP error code for exceeding capacity is not explicitly defined in the documentation.

Can I stream the audio?

No. The API returns the complete audio file in the response body after synthesis finishes. There is no WebSocket or streaming endpoint for partial audio chunks. You must wait for the full file to be generated before playing it on your device.

How do I get the list of voices?

Send a GET request to https://api.lv177casino.com/v1/voices. This endpoint returns available voices, languages, formats, and pricing details. You can use this data to dynamically populate your device's voice selection menu or configure your application's default audio output settings.

What is the default voice?

The API does not define a default voice. While the voice parameter is listed among eight presets, the specification does not explicitly mark it as optional or assign a default value. To ensure predictable audio generation, you should always explicitly specify the desired voice (e.g., aria, nova, luna, sage, felix, milo, atlas, or orion) in your requests. This prevents ambiguity and guarantees consistent results across different calls.

First request

curl

curl https://api.lv177casino.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.lv177casino.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.lv177casino.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 passed in the Authorization header. This single key manages your account's access to the speech generation endpoints.

Bearer token

Include Authorization: Bearer tts-... in every request. The token authenticates your account and tracks usage against your rate limits and balance.

API key issuance

Retrieve your key on the /get-api-key/ dashboard after signing in with Google or email. One active key is issued per account.

Key rotation

Generate a new key via the dashboard at any time. The previous key becomes invalid immediately, ensuring secure access management for your IoT deployments.

Endpoints

Sound wave illustration for: Endpoints

The API exposes three core endpoints for generating audio and managing resources. The speech endpoint accepts POST requests to synthesize text into audio files. Two additional endpoints provide metadata about available voices and model configurations, allowing developers to inspect supported languages, formats, and pricing before making synthesis requests.

Speech endpoint

Use POST https://api.lv177casino.com/v1/audio/speech to send text and receive an audio file. The request body follows the same JSON structure as the OpenAI speech endpoint, ensuring compatibility with existing SDKs. Send your text (up to 4096 characters), select a voice, and specify the desired response format.

Voices list

Call GET https://api.lv177casino.com/v1/voices to retrieve available voices, supported languages, formats, and current pricing. This endpoint helps you verify which presets fit your smart home or IoT use case before integrating audio generation into your device firmware or hub software.

Models list

Access GET https://api.lv177casino.com/v1/models to view the available model identifiers. This endpoint confirms the existence of the tts-1 and tts-1-hd models, which share the same engine and pricing structure. Use this information to ensure your integration targets the correct model IDs.

Endpoints

Request Parameters

Sound wave illustration for: Request Parameters

Configure your synthesis requests with precision using three core parameters. The API accepts standard model identifiers and supports text up to 4096 characters per call, ensuring compatibility with existing OpenAI SDK workflows.

Model selection

Select between "tts-1" for standard quality or "tts-1-hd" for higher fidelity. Both models use the same engine and pricing structure, allowing you to upgrade quality without changing your integration logic.

Input text limit

Each request supports a maximum of 4096 characters, including spaces and punctuation. For longer content, split the text into chunks and join the resulting audio files sequentially.

Voice selection

Choose from eight presets optimized for different tones, such as "nova" for upbeat notifications or "atlas" for neutral news updates. The voice determines the character's timbre but does not affect the base price.

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

Response Formats

Sound wave illustration for: Response Formats

The API returns audio data in the requested format, allowing you to choose between compressed and lossless options based on your smart home hub’s playback capabilities.

MP3 support

MP3 is a widely supported compressed format, ideal for efficient storage and transmission over standard network connections.

WAV support

WAV provides uncompressed audio, ensuring maximum fidelity for devices that prioritize sound quality over bandwidth constraints.

Other formats

Opus offers efficient compression for low-bandwidth environments, while FLAC provides lossless quality for archival needs. PCM is available for raw data processing.

  • Opus: Efficient compression
  • FLAC: Lossless quality
  • PCM: Raw data

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a strict rate limit of 60 requests per minute per active key. This cap applies to all synthesis endpoints, including /v1/audio/speech. Since requests are processed sequentially, heavy concurrent usage may result in queuing delays, especially for longer texts that require client-side splitting.

Monitoring your current usage and limits is best done via the dashboard on /get-api-key/, which displays your real-time character consumption and key status. The /v1/voices endpoint provides voice metadata but does not return usage metrics.

60 requests per minute

Each API key is limited to 60 requests per minute. This limit is consistent across all models (tts-1 and tts-1-hd) and response formats. If you exceed this threshold, the API returns a 429 Too Many Requests error. Requests are processed one after another, so under load, a request may wait in a queue before synthesis begins.

Long texts must be split by the client into parts of up to 4,096 characters. The API does not split text internally. You are responsible for joining the resulting audio files after synthesis completes. Each split counts as one request against your per-minute limit.

  • Limit: 60 requests/minute per key
  • Processing: Sequential (queued under load)
  • Text split: Client-side, max 4,096 chars per part
  • Error on exceed: HTTP 429

Initial limit

New accounts start with a reduced limit of 10 requests per minute. This lower threshold helps stabilize system load for new users before they top up their balance. The limit automatically increases to the standard 60 requests per minute once a top-up is successfully processed.

This initial limit applies regardless of whether you are using the free trial credit or a paid balance. You can verify your current rate limit status on the dashboard, where your key details and usage stats are displayed.

  • New account limit: 10 requests/minute
  • Standard limit: 60 requests/minute
  • Trigger for upgrade: Successful top-up
  • Status view: Dashboard /get-api-key/

Upgrade process

To increase your rate limit from 10 to 60 requests per minute, you must perform a top-up. The minimum top-up amount is $5.00 USDT via the TRON network (TRC-20). Once the transfer is confirmed on the blockchain, your balance is credited automatically within minutes.

Upon successful top-up, your rate limit is instantly upgraded to the standard 60 requests per minute. There are no monthly plans or subscriptions; you pay only for what you use. Your balance does not expire, allowing you to scale your usage as needed.

Note that rate limits are tied to your API key, not your account. If you rotate your key, the new key inherits the current rate limit status based on your account's top-up history.

  • Minimum top-up: $5.00 USDT (TRC-20)
  • Processing time: Automatic, within minutes
  • Limit upgrade: Instant after confirmation
  • Currency: USDT only
  • No subscriptions or monthly plans
Rate Limits

Error Handling

Sound wave illustration for: Error Handling

Handling API responses correctly ensures robust integration for smart home devices. When synthesis fails, the charge is returned in full, protecting your budget. Understanding specific failure modes helps you maintain reliable audio pipelines for IoT hubs.

Common errors

Invalid input often triggers a 400 Bad Request if the JSON structure is malformed or fields are missing. Ensure your input text respects the 4,096 character limit per request to avoid rejection.

Retry logic

For transient issues, implement exponential backoff. Requests are processed sequentially, so under load, synthesis may queue. Retry after a short delay to respect the 60 requests per minute limit per key.

Status codes

Use standard HTTP codes to determine action. A 400 indicates client-side input errors. Rate limits are enforced at 60 requests per minute, so monitor your key usage to avoid service interruption.

SDK Integration

Sound wave illustration for: SDK Integration

The API accepts standard JSON bodies identical to the OpenAI speech endpoint, allowing you to leverage existing OpenAI SDKs with minimal configuration. By updating the base URL to point to our infrastructure, you can maintain familiar code structures while accessing our specific voice models and pricing tiers.

OpenAI SDK usage

Since the request shape matches the official OpenAI specification, you can use the standard OpenAI Python or Node.js SDKs. This eliminates the need to write custom HTTP clients or handle authentication headers manually, reducing integration time for indie developers building smart home hubs.

  • Compatible with official OpenAI SDKs
  • Standard JSON request body
  • No custom client required

Base URL change

To direct traffic to our service, modify your SDK client configuration to use https://api.lv177casino.com/v1 as the base URL. Ensure you pass your unique API key via the Authorization: Bearer header for each request.

Python example

Below is a minimal Python snippet using the OpenAI SDK to generate speech. Replace YOUR_API_KEY with your key from /get-api-key/.

  • import openai
  • client = openai.OpenAI(base_url="https://api.lv177casino.com/v1", api_key="YOUR_API_KEY")
  • response = client.audio.speech.create(model="tts-1", voice="nova", input="Hello, smart home.")
SDK Integration

cURL Example

Sound wave illustration for: cURL Example

cURL provides a direct way to verify your TTS integration without installing SDKs. This method is useful for quick testing or debugging specific voice parameters before implementing the final solution in your smart home hub or IoT device.

Below is the standard request structure. It demonstrates how to send text and receive audio data using the command line interface.

Basic request

Execute the following command to generate speech. Replace YOUR_API_KEY with your actual token. The request targets the speech endpoint with a simple text string and the nova voice preset.

curl -X POST "https://api.lv177casino.com/v1/audio/speech" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "Hello from SmartTTS Labs", "voice": "nova"}'

JSON body

The request payload uses standard JSON fields. The model field accepts either "tts-1" or "tts-1-hd". You can optionally specify a language code if the default English detection is insufficient for your text.

  • model: "tts-1" or "tts-1-hd"
  • input: Text string (max 4096 characters)
  • voice: One of 8 presets (e.g., nova, aria)
  • response_format: mp3, wav, opus, flac, or pcm
  • speed: Float between 0.25 and 4.0

Response handling

The API returns the audio file directly in the response body. If successful, the HTTP status is 200. You can save the output to a file using the -o flag. Failed requests return an error object with details about the issue, such as invalid input or rate limits.

image":

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Build intelligent devices that seamlessly connect everyday objects for a truly responsive living experience.

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. LibriVox public-domain audiobooks
  3. IETF RFC 7845: Ogg Opus
  4. openai-python on GitHub
  5. LibriTTS-R paper (arXiv 2305.18802)
  6. FFmpeg documentation
  7. Tether (USDT)
  8. Creative Commons Attribution 4.0
  9. W3C WAI: making audio and video accessible
  10. MDN: Web Speech API
  11. curl documentation
  12. OpenAI API reference: create speech

More on this site