TTS API Documentation: Quickstart Guide with OpenAI SDK and Curl

By Indie TTS Lens editorial team · Updated 2026-11-19

This guide provides the technical details you need to integrate the Indie TTS Lens API into your news automation pipelines. You will find precise examples for authenticating with a Bearer token, configuring the OpenAI SDK base URL, and handling JSON responses. We cover the specific request shapes for the speech endpoint, including model selection, voice presets, and audio format options, so you can generate synthetic speech reliably without guessing the API structure.

Readers will learn how to manage rate limits, handle errors, and split long texts for consistent output. The documentation also explains key constraints like the 4096-character limit per request and the available voice parameters. This resource is designed for indie developers who need concrete metrics and clear integration steps to replace legacy services like Amazon Polly with a simpler, character-based pricing model.

TTS API Documentation: Quickstart Guide with OpenAI SDK and Curl

Frequently asked questions

How do I generate an API key?

Sign up on /get-api-key/ using Google or email plus password. The dashboard displays your single active Bearer key. You can issue a new key at any time; the old one stops immediately. Each account is tied to the specific site domain.

What is the correct base URL for the OpenAI SDK?

Set your SDK base_url to https://api.odin678.info/v1. This allows you to use the official OpenAI SDKs by pointing them to our endpoint. The request shape matches the standard speech endpoint, requiring only your API key in the Authorization header.

Can I use the official OpenAI JavaScript SDK?

Yes. Configure the OpenAI JavaScript SDK with base_url https://api.odin678.info/v1. Use the standard speech endpoint. Our API accepts the same JSON body structure, allowing seamless integration with existing OpenAI client code without requiring a custom library.

How do I handle rate limit errors?

The limit is 60 requests per minute per key (10 before first top-up). Requests process sequentially, so under load they queue. Implement exponential backoff in your client to retry after receiving a 429 status code.

What is the maximum text length per request?

The input field supports up to 4096 characters. Spaces and punctuation count toward this limit. For longer texts, split your content into chunks of 4096 characters or less and synthesize each part separately before joining the resulting audio files.

Does the API support SSML tags?

No, the API does not support SSML. It accepts plain text input only. There are no phoneme dictionaries or custom pronunciation lexicons available. You must manage pacing and emphasis by adjusting the speed parameter or splitting text into separate requests.

How do I specify a language for Latin script?

If the language field is omitted, the system guesses from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language parameter to the ISO code. Supported languages include English, French, German, Spanish, and others.

Is the audio returned as a file or stream?

The API returns the audio file directly in the response body. There is no streaming, WebSocket support, or real-time partial audio generation. You receive the complete audio file once synthesis finishes, supporting formats like mp3, wav, opus, flac, and pcm.

Can I change my API key immediately?

Yes, you can issue a new key at any time via the dashboard. The previous key stops working immediately upon issuance. This allows instant revocation if needed. Each account maintains only one active key at any given time.

What happens if the server is overloaded?

Requests are processed sequentially. Under load, a request may wait in a queue before synthesis begins. This can increase latency, especially for longer texts. Failed requests are free.

Are there SDKs for Python or Go?

There is no official proprietary SDK. However, you can use the official OpenAI SDKs for Python, Go, or other languages by changing the base_url to https://api.odin678.info/v1. Plain HTTP requests also work perfectly for any programming language.

How do I detect the voice language?

You must specify the language in the request body using an ISO code. If omitted, Latin script defaults to English. Use the /v1/voices endpoint to check supported languages.

Is the tts-1-hd model faster than tts-1?

No, both models use the same engine and price. Generation speed is roughly real-time, averaging 25 characters per second. Processing time depends on text length and queue status, not the model version. Both models support all eight voice presets.

How do I split long texts for synthesis?

Split your text into parts of up to 4096 characters. Send each part as a separate POST request to the speech endpoint. Collect the resulting audio files from each response and join them programmatically to create the final long-form audio file.

First request

curl

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

Python (openai)

from openai import OpenAI

