Frequently asked questions
How do I get an API key?
Sign up on /get-api-key/ using Google or email plus password. Your account key appears immediately on that page. You can issue a new key at any time, which stops the old one instantly. Accounts created with email start without trial credit, while Google sign-ins receive $0.50 valid for seven days.
What is the base URL for the API?
The API base URL is https://api.sonic4.info/v1. You send POST requests to https://api.sonic4.info/v1/audio/speech. Other endpoints like /v1/voices and /v1/models are also under this base URL. Use this base URL when configuring your HTTP client or SDK for all API interactions.
Can I use the OpenAI SDK with this API?
Yes, the official OpenAI SDKs work by changing the base_url to https://api.sonic4.info/v1 and using your site key. The request shape matches the OpenAI speech endpoint exactly. You can use standard libraries like the OpenAI Python or Node.js SDKs without modification other than the base URL configuration.
What are the rate limits?
You are limited to 60 requests per minute per key. Before your first top-up, this limit is 10 requests per minute. Requests are processed sequentially, so under load, a request may wait in a queue. Long texts are split into parts, counting as multiple requests toward your limit.
How do I handle errors?
If synthesis fails, the charge is returned in full. You should check the HTTP status code and response body for error details. Failed requests do not consume your character balance. Implement retry logic for transient network errors, but note that server-side failures refund your balance automatically.
What models are available?
Two models are available: tts-1 and tts-1-hd. Both use the same engine and price. You can select either in your request body. The /v1/models endpoint lists available models. Both models support all eight voices and all supported languages for generating high-quality audio files.
Which voices support Tagalog?
All eight voices support Tagalog. You can choose from female voices aria, nova, luna, sage, or male voices felix, milo, atlas, orion. Tagalog is not in the list of 23 supported languages (Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish). If you send Latin-script text without setting the language, it defaults to English.
What is the maximum text length?
The maximum input text length is 4096 characters per request. Spaces and punctuation count toward this limit. For longer texts, split your content into chunks of up to 4096 characters and join the resulting audio files. This ensures each request stays within the character constraint.
How do I specify the response format?
Include the response_format field in your JSON body. Supported formats are mp3, wav, opus, flac, and pcm. The API returns the audio file in the specified format. This field is optional, but specifying it ensures you receive the file type you need for your application.
Is there a speed parameter?
Yes, you can adjust the speed using the speed parameter. The valid range is 0.25 to 4.0. The default speed is 1.0. Adjusting speed helps tailor the audio to your specific use case, such as language learning exercises. This parameter applies to all voices and models.
How do I authenticate requests?
Include your API key in the Authorization header. Use the format: Authorization: Bearer tts-... Your key is issued when you sign up. Each account has one active key at a time. Ensure the key is sent with every request to authenticate your usage and billing.
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 for security without downtime. You cannot use multiple keys simultaneously for the same account; only the latest key is active.
What happens if a request fails?
If synthesis fails, the charge is returned in full. Failed requests do not deduct from your character balance. The API returns an error response indicating the failure reason. You can retry the request or adjust parameters like text length or voice selection based on the error details.
How do I track my usage?
The /get-api-key/ page displays your balance, characters left, and usage history. Request metadata, including time, characters, and status, is kept for billing. You can monitor your consumption directly from the dashboard. Usage is calculated based on characters sent, including spaces and punctuation.
First request
curl
curl https://api.sonic4.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.mp3Python (openai)
from openai import OpenAI
client = OpenAI(base_url="https://api.sonic4.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.sonic4.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 | |
|---|---|
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 |
Getting Your API Key
Access the dashboard at https://sonic4.info/get-api-key/ to sign up using Google or an email and password combination. Google sign-ins receive a $0.50 trial credit valid for seven days, while email accounts start without trial credit. This step creates your unique account on sonic4.info.
Once registered, the dashboard displays your active API key, current balance, and usage statistics. You can issue a new key at any time, which instantly invalidates the previous one. Use this key for all API requests to generate Tagalog voice-overs.
Sign Up on the Dashboard
Navigate to the get-api-key page and choose your preferred authentication method. Google sign-in provides immediate access with trial credit, while email registration requires no external account dependency. Both methods create a standalone account for this independent storefront.
- Google Sign-In: Instant access with $0.50 trial credit
- Email & Password: No external account required
- Account per site: sonic4.info specific
Locate Your API Key
The dashboard interface prominently displays your generated API key starting with 'tts-'. This key authenticates your requests to the API base URL. You can view your current balance and character usage directly alongside the key.
Use this key in the Authorization header for all API calls. If you suspect a leak, generate a new key immediately. The old key stops working at once upon new key issuance.
- Key format: tts-...
- Location: Dashboard header
- Revocation: Instant upon new key generation
Manage Key Security
Keep your API key confidential. Since each account has only one active key, losing it means you must generate a new one, which invalidates the old key instantly. Do not share your key in public repositories or client-side code.
Rate limits are tied to the key, not the user. Losing your key means losing your request quota history. Store it securely in environment variables for your indie development workflow.
- One active key per account
- Old key invalidates immediately
- Tied to rate limits
First Request: cURL Example
To generate Tagalog speech, send a POST request to https://api.sonic4.info/v1/audio/speech. You need a valid Bearer token and a supported model. This endpoint accepts plain text and returns the audio file directly.
Basic POST Request
Use cURL to test the endpoint immediately. Replace YOUR_API_KEY with your actual key from the dashboard. The request body must be valid JSON containing the text to speak and the desired voice preset.
- ```bash curl -X POST "https://api.sonic4.info/v1/audio/speech" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "voice": "nova", "input": "Kumusta ka?", "response_format": "mp3"}' ```
JSON Body Structure
The JSON body requires three fields: model, input, and voice. The model field accepts either tts-1 or tts-1-hd. The input field holds your text, up to 4096 characters. The voice field selects one of the eight presets.
- Example body for a clear Tagalog greeting:
- {
- "model": "tts-1",
- "voice": "nova",
- "input": "Magandang umaga sa iyo!",
- "response_format": "mp3"
- }
Response Format
A successful request returns the audio file directly in the response body. The format matches the response_format field you specified (e.g., mp3, wav, opus, flac, or pcm). Failed requests return an error JSON object with details about the issue.
OpenAI SDK Integration
Indie TTS Lab’s API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing TTS integration code with minimal changes. You only need to adjust the base URL and authentication header to point to our infrastructure.
Changing Base URL
Update your client’s base_url to https://api.sonic4.info/v1. This single change redirects all requests to our TTS engine while maintaining the standard request shape expected by OpenAI-compatible libraries.
Using Official SDKs
The official OpenAI SDKs work directly with our endpoint. Simply initialize the client with your new base URL and use the standard audio.speech.create method. No custom wrappers or middleware are required.
- Compatible with Python, Node.js, and other official SDKs
Authentication Header
Include your API key in the Authorization header using the format Bearer tts-<your-key>. Ensure you generate this key via the /get-api-key/ dashboard. The key authenticates your 60 requests per minute quota.
Request Parameters
The API accepts two model variants, tts-1 and tts-1-hd, which share the same engine and pricing. You select the desired voice preset from eight options, ensuring the output matches your project’s tone. The system automatically guesses the language from the script, but you should explicitly set the language field for non-English Latin text to ensure accuracy.
Choose your output format based on your workflow needs. MP3 is suitable for general use cases where storage and bandwidth matter. WAV or FLAC provides high-quality playback for language learning apps. PCM is best when you need to process raw audio samples directly. All formats support the same speed and voice parameters.
Model Selection (tts-1, tts-1-hd)
Both models use the same underlying engine and incur identical charges. The tts-1 model is standard, while tts-1-hd offers slightly higher fidelity. Since the price per character is the same, you can switch between them without affecting your budget. Both support the full range of voice presets and languages.
- tts-1: Standard generation
- tts-1-hd: Higher fidelity audio
- Same price: $0.01 per 1,000 characters
- Same speed limits and constraints
Voice Presets
Select from eight distinct voices tailored for different content types. Aria offers a warm, clear narrator style, while Nova provides a bright, upbeat tone. Sage is calm and instructional, and Atlas remains neutral for news-style delivery. Other options include Luna, Felix, Milo, and Orion, each designed for specific use cases in educational content.
- Aria: Warm, clear narrator
- Nova: Bright, upbeat
- Luna: Soft, storytelling
- Sage: Calm, instructional
- Felix: Energetic, promo
- Milo: Friendly, conversational
- Atlas: Neutral, news-like
- Orion: Deep, documentary
Response Format Options
Choose the format that best fits your application’s requirements. MP3 is suitable for general use cases where storage and bandwidth matter. WAV or FLAC provides high-quality playback for language learning apps. PCM is best when you need to process raw audio samples directly. All formats support the same speed and voice parameters.
- mp3: General use
- wav: High-quality playback
- flac: High-quality playback
- opus: Efficient compression
- pcm: Raw audio data
Rate Limits and Quotas
Rate limits protect API stability during peak usage. Each API key is allowed 60 requests per minute once your account is funded. This limit applies to all synthesis jobs, regardless of voice or format choice.
60 Requests Per Minute
After your initial top-up, you can send up to 60 requests in a single minute. If you exceed this threshold, subsequent requests will receive a 429 Too Many Requests error until the window resets.
10 Requests Before Top-Up
New accounts without a USDT top-up are limited to 10 requests per minute. This lower cap helps manage server load before you commit to paying for additional credits.
Handling Rate Limits
Implement exponential backoff in your application logic. When you receive a 429 error, wait briefly before retrying. For generating longer texts, split your input into chunks of 4096 characters and submit them sequentially to avoid hitting limits too quickly.
- Use exponential backoff for retries.
- Split long texts into 4096-character chunks.
- Submit chunks sequentially to manage load.

Error Handling
When synthesis fails, the API returns a non-200 HTTP status code. The response body contains a JSON object with an error message and code, ensuring you can programmatically identify issues without manual inspection.
Common HTTP Errors
Errors typically stem from invalid keys, rate limits, or malformed JSON. Each error includes a specific code (e.g., rate_limit_exceeded) to guide your response logic.
- 401 Unauthorized: Invalid or expired API key.
- 429 Too Many Requests: Exceeded 60 requests per minute.
- 400 Bad Request: Invalid input or missing fields.
Retry Logic
Implement exponential backoff for transient errors like rate limits. Do not retry immediately; wait briefly before the next attempt to avoid overwhelming the queue.
- Wait 1–2 seconds before retrying.
- Double wait time on consecutive failures.
- Stop after 3–5 attempts to prevent infinite loops.
Debugging Failed Requests
Check the error code and message in the response body. Ensure your text input is under 4096 characters and your API key is correctly formatted with the Bearer prefix.
Audio Format Options
The API supports five distinct audio formats: MP3, WAV, Opus, FLAC, and PCM. Each serves different integration needs, from web delivery to raw data processing. Opus delivers efficient compression for web use, while WAV and FLAC offer lossless quality for archival purposes. PCM provides uncompressed raw audio for immediate processing.
MP3, WAV, Opus, FLAC, PCM
Select your preferred format in the response_format field. MP3 is widely compatible. WAV and FLAC preserve full audio fidelity. PCM outputs raw 16-bit samples. Opus balances file size and quality effectively for modern web applications.
Choosing the Right Format
Choose MP3 or Opus for language learning apps to minimize bandwidth usage. Use WAV or FLAC if you need precise audio analysis or editing later. Select PCM if your downstream system requires raw byte streams without decoding overhead.
- MP3: Best for general web playback
- Opus: Efficient for streaming and web use
- WAV/FLAC: Ideal for high-fidelity storage
- PCM: Suitable for raw data processing
Quality vs. Size Trade-offs
Lossless formats like WAV and FLAC produce larger files but retain every audio detail. Compressed formats like MP3 and Opus reduce file size significantly with minimal perceptible quality loss. For educational content, the difference is often negligible, making compressed formats more efficient for distribution.
Testing and Validation
Before integrating the API into your language learning app, verify that the voice generation matches your content requirements. Use the provided sample texts to test clarity, pronunciation accuracy, and natural flow for Tagalog and other supported languages. This ensures the audio output aligns with your educational goals before scaling up usage.
Once you generate audio, listen to the output to confirm tone and pacing. Adjust the speed parameter if the narration feels too fast or slow for learners. Remember that short phrases may take a few seconds to process, so plan your app’s loading states accordingly to avoid user frustration during synthesis delays.
Using Sample Text
Start with short, standard phrases to verify basic functionality. The API handles up to 4,096 characters per request, allowing you to test longer educational sentences in a single call.
- Try simple greetings like 'Kumusta ka?' to check baseline quality.
- Test complex sentences with multiple clauses to assess natural flow.
- Use the 50,000-character free trial to experiment without cost.
Checking Audio Output
Download the generated audio file and play it through your standard speakers or headphones. Listen for clarity in Tagalog phonemes and ensure the voice preset matches your intended tone.
- Verify the inaudible watermark is present if required by your terms.
- Check that the audio format matches your app’s requirements (e.g., MP3 for web, WAV for editing).
- Ensure no distortion occurs at the start or end of the clip.
Validating Character Count
Since pricing is based on character count, accurately estimate your usage. Spaces and punctuation count as characters, so include them in your calculations. This helps you budget effectively and avoid unexpected charges.
- Count all characters, including spaces and punctuation.
- Split texts longer than 4,096 characters into multiple requests.
- Monitor your balance in the dashboard to track remaining credits.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. Simply set the language parameter to 'tl' and select your preferred voice, but note that Tagalog is not supported.
23 languages
Any voice speaks any of these languages.
Sources and further reading
- Wikipedia
- openai-python on GitHub
- LibriTTS-R paper (arXiv 2305.18802)
- FFmpeg documentation
- W3C WAI: making audio and video accessible
- Python documentation
- OpenAI API reference: create speech
- LibriTTS-R corpus (OpenSLR 141)
- ISO 639 language codes
- Tether (USDT)
- MDN: Web Speech API
- Creative Commons Attribution 4.0
