API Documentation: Quickstart and Integration Guide

By NGO TTS Audit editorial team · Updated 2026-11-18

This guide covers the essential integration steps for indie developers building audio features for NGOs and public services. You will find the precise endpoint structure, parameter definitions, and SDK examples needed to generate synthetic speech from text inputs. We focus on verifiable facts—such as character limits, supported languages, and licensing transparency—so you can evaluate cost-per-character and technical constraints without marketing noise.

The documentation assumes you are using the OpenAI SDK or standard HTTP requests. We explain how to configure your base URL, manage API keys, and handle rate limits specific to our infrastructure. Whether you are generating long-form narration or short public service announcements, these sections provide the concrete technical details required for reliable, high-volume audio generation in production environments.

API Documentation: Quickstart and Integration Guide

Frequently asked questions

What is the endpoint URL for the API?

Send POST requests to https://api.mykad99apk.com/v1/audio/speech. The request body follows the same JSON shape as the OpenAI speech endpoint, allowing you to use standard HTTP clients or existing SDKs by adjusting the base URL configuration to point to this specific domain.

Do I need to use the OpenAI SDK?

No, you do not need the OpenAI SDK. You can use any HTTP client or the official OpenAI SDK by changing the base_url to https://api.mykad99apk.com/v1. The request structure is identical, so you can reuse existing code with minimal configuration changes.

How do I handle rate limit errors?

The limit is 60 requests per minute per key (10 before the first top-up). If you exceed this, implement exponential backoff in your application logic. Since requests are processed sequentially, queuing delays may also occur under load, so monitor your response times closely.

Can I change the voice mid-request?

No, each request generates audio for a single voice preset. To change voices, you must send separate requests for each segment. You can then join the resulting audio files programmatically. Supported voices include aria, nova, luna, sage, felix, milo, atlas, and orion.

What happens if the input text is too long?

The maximum input length is 4096 characters per request. You must split longer texts into parts of up to 4096 characters, send each part separately, and then join the resulting audio files. This ensures compliance with the API’s processing limits.

Is the API compatible with JavaScript?

Yes, it is fully compatible. Since the API uses standard HTTP POST requests with JSON bodies, you can use any JavaScript fetch library or the OpenAI JS SDK by setting the correct base URL. No proprietary JavaScript libraries are required for integration.

How do I specify a language code?

Include the optional language field in your JSON body with the ISO code. If omitted, the system guesses the language, defaulting to English for Latin script. For non-English Latin text, explicitly setting the language code ensures accurate synthesis results.

Can I use FLAC for high-quality storage?

Yes, FLAC is a supported response format alongside mp3, wav, opus, and pcm. Set the response_format field to flac in your request body. This allows you to store high-quality, lossless audio files directly from the API response without additional conversion.

Do I need to install additional libraries?

No additional libraries are required. You can use standard HTTP clients or the official OpenAI SDKs. Since we do not provide a proprietary SDK, you rely on existing tools to handle the JSON requests and audio response parsing efficiently.

How is the API key authenticated?

Authentication uses the Authorization: Bearer tts-... header. You must include your unique API key in every request. One active key is issued per account, and you can issue a new key at any time, which immediately invalidates the previous one.

What is the maximum text length per request?

The maximum input length is 4096 characters per request. If your text exceeds this limit, you must split it into smaller chunks. Each chunk is processed independently, and you must combine the resulting audio files to create the final output.

Can I stream audio as it generates?

No, the API does not support streaming or WebSocket connections. You receive the complete audio file in the response. Short phrases may take a few seconds, while longer texts take roughly real-time duration to process.

How do I get the audio file in the response?

The API returns the audio file directly in the response body. You can save this binary data to a file or process it further. The format matches your response_format setting, such as mp3, wav, opus, flac, or pcm.

Is there a limit on concurrent requests?

Requests are processed one after another, so under load, a request may wait in a queue. Requests are processed one after another, so under load a request may wait in a queue. Monitor your queue times during peak usage.

First request