client = OpenAI(base_url="https://api.odin678.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.odin678.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
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 setup

Sound wave illustration for: Authentication setup

Authentication is required for all API requests. You obtain a single active key via the /get-api-key/ page, supporting both Google sign-in and email/password registration. The key authenticates your account for character billing and rate limiting.

Include the key in the HTTP header as a Bearer token. This token is the sole credential needed for every request to the API base URL.

Get your API key

Get your API key

Navigate to the /get-api-key/ page on this site to create your account. Upon signing in, you will receive a unique API key starting with tts-. This key is tied to your specific account balance and usage limits.

If you sign in with Google, you receive a $0.50 trial credit valid for 7 days. Email-based accounts start with zero balance. You can top up using USDT (TRC-20) on the TRON network to activate the key.

  • Keys are issued on the /get-api-key/ page.
  • Google sign-in includes $0.50 trial credit.
  • Email sign-in starts with zero balance.

Bearer token format

Bearer token format

Include your key in the Authorization header of every request. The format is standard: Authorization: Bearer tts-your-api-key-here. Do not include quotes or additional parameters in the header value.

This token is used for all endpoints, including /v1/audio/speech, /v1/voices, and /v1/models. Ensure the key is passed exactly as generated, preserving case and characters.

  • Header: Authorization: Bearer tts-...
  • No additional parameters in the header value.
  • Used across all API endpoints.

Key rotation policy

You may issue a new key at any time via the /get-api-key/ page. When a new key is generated, the previous key becomes invalid immediately. There is no grace period.

This allows instant revocation if a key is compromised. Ensure your integration handles the sudden invalidation of the old key by updating the stored token promptly.

  • New key invalidates old key immediately.
  • No grace period for old keys.
  • Update stored tokens promptly.

First request with curl

Sound wave illustration for: First request with curl

Send a POST request to the speech endpoint with your API key in the Authorization header. The body must be valid JSON containing the text to synthesize and the target model.

Basic JSON payload

The request body includes model, input, and voice. Ensure the text does not exceed 4096 characters. The API returns the audio file directly in the response body.

Required fields

You must provide model (e.g., "tts-1"), input (the text string), and voice (one of the eight presets). The response_format defaults to mp3 if omitted.

  • model: "tts-1" or "tts-1-hd"
  • input: string, max 4096 chars
  • voice: e.g., "nova", "atlas"
  • response_format: mp3, wav, opus, flac, pcm

Response handling

A successful response returns HTTP 200 with the audio binary data. Failed requests incur no charge. The API returns a JSON error object with details on the failure.

OpenAI SDK integration

Sound wave illustration for: OpenAI SDK integration

Integrate the TTS API using the official OpenAI SDK by overriding the base URL. Point your client to https://api.odin678.info/v1 while keeping the standard tts-1 or tts-1-hd model identifiers. This allows you to use existing SDK logic without rewriting request structures, leveraging the same JSON body format as the OpenAI speech endpoint.

Base URL configuration

Set the base_url environment variable or client configuration to https://api.odin678.info/v1. This ensures all requests route through our endpoint while maintaining compatibility with standard OpenAI SDK methods. You do not need a custom library; the standard HTTP client handles the connection.

  • Use https://api.odin678.info/v1 as the base URL.
  • Standard OpenAI SDK versions are fully compatible.
  • No custom wrapper libraries required.

Client initialization

Initialize the client with your API key in the Authorization header. The key format is tts-.... Pass this key during initialization to authenticate all subsequent speech synthesis requests. Ensure you rotate keys if needed, as the old key stops immediately upon issuing a new one.

  • Key format: Bearer tts-...
  • One active key per account.
  • Immediate invalidation on rotation.

Request parameters

Pass model, input, voice, and response_format in the JSON body. The input text is limited to 4096 characters. Use the speed parameter (0.25–4.0) to adjust playback rate. The SDK handles the audio file return directly, allowing you to save the binary response to disk or stream it to your application.

  • Model: tts-1 or tts-1-hd.
  • Input limit: 4096 characters.
  • Speed range: 0.25 to 4.0.

Voice and model selection

Sound wave illustration for: Voice and model selection

Choose between the standard tts-1 engine or tts-1-hd for higher fidelity; both use the same underlying model and pricing structure. Select from eight distinct voice presets, ranging from the warm narrator aria to the deep documentary tone of orion.

tts-1 vs tts-1-hd

Both models use the same engine and price. The tts-1-hd designation indicates high-definition processing but incurs no additional cost compared to tts-1. Use either based on your preference, as the engine behavior remains consistent.

Available voice presets

We provide eight voice options: aria, nova, luna, sage, felix, milo, atlas, and orion. Each voice is licensed from LibriTTS-R or LibriVox. All voices support all 23 listed languages natively.

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

Language detection

If you omit the language field, the API guesses the language from the text script. Latin text defaults to English. For non-English Latin script, explicitly set the language ISO code to ensure accurate synthesis.

Audio format options

Sound wave illustration for: Audio format options

Choose the output format that fits your pipeline. MP3 provides a small, universally compatible file, while WAV delivers uncompressed audio for maximum quality.

MP3 and WAV output

MP3 is the default choice for web playback and general storage. WAV returns uncompressed audio.

Opus and FLAC support

Opus offers superior compression for low-bandwidth environments, maintaining clarity at lower bitrates. FLAC provides lossless compression, reducing file size without sacrificing any audio fidelity, perfect for archival or high-fidelity news clips.

PCM raw data

Select pcm for raw 16-bit signed integer samples. This format excludes container headers, delivering a continuous stream of audio bytes suitable for real-time processing or custom audio engines.

Audio format options

Rate limits and throttling

Sound wave illustration for: Rate limits and throttling

Each API key supports a maximum of 60 requests per minute. This limit applies globally to your key, so concurrent requests from multiple threads count toward the same quota. Exceeding this limit results in a 429 Too Many Requests error until the window resets.

60 requests per minute

The standard rate limit is 60 requests per minute per key. This allows for steady generation of audio files without overwhelming the service. Ensure your application respects the Retry-After header if you receive a 429 status code.

Initial 10 req/min limit

New accounts without a top-up start with a lower limit of 10 requests per minute. This reduced capacity helps manage initial load. Once you add funds via USDT (TRC-20), the limit automatically increases to the standard 60 req/min.

Queue behavior

Requests are processed sequentially. Under heavy load, your request may wait in a queue before synthesis begins. Long texts take longer to generate, potentially occupying the queue slot for several seconds. Short phrases complete faster but still consume the per-minute allowance.

Error handling

Sound wave illustration for: Error handling

When the API rejects a request, it returns standard HTTP status codes to indicate the specific cause. Common errors include 400 Bad Request for malformed JSON or invalid voice IDs, 401 Unauthorized if the Bearer token is missing or invalid, and 429 Too Many Requests when you exceed the 60 requests per minute limit. Check the response body for a detailed error message to debug your payload or rate limit settings immediately.

Retry logic

Implement exponential backoff for transient errors like 500 Internal Server Error or 503 Service Unavailable. Since requests are processed sequentially, high load may cause slight delays, so avoid aggressive immediate retries. Wait briefly before retrying to allow the queue to clear and prevent additional rate limit penalties.

  • Wait 1-2 seconds before first retry
  • Double wait time for each subsequent attempt
  • Stop after 3-4 attempts to avoid API abuse

Billing credits

Failed requests do not consume your balance. If synthesis fails, the charge is returned in full.

Advanced usage patterns

Sound wave illustration for: Advanced usage patterns

Efficiently handle long-form content by splitting input text into chunks of up to 4096 characters. Concatenate the resulting audio files server-side or client-side to reconstruct the full narration without exceeding API limits.

Adjust playback speed between 0.25x and 4.0x to match specific pacing needs for news updates or tutorials. Faster speeds reduce processing time.

The API automatically detects language from the script, defaulting to English for Latin text. Explicitly set the language parameter for non-English Latin scripts or select from supported languages like Arabic, Chinese, or Swahili to ensure accurate pronunciation.

Long text splitting

Send input text in segments of up to 4096 characters. Retrieve each audio file and join them sequentially to form a complete long-form track. This approach ensures consistent quality and avoids truncation.

Each segment is processed independently. Under high load, requests may queue, but the total character count remains accurate for billing purposes.

  • Max 4096 characters per request
  • Join audio files client-side or server-side

Speed adjustment

Set the speed parameter (0.25–4.0) to control playback rate. This affects both listening experience and generation time.

Ideal for news briefings (1.5x–2.0x) or detailed instructions (0.8x–1.0x). Speed changes do not alter voice characteristics.

  • Range: 0.25 to 4.0
  • Affects generation duration

Multi-language support

Explicitly define the language ISO code for non-English Latin text to prevent incorrect English defaults. Supports 23 languages including Hindi, Japanese, and Turkish.

Voices are multilingual; any voice can speak any supported language. The system guesses language from script if the field is omitted.

Note: Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, and Bengali are not supported.

  • 23 supported languages
  • Explicit language setting recommended for Latin scripts

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. The guide includes ready-to-use curl examples for immediate integration testing.

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. openai-node on GitHub
  3. Node.js documentation
  4. openai-python on GitHub
  5. W3C WAI: making audio and video accessible
  6. MDN: Web Speech API
  7. LibriTTS-R paper (arXiv 2305.18802)
  8. Creative Commons Attribution 4.0
  9. OpenAI API reference: create speech
  10. Python documentation
  11. Tether (USDT)
  12. curl documentation

More on this site