Frequently asked questions
How do I get an API key?
Sign up on /get-api-key/ using Google or email plus password. Accounts are per site. The dashboard displays your active key, balance, and usage statistics. You can issue a new key at any time, which immediately invalidates the previous one.
What is the endpoint URL?
Send POST requests to https://api.ufau4thai.com/v1/audio/speech. Include a JSON body with the text, voice, and model. Use the Authorization header with your Bearer key. The endpoint accepts standard TTS parameters and returns the generated audio file directly.
Can I use the OpenAI SDK?
Yes, the official OpenAI SDKs work by changing the base_url to https://api.ufau4thai.com/v1. Use your site-specific key. The request shape matches the OpenAI speech endpoint exactly. This allows seamless integration without rewriting your client code logic.
How do I configure the base URL?
Set the base URL to https://api.ufau4thai.com/v1 in your SDK configuration. This directs requests to our API infrastructure. Ensure you replace the default OpenAI domain with this specific endpoint to route your TTS synthesis requests correctly to our servers.
What models are available?
Two models are available: tts-1 and tts-1-hd. Both use the same engine and pricing. Select the model that best fits your quality needs. The API accepts either identifier interchangeably for synthesis requests, providing consistent audio generation capabilities across both options.
What is the input character limit?
Each request accepts up to 4096 characters of text. For longer content, split your input into multiple requests and join the resulting audio files. Spaces and punctuation count toward the character limit. This ensures efficient processing and predictable billing for your usage.
How do I set the voice?
Specify one of eight preset voices in the voice field. Options include female voices like aria and nova, or male voices like atlas and orion, as well as felix, luna, and sage. Each voice has a distinct tone. You can also optionally set the language to ensure correct pronunciation.
Can I adjust the speed?
Yes, set the speed parameter between 0.25 and 4.0. This allows you to slow down or speed up the narration. The default speed is typically suitable for most use cases. Adjusting speed helps tailor the audio to your specific content pacing needs.
What response formats are supported?
The API supports mp3, wav, opus, flac, and pcm formats. Choose the format that best suits your application requirements. MP3 is efficient for web delivery, while WAV or FLAC offers higher quality. PCM is useful for raw audio processing workflows.
What is the rate limit?
You are limited to 60 requests per minute per key. New accounts start with 10 requests per minute until the first top-up. Requests are processed sequentially, so high load may cause queuing. Monitor your usage via the dashboard to stay within limits.
How are errors handled?
Failed requests return standard HTTP error codes. If synthesis fails, the charge is returned in full. Check the response body for details on the error. Common issues include invalid voice names or exceeding character limits. Ensure your input text is valid before sending.
Do I get refunded on errors?
Yes, if synthesis fails, the charge is returned in full. You are only billed for successful audio generation. This ensures you pay only for usable output. Failed requests do not consume your character balance, protecting your credits from wasted attempts.
How do I renew my API key?
Issue a new key from your account dashboard at any time. The new key becomes active immediately. The old key stops working at once. This allows you to rotate keys for security without downtime. Manage your keys directly through the user interface.
Is the API documentation complete?
The documentation covers the core speech synthesis endpoint, voices, and models. It details the request shape and authentication. However, it does not include streaming, SSML, or custom voice cloning features. Refer to the product facts for a full list of supported capabilities and limitations.
First request
curl
curl https://api.ufau4thai.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.mp3Python (openai)
from openai import OpenAI
client = OpenAI(base_url="https://api.ufau4thai.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.ufau4thai.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 | |
|---|---|
aria | female |
nova | female |
luna | female |
sage | female |
felix | male |
milo | male |
atlas | male |
orion | male |
| language | |
|---|---|
ar | العربية |
zh | 中文 |
da | Dansk |
nl | Nederlands |
en | English |
fi | Suomi |
fr | Français |
de | Deutsch |
el | Ελληνικά |
he | עברית |
hi | हिन्दी |
it | Italiano |
ja | 日本語 |
ko | 한국어 |
ms | Bahasa Melayu |
no | Norsk |
pl | Polski |
pt | Português |
ru | Русский |
es | Español |
sw | Kiswahili |
sv | Svenska |
tr | Türkçe |
Authentication
Access the Cloud TTS API using a Bearer token in the Authorization header. Each account holds one active key; send Authorization: Bearer tts-... with every request. This standard format works with the official OpenAI SDK by adjusting the base URL.
Your key is visible on the /get-api-key/ dashboard alongside your balance and usage statistics. Keep this credential secure, as it grants immediate access to your account's character credits and generation capabilities.
Bearer Token Header
Include Authorization: Bearer tts-... in your request headers. This single token authenticates all calls to the speech endpoint, ensuring your usage is correctly billed to your account balance. The dashboard displays your current key, remaining balance, and character consumption.
API Key Management
The dashboard displays your current key, remaining balance, and character consumption. Since each account has only one active key, managing this single credential is sufficient for all integration needs.
Key Regeneration
You can issue a new key at any time from the dashboard. The old key stops working immediately, while the new one becomes active instantly, allowing seamless rotation without service interruption.
This feature is useful if you suspect a key has been exposed or if you are distributing access to different development environments.
Endpoint Overview
The API exposes three core endpoints for managing text-to-speech synthesis. Developers interact with the speech generation endpoint to convert text into audio, while the voices and models endpoints provide metadata about available options.
Speech Generation Endpoint
Send text to POST /v1/audio/speech to receive an audio file. The request body accepts parameters for model, input text, voice selection, speed, and output format. This endpoint handles the synthesis logic, processing up to 4096 characters per request.
Voices List Endpoint
Call GET /v1/voices to retrieve a list of available voice presets, supported languages, and output formats. This endpoint confirms the 8 voice options and 23 supported languages, helping developers select the right tone for their project without guessing.
- Lists 8 voice presets
- Shows 23 supported languages
- Displays available output formats
Models Endpoint
Use GET /v1/models to fetch the list of available models. Currently, this returns "tts-1" and "tts-1-hd", which share the same engine and pricing structure. This endpoint helps ensure your client code references valid model identifiers.
Request Parameters
The API supports two model variants, "tts-1" and "tts-1-hd", which share the same engine and pricing. You select the desired model in the request body to determine audio quality, with no performance difference in generation speed or cost between the two options.
Model Selection
Both "tts-1" and "tts-1-hd" utilize identical synthesis engines and are priced at $10 per million characters. The choice is purely aesthetic, allowing you to toggle between standard and high-definition output without altering your billing structure or request logic.
Input Text Length
Each request accepts up to 4,000 characters of text, including spaces and punctuation. For longer content, split the input into multiple requests and concatenate the resulting audio files. Generation typically proceeds at roughly real-time speed on long texts (about 25 characters per second); short phrases take a few seconds.
Voice and Speed Settings
Select from eight distinct voice presets, ranging from warm narrators to energetic promo voices. You can adjust the speaking speed between 0.25x and 4.0x to fit your content’s pacing. Optionally, specify an ISO language code to prevent misinterpretation of non-English Latin script text.
- Aria: Warm, clear narrator
- Felix: Energetic, promo
- Atlas: Neutral, news
- Nova: Bright, upbeat
- Luna: Soft, storytelling
- Sage: Calm, instructional
Response Formats
The API supports five standard audio formats, allowing you to choose the right balance between file size and quality for your specific workflow. Every generated file carries an inaudible watermark marking it as synthetic speech, regardless of the format selected.
MP3 Output
MP3 is the default and most widely compatible format, suitable for web playback and general distribution. It offers a good balance between audio fidelity and small file size, making it ideal for mobile apps or websites with bandwidth constraints.
WAV Output
WAV provides uncompressed, high-quality audio data. This format is preferred for professional editing workflows or when you need lossless audio for further processing in digital audio workstations without re-compression artifacts.
OPUS and FLAC Options
OPUS offers efficient compression for storage-heavy applications, while FLAC provides lossless compression for archival purposes without increasing file size as much as WAV. Choose these based on your specific storage or transmission needs.
Rate Limits
Understanding rate limits ensures your application generates audio smoothly without interruptions. The API enforces a limit of 60 requests per minute per key (10 per minute before the first top-up). This limit applies to all speech generation calls regardless of text length or voice model selected.
60 Requests Per Minute
After the first top-up, each API key is allowed 60 requests per minute. This steady throughput supports continuous text-to-speech workflows without requiring complex batching logic.
Initial Rate Limit
New accounts start with a lower limit of 10 requests per minute. This constraint applies until you complete your first top-up, ensuring system stability during the trial phase.
Queue Behavior
Requests are processed sequentially. If you exceed the limit or the system is under load, your request will wait in a queue rather than failing immediately. Longer texts take more time to generate, so plan your submission timing accordingly.
- Requests are processed one after another.
- Queued requests wait until the current synthesis completes.

Error Handling
Synthesis failures are refunded automatically, ensuring you only pay for successful audio generation. This policy applies to any request where the API returns an error status without completing the synthesis.
Understanding common error codes helps you troubleshoot quickly, whether you are dealing with rate limits or invalid parameters. Our system handles these gracefully so you can focus on integration.
Common Error Codes
You may encounter standard HTTP errors such as 400 Bad Request if the input exceeds 4096 characters or contains invalid JSON. A 401 Unauthorized error indicates an expired or incorrect API key, while 429 Too Many Requests signals that you have hit the 60 requests per minute limit.
Refund Policy
If a synthesis fails, the charge is returned in full to your balance. This ensures that you are not billed for audio that was not successfully generated. Failed requests do not consume your character balance.
Retry Logic
For transient errors, implement exponential backoff in your client. Since requests are processed sequentially under load, a brief pause between retries prevents overwhelming the queue. Avoid immediate retries for rate limit errors; wait until the next minute begins.
SDK Integration
Integrating Cloud TTS with existing tools is straightforward because the API mimics the OpenAI speech endpoint structure. You can use official OpenAI SDKs by simply updating the base URL, eliminating the need for a custom library or complex middleware.
This compatibility allows indie developers to switch services with confidence. The same request shape works across languages, so you can generate audio in Thai, English, or Arabic using standard code patterns without rewriting your integration logic.
OpenAI SDK Compatibility
The API accepts the same JSON body as OpenAI’s TTS endpoint. This means you can leverage existing SDKs for Python, JavaScript, or Go without learning a new interface. The official OpenAI SDKs work by changing the base_url. The model field accepts tts-1 or tts-1-hd, mapping directly to our engine.
You do not need a proprietary Cloud TTS SDK. The official OpenAI SDKs work out of the box when configured correctly. This reduces boilerplate code and simplifies maintenance for small teams or solo developers building educational apps.
- Uses standard OpenAI request JSON structure
- Supports
tts-1andtts-1-hdmodels - No custom client library required
- Works with Python, Node.js, Go, and Ruby SDKs
Base URL Configuration
To route requests to our infrastructure, update your SDK’s base_url property to https://api.ufau4thai.com/v1. This single change directs all calls to our speech generation endpoint while keeping your existing authentication and parameter logic intact.
Ensure your API key is passed via the Authorization: Bearer tts-... header. The SDK handles the header injection automatically if you set the environment variable or pass the key during client initialization, just as you would with OpenAI.
Python Library Example
Here is a minimal Python example using the OpenAI SDK. Replace YOUR_API_KEY with your key from /get-api-key/. The code sends text to our endpoint and saves the resulting audio file locally.
This snippet demonstrates the ease of integration. You can swap the base URL in your client configuration to test different endpoints or switch providers without changing the core generation logic. The response format is handled natively by the library.
cURL Example
The Cloud TTS API accepts standard HTTP requests, allowing immediate testing via command line. Sending a POST request to the speech endpoint generates audio files based on your specified model and voice parameters.
Basic Request Structure
Construct a JSON body containing the model, input text, and voice preset. The API processes up to 4096 characters per request, returning the audio file directly in the response body or as a downloadable file depending on your client setup.
- POST https://api.ufau4thai.com/v1/audio/speech
- JSON body with
model,input,voice - Supports
response_formatandspeedparameters
Audio File Retrieval
Upon successful synthesis, the API returns the audio file in the requested format (mp3, wav, opus, flac, or pcm). For longer texts, you must split the input into chunks under 4096 characters, generate each chunk, and join the resulting audio files sequentially.
- Formats: mp3, wav, opus, flac, pcm
- Max 4096 characters per request
- Join multiple files for longer texts
Header Configuration
Include your API key in the Authorization header using the Bearer scheme. Ensure the header is formatted as Authorization: Bearer tts-... to authenticate your request. Incorrect keys will result in a 401 Unauthorized error, preventing access to the synthesis engine.
- Header:
Authorization: Bearer tts-... - Key format:
tts-... - Required for all requests
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. Text is processed solely to generate the audio file and is never retained for model training or improvement.
23 languages
Any voice speaks any of these languages.
