Cloud Text-to-Speech API: Generate Audio from Text

By LingoSay Editorial Team · Updated 2026-11-19

This guide shows indie developers how to integrate LingoSay’s text-to-speech API into games and apps. You will learn to generate audio files by sending text via a standard HTTP POST request. The interface mirrors the OpenAI speech endpoint, so you can use existing OpenAI SDKs or simple curl commands with minimal code changes. We cover authentication, parameter tuning, and error handling to help you prototype quickly and launch without enterprise bloat.

You will find concrete examples for every step, from signing up for a free trial to managing your API key. Learn how to select voices, control speed, and handle rate limits efficiently. Whether you are building a narrative game or a voice-enabled utility, this reference provides the specific details you need to generate high-quality audio reliably and affordably.

Cloud Text-to-Speech API: Generate Audio from Text

Frequently asked questions

How do I generate an API key?

Sign up on /get-api-key/ using Google or email. Your account page displays your active key, balance, and usage. You can issue a new key at any time, which immediately invalidates the previous one. Each account is tied to a single active key for authentication.

What is the endpoint URL?

Use POST https://api.w567casino.com/v1/audio/speech. You can also access GET /v1/voices for voice details and GET /v1/models for model information. These endpoints follow the same structure as standard TTS services, making integration straightforward for developers using common HTTP clients.

Can I use the OpenAI SDK?

Yes. The API accepts the same request shape as the OpenAI speech endpoint. Simply change the base_url to https://api.w567casino.com/v1 and use your LingoSay key. The official OpenAI SDKs work seamlessly without modification, allowing for quick integration into existing projects.

How do I handle rate limits?

Limits are 60 requests per minute per key (10 per minute before the first top-up). Requests are processed one after another, so under load a request may wait in a queue. Monitor your usage via the account dashboard to stay within limits and ensure smooth audio generation for your application.

What audio formats are supported?

You can request mp3, wav, opus, flac, or pcm via the response_format field. Choose the format that best fits your application’s needs. All formats are generated from the same engine.

How does language detection work?

If you do not set the language field, the system guesses it from the script. Latin script defaults to English. For non-English Latin text, explicitly set the language parameter. Supported languages include Arabic, Chinese, English, French, German, Japanese, Spanish, and 17 others.

What happens if a request fails?

Failed requests are free. If synthesis fails, the charge is returned in full. You can retry the request without worrying about extra costs. This ensures you only pay for successfully generated audio files, making the API risk-free for prototyping and production use.

How do I set the voice speed?

Use the speed field in your request body, with values ranging from 0.25 to 4.0. This allows you to adjust the playback speed to match your content’s pacing. The engine handles speed adjustments.

What is the character limit per request?

Each request supports up to 4096 characters of input text. For longer texts, split them into parts of this size and join the resulting audio files. This approach ensures consistent quality and manageable processing times, even for extensive documents or long-form content.

How do I authenticate requests?

Include your API key in the Authorization header as: Authorization: Bearer tts-... . One active key per account is allowed. You can generate a new key at any time via your account page, which immediately stops the old key from being used.

Can I use multiple API keys?

No, each account has only one active key at a time. You can issue a new key at any time, which immediately invalidates the previous one. This simplifies key management and ensures that only one key is active for your billing and usage tracking.

How do I check my balance?

Visit your account page at /get-api-key/ after signing in. The dashboard displays your current balance, trial status, characters left, and usage history. This real-time view helps you monitor spending and plan top-ups via USDT on the TRON network as needed.

What is the model name?

Use model values "tts-1" or "tts-1-hd". Both use the same engine and price. Both models use the same engine and price. The API handles the synthesis efficiently for both model identifiers.

How do I handle long texts?

Split texts into chunks of up to 4096 characters. Generate audio for each chunk separately, then join the audio files. This method ensures consistent quality and avoids exceeding character limits. The API processes requests sequentially, so queueing may occur under high load.