curl

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

Sound wave illustration for: Authentication and Keys

Authentication is handled via a single active Bearer token per account. You generate your key on the /get-api-key/ page after signing in with Google or email. This key authorizes all requests to the API base URL.

Generating your API key

Generating your API key

Visit the /get-api-key/ page to create your key. Accounts signed up with Google receive a $0.50 trial credit valid for 7 days. Email-based accounts start without trial credit but have full access to the API.

Bearer token format

Bearer token format

Include your key in the HTTP header as Authorization: Bearer tts-.... This format is compatible with standard OpenAI SDKs when you adjust the base_url to https://api.mykad99apk.com/v1.

  • Start with Bearer followed by your key string.
  • Only one key is active per account at any time.

Revoking and issuing new keys

Issue a new key at any time via your dashboard. The previous key stops working immediately upon generation of the new one. This ensures secure rotation without downtime if you suspect exposure.

Base Endpoint Structure

Sound wave illustration for: Base Endpoint Structure

The API accepts text-to-speech synthesis requests via a single POST endpoint. This structure mirrors the OpenAI speech endpoint, allowing developers to use familiar SDKs with minimal configuration changes. Requests are processed sequentially, meaning high-volume users may experience brief queue delays during peak usage.

Each request converts up to 4096 characters of input text into audio. The system handles the synthesis engine internally, returning the generated audio file directly in the response body. This simplicity reduces integration overhead for indie developers building audio features for public services or NGO applications.

POST request to /v1/audio/speech

Send your JSON payload to the speech endpoint. The endpoint processes the text according to the specified model and voice parameters. Successful requests return the audio file directly in the response body, while failures return standard HTTP error codes.

The endpoint supports standard HTTP methods and headers. Ensure your client handles binary responses correctly when downloading the audio file. The API does not store the generated audio after the response is delivered.

  • Endpoint: POST https://api.mykad99apk.com/v1/audio/speech
  • Method: POST
  • Content-Type: application/json

JSON body parameters

The request body must include the model, input, and voice fields. The model field accepts either tts-1 or tts-1-hd, which use the same engine and pricing. The input field contains your text string, limited to 4096 characters. Spaces and punctuation count toward this limit.

Optional fields allow fine-tuning of the output. You can specify the response_format for compatibility with different web players or archives. The speed parameter adjusts playback rate between 0.25 and 4.0. The language field is optional but recommended for non-English Latin-script text to ensure correct pronunciation.

Base URL configuration

Configure your SDK or HTTP client to point to the base URL: https://api.mykad99apk.com/v1. This allows you to use standard OpenAI SDKs by simply overriding the base URL while keeping the same method names and request shapes.

Authentication is handled via the Authorization header. Include your API key in the format Bearer tts-<your-key>. Ensure your key is active and has sufficient balance before sending requests. Failed requests do not consume your character allowance.

  • Base URL: https://api.mykad99apk.com/v1
  • Auth Header: Bearer tts-<key>
  • SDK Compatibility: OpenAI Python/Node.js

Required Parameters

Sound wave illustration for: Required Parameters

The API requires three core fields in every request: model, input, and voice. These define the synthesis engine, the text content, and the speaker persona. All three must be present for a successful audio generation.

Accurate configuration ensures predictable costs and output quality. The model determines audio fidelity, the input text must adhere to strict character limits, and the voice preset selects from eight licensed options optimized for specific use cases.

Model selection (tts-1 vs tts-1-hd)

Both tts-1 and tts-1-hd use the same underlying engine and incur identical pricing. Both tts-1 and tts-1-hd use the same engine and price; the page does not specify a fidelity difference between them. Choose based on your quality requirements rather than cost.

Since pricing is identical, you can switch between models without affecting your character count or budget. This allows flexible A/B testing for NGO or public service content without financial penalty.

  • Both models cost $0.01 per 1,000 characters.
  • Identical pricing regardless of model selection.
  • Use tts-1-hd for high-fidelity needs.

Input text length limits

Each request accepts a maximum of 4,096 characters. Spaces and punctuation count toward this limit. For longer texts, split your content into chunks and join the resulting audio files sequentially. Short phrases may take a few seconds to generate, while longer texts process at roughly real-time speed.

Ensure your input text is within bounds to avoid silent failures. If your content exceeds 4,096 characters, handle the splitting logic in your application before sending individual requests to the API.

  • Maximum 4,096 characters per request.
  • Spaces and punctuation count as characters.
  • Split longer texts manually for joining.

Voice preset selection

Select one of eight voice presets from the voice parameter. Options include female voices like aria, nova, luna, and sage, or male voices like felix, milo, atlas, and orion. Every generated file carries an inaudible watermark that marks it as synthetic speech.

The voice choice affects the tone of the generated audio but does not change the language capability. All eight voices can speak all 23 supported languages. Use the /v1/voices endpoint to review available voices and their descriptions before implementation.

  • 8 presets available: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, Orion.
  • All voices support all 23 languages.
  • Based on licensed LibriTTS-R recordings.

Optional Parameters

Sound wave illustration for: Optional Parameters

The API accepts optional fields to refine audio output. You can adjust playback speed, specify language codes, or select the desired audio container format. These parameters allow you to optimize the generated speech for your specific application context without altering the core synthesis engine.

Speed adjustment (0.25–4.0)

Set the speed value between 0.25 and 4.0 to alter the voice rate. Values greater than 1.0 speed up the narration, while lower values slow it down. This is useful for matching specific pacing requirements in educational or instructional content.

Language code specification

While the system guesses language from the script (defaulting Latin text to English), you can explicitly set the language field using an ISO code. This ensures accurate pronunciation for non-English Latin script text, such as Dutch or Swedish, preventing misinterpretation.

Response format choices

Choose between mp3, wav, opus, flac, or pcm for the response_format. MP3 and Opus offer efficient compression for web delivery, while WAV and FLAC provide uncompressed quality for archival purposes. PCM returns raw audio data.

  • MP3: Standard for web playback
  • WAV/FLAC: Lossless for archival
  • OPUS: High efficiency for low-bandwidth scenarios
  • PCM: Raw linear audio

Audio Formats Supported

Sound wave illustration for: Audio Formats Supported

The API supports five audio formats: MP3, WAV, OPUS, FLAC, and PCM. These options allow you to balance file size, quality, and compatibility depending on your deployment environment. Each format is generated directly from the same underlying synthesis engine, ensuring consistent audio fidelity regardless of your selection.

MP3, WAV, OPUS, FLAC, PCM

MP3 offers compressed audio suitable for general web use. WAV and FLAC provide lossless quality for archival or high-fidelity needs. PCM delivers raw uncompressed data, while OPUS provides efficient compression ideal for low-bandwidth scenarios.

Choosing format for web vs. archive

For public-facing NGO websites, MP3 or OPUS reduces bandwidth costs and loads faster on mobile devices. Use WAV or FLAC when storing long-form audio for legal records or high-quality archival purposes where bit-perfect accuracy is required.

File size implications

Compressed formats like MP3 and OPUS significantly reduce storage and transfer costs for high-volume text-to-speech applications. Uncompressed formats like WAV and PCM result in larger files but preserve every detail of the synthesized speech without lossy compression artifacts.

Audio Formats Supported

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

Rate limits are enforced per API key to ensure fair usage. Each key allows 60 requests per minute. This limit applies regardless of text length or voice selected. If you exceed the limit, requests are rejected until the window resets.

New accounts start with a lower limit of 10 requests per minute until the first top-up is processed. This helps manage initial load while the account establishes a payment history. Once credited, the standard 60 requests per minute limit applies immediately.

60 requests per minute per key

The standard rate limit is 60 requests per minute per active API key. This limit is consistent across all models and voices. Exceeding this limit results in a 429 Too Many Requests error. Requests are processed sequentially, so high-volume jobs may experience queuing delays during peak times.

  • Limit resets every 60 seconds.
  • Applies per key, not per IP.
  • Queuing occurs under heavy load.

Initial limit for new accounts

New accounts begin with a 10 requests per minute limit. This applies until the first top-up is completed. The limit increases to 60 requests per minute automatically after the first payment is processed and credited to your balance.

  • Starts at 10 requests/minute.
  • Increases to 60 after first top-up.
  • No manual upgrade required.

Handling queue delays

Requests are processed in order. If the queue is full, new requests may wait. Short phrases take a few seconds to generate. Longer texts may take longer due to processing time. Monitor your API response times to adjust your client-side retry logic accordingly.

If a request fails, it is free. Failed requests do not consume your character allowance. Ensure your client handles 429 errors with exponential backoff to avoid overwhelming the server.

  • Requests are queued sequentially.
  • Use exponential backoff for retries.
  • Failed requests do not consume credit.

Error Handling

Sound wave illustration for: Error Handling

The API returns standard HTTP status codes to indicate request success or failure. A 200 OK response confirms audio generation, while 400-level errors typically indicate malformed requests or invalid parameters. Use these codes to structure your retry logic and monitor integration health.

Common HTTP error codes

Return 401 Unauthorized if the Bearer token is missing or invalid. A 429 Too Many Requests error appears when you exceed the 60 requests-per-minute limit. Check your dashboard to confirm if a new key was issued, as the old one stops immediately.

  • 400 Bad Request: Invalid JSON or missing fields.
  • 401 Unauthorized: Invalid or expired API key.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500 Internal Server Error: Temporary processing failure.

Refunds for failed synthesis

If synthesis fails due to a server-side error, the charge is returned in full to your balance. You do not need to manually request a refund for failed requests. Failed requests consume no characters from your quota, ensuring you only pay for successfully generated audio.

Debugging input text issues

Ensure your input text does not exceed 4096 characters per request. If the text contains unsupported characters or exceeds the limit, the API will return a 400 error. Split long texts into smaller chunks and join the resulting audio files to ensure consistent delivery.

SDK Integration Example

Sound wave illustration for: SDK Integration Example

Integrate the API by reusing the official OpenAI SDKs. The only requirement is redirecting the client’s base URL to our endpoint, allowing you to call the standard speech method without rewriting your logic.

This approach lets indie developers maintain familiar code structures while leveraging our high-volume TTS capabilities for NGO and public service audio projects.

Using the OpenAI SDK

The official SDKs work directly with our service. You simply point the client to our base URL and use the standard audio.speech method. No custom client library is required.

Setting base_url correctly

Configure your SDK client to use https://api.mykad99apk.com/v1 as the base URL. Ensure your authentication header uses a valid tts-... bearer token issued from your account dashboard.

Code snippet for Python/Node.js

```python import openai client = openai.OpenAI( base_url="https://api.mykad99apk.com/v1", api_key="tts-your-api-key-here" ) with client.audio.speech..create( model="tts-1", voice="nova", input="Hello, this is a test for public services." ) as response: response.write_to_file("output.mp3") ```

```javascript import OpenAI from 'openai'; const openai = new OpenAI({ baseURL: 'https://api.mykad99apk.com/v1', apiKey: 'tts-your-api-key-here' }); const response = await openai.audio.speech.create({ model: 'tts-1', voice: 'nova', input: 'Hello, this is a test for public services.', }); const buffer = Buffer.from(await response.arrayBuffer()); ```

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. We evaluate text-to-speech APIs for NGO projects based on three core metrics: cost efficiency, language coverage, and technical integration ease.

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. LibriTTS-R paper (arXiv 2305.18802)
  4. W3C WAI: making audio and video accessible
  5. Creative Commons Attribution 4.0
  6. openai-node on GitHub
  7. OpenAI API reference: create speech
  8. LibriTTS-R corpus (OpenSLR 141)
  9. ISO 639 language codes
  10. curl documentation
  11. openai-python on GitHub
  12. FFmpeg documentation

More on this site