First request

curl

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

Create your account at /get-api-key/ to access the API. You can sign in instantly with Google for a free trial or register with an email and password.

Your API key is displayed immediately. You can generate a new key at any time, which invalidates the old one instantly.

Google Sign-In

Google Sign-In

Sign in with your Google account to start immediately. This method grants you a free trial of $0.50 (about 50,000 characters) valid for 7 days.

Email Registration

Email Registration

Register using a standard email and password. Accounts created this way do not receive the trial credit, but you can top up with USTRC-20 anytime.

Key Management

The dashboard shows your active key, balance, and usage stats. Issuing a new key stops the old one immediately, ensuring security if a key is compromised.

  • One active key per account
  • Invalidates old keys instantly
  • View real-time usage

First Request with Curl

Sound wave illustration for: First Request with Curl

Send a POST request to https://api.w567casino.com/v1/audio/speech with a JSON body containing your text and desired settings. The API returns a binary audio file directly in the response.

Basic JSON Body

Include the model (

tts-1

or

tts-1-hd

), input (text up to 4096 characters), voice (e.g.,

aria

), and response_format (

mp3

,

wav

). You may also specify speed between 0.25 and 4.0.

Authentication Header

Include your API key in the

Authorization

header as a bearer token:

Authorization: Bearer tts-your-key-here

. This key is issued upon account creation.

Response Format

A successful request returns the audio file directly with the appropriate

Content-Type

header (e.g.,

audio/mpeg

). Failed requests return a JSON error object but incur no charge.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

Since LingoSay mimics the OpenAI speech endpoint, you can reuse existing OpenAI SDKs with minimal changes. Simply update the base_url to point to our API endpoint and provide your LingoSay key. This approach keeps your integration lightweight and avoids learning a new client library.

Base URL Configuration

Set your SDK’s base URL to https://api.w567casino.com/v1. This directs all requests to our infrastructure while maintaining the standard request shape. You only need to swap the URL and use your tts-... bearer token for authentication.

SDK Compatibility

The official OpenAI SDKs work directly because we match their JSON request structure, provided you change the base_url. This means you can use familiar methods like client.audio.speech.create() without rewriting your core logic. It is a straightforward replacement for prototyping or production use.

Code Examples

Here is a Python snippet using the OpenAI SDK to generate speech. Replace YOUR_API_KEY with your key from the dashboard.

```python import openai client = openai.OpenAI(base_url="https://api.w567casino.com/v1", api_key="tts-...") speech_file = client.audio.speech.create( model="tts-1", voice="aria", input="The quick brown fox jumps over the lazy dog." ) speech_file.stream_to_file("output.mp3") ```

This example demonstrates a simple MP3 generation. You can adjust the voice and speed parameters to fit your application's tone.

Request Parameters

Sound wave illustration for: Request Parameters

Configure the synthesis engine and audio characteristics by selecting a model, voice preset, and playback speed. Each parameter directly influences the output quality, character cost, and listening experience for your application.

Model Selection

Choose between tts-1 for standard generation or tts-1-hd for higher fidelity audio. Both models use the same underlying engine and incur identical pricing, so select tts-1-hd only when superior audio quality is required.

Voice Presets

Select from eight distinct voice presets to match your content’s tone. Options range from warm narrators like Aria to neutral news readers like Atlas. Each voice supports all 23 supported languages, though you should explicitly set the language parameter for non-English Latin script text to ensure accurate pronunciation.

  • Aria: Warm, clear narrator
  • Felix: Energetic, promo
  • Atlas: Neutral, news

Speed Control

Adjust playback speed between 0.25x and 4.0x to fit your pacing needs. Lower speeds improve clarity for complex text, while higher speeds reduce latency for brief notifications. The character count remains unchanged regardless of speed, so your billing cost is consistent.

Supported Audio Formats

Sound wave illustration for: Supported Audio Formats

LingoSay supports a wide range of audio formats to suit different deployment needs. You can choose from MP3, WAV, Opus, FLAC, or raw PCM. Each format offers a different balance of file size, quality, and compatibility.

MP3 and WAV

MP3 is the standard for web players and mobile apps due to its small size and universal support. WAV provides uncompressed, high-quality audio ideal for local playback or further editing.

Opus and FLAC

Opus offers excellent compression. FLAC provides lossless compression.

PCM Raw Audio

PCM returns raw linear pulse-code modulation data. This format is best for systems that handle their own audio encoding or for direct hardware integration.

Supported Audio Formats

Language Handling

Sound wave illustration for: Language Handling

LingoSay supports 23 languages, but the API handles language selection intelligently. By default, it detects the script of your input text to choose the appropriate voice, ensuring smooth integration without extra configuration for simple use cases.

Automatic Detection

The system identifies the script of your input text to determine the language. For example, Cyrillic text triggers a Russian voice, while Kanji input selects a Japanese voice automatically, provided the language is not explicitly set.

Explicit Language Codes

You can enforce a specific language using the language parameter with an ISO code. This is essential when the text’s script is ambiguous or when you want to force a specific language despite the script.

  • Use language: 'en' to force English for Latin script.
  • Set language: 'zh' to ensure Chinese output for mixed scripts.

Latin Script Default

If the input uses Latin characters and no language is specified, the API defaults to English. To generate non-English audio from Latin text (e.g., French or German), you must explicitly set the language field.

Rate Limits and Errors

Sound wave illustration for: Rate Limits and Errors

Your API key allows 60 requests per minute, ensuring steady throughput for your applications. If you are testing or prototyping, note that new accounts start with a lower limit of 10 requests per minute until the first top-up is processed.

60 Requests Per Minute

This limit applies per key, not per IP or account. You can monitor your usage directly from the dashboard, where real-time counters show your current consumption rate. Maintaining a consistent flow helps avoid hitting the cap during bulk generation tasks.

  • Standard limit: 60 requests/minute per key
  • New account limit: 10 requests/minute until first top-up
  • Limit resets every 60 seconds

Handling 429 Errors

When you exceed the rate limit, the API returns a 429 Too Many Requests status code. The response body includes details about when your quota will reset. It is crucial to handle this error gracefully in your application logic to prevent service interruptions.

  • Status code: 429
  • Response includes retry-after timestamp
  • No additional charges for failed requests

Retry Logic

Implement exponential backoff for retries. Start with a short delay and increase it progressively if the limit is still active. This approach prevents overwhelming the API while waiting for the quota to refresh, ensuring reliable audio generation even under heavy load.

  • Use exponential backoff
  • Check Retry-After header
  • Log failed requests for debugging

Troubleshooting

Sound wave illustration for: Troubleshooting

Even with correct credentials, requests can fail due to input constraints or server load. Understanding these common issues helps you integrate smoothly without unnecessary downtime.

Invalid API Key

Ensure your key starts with tts-. If you issued a new key previously, the old one stopped immediately, so verify you are using the latest one from your dashboard.

Character Limit Exceeded

Each request supports up to 4096 characters. If your text is longer, split it into parts of up to 4096 characters and join the resulting audio files.

Audio Generation Failures

If synthesis fails, you receive a full refund for that request. Check your balance after retries to confirm the credit was returned automatically.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. We offer eight distinct voice presets, from warm narrators to energetic promos, all based on licensed recordings.

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. curl documentation
  3. FFmpeg documentation
  4. Creative Commons Attribution 4.0
  5. ISO 639 language codes
  6. TRON developer hub: TRC-20
  7. Python documentation
  8. Node.js documentation
  9. LibriTTS-R corpus (OpenSLR 141)
  10. LibriVox public-domain audiobooks
  11. openai-python on GitHub
  12. W3C WAI: making audio and video accessible

More on this site