API Documentation: Quickstart & Integration

By Audibook editorial team · Updated 2026-11-18

This documentation provides the technical specifications for the Audibook TTS API, designed for publishers integrating synthetic voice generation into their audiobook production workflows. You will find endpoint definitions, parameter references, and code examples for generating audio from text using standard HTTP requests or the OpenAI SDK.

The guide covers authentication, rate limits, and supported audio formats. It details how to manage your API key, select from eight licensed voices, and handle responses for MP3, WAV, Opus, and FLAC outputs. Use this reference to implement character-based billing and scale audio content creation without infrastructure overhead.

API Documentation: Quickstart & Integration

Frequently asked questions

What is the base URL?

The API base URL is https://api.playtk66.com/v1. Configure your HTTP client or SDK to use this endpoint for all requests. This URL handles all standard operations including speech synthesis, voice listing, and model information.

Which SDKs are supported?

The API follows the same request shape as the OpenAI speech endpoint. You can use the official OpenAI SDKs by changing the base_url to https://api.playtk66.com/v1 and providing your site-specific API key. No proprietary SDK is required.

How do I split long texts?

Split your input text into parts of up to 4096 characters each. Send each part as a separate POST request to the speech endpoint. Join the resulting audio files in your application to create the final continuous audio output.

What is the character limit?

Each request supports a maximum of 4096 characters in the input field. Spaces and punctuation count toward this limit. For texts longer than 4096 characters, you must split the content and send multiple requests to generate the full audio.

Can I stream the audio?

No, the API does not support streaming, WebSocket, or real-time partial audio. The service is synchronous; you send a request and receive the complete audio file in the response. Requests are processed sequentially, so longer texts may experience queue delays.

Does the API support SSML?

No, the API does not support SSML (Speech Synthesis Markup Language). You provide plain text input. There are no phoneme dictionaries or custom pronunciation lexicons available. Adjust pacing and intonation by selecting different voice presets or adjusting the speed parameter.

How do I handle errors?

If synthesis fails, the charge is returned in full. Check the response status code for details on rate limits or invalid parameters. Failed requests incur no cost, ensuring you are only billed for successfully generated audio files.

What happens if I exceed rate limits?

The limit is 60 requests per minute per key (10 per minute before the first top-up). Exceeding this limit may result in request failures or queuing. Requests are processed sequentially, so under load, a request may wait in a queue before processing.

Is the API synchronous?

Yes, the API is synchronous. You send a POST request and wait for the complete audio file in the response. Requests are processed one after another, so under heavy load, a request may wait in a queue before synthesis begins.

Can I use multiple voices in one request?

No, each request accepts only one voice preset. To use different voices, you must send separate requests for each segment of text. You can switch voices between requests to create varied audio content within your application workflow.

How do I detect the voice ID?

Send a GET request to /v1/voices to retrieve the list of available voices. The response includes the eight presets: aria, nova, luna, sage, felix, milo, atlas, and orion. Use these IDs in the voice field of your speech requests.

Is the API RESTful?

Yes, the API is RESTful. It uses standard HTTP methods like POST for speech synthesis and GET for retrieving voices and models. It accepts JSON bodies and returns standard HTTP status codes, making it compatible with any HTTP client.

Do I need to install a specific library?

No, you do not need a specific library. You can use the official OpenAI SDK by changing the base_url, or use any standard HTTP client. The API uses standard JSON requests and returns audio files directly in the response.

How do I rotate my API key?

You can issue a new API key at any time from your account dashboard. When a new key is issued, the old one stops working immediately. This allows for seamless rotation without downtime, ensuring secure access to your account.

First request

curl

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

Sound wave illustration for: Authentication

Authentication is handled via a Bearer token sent in the Authorization header. Include your unique API key, which is issued upon account creation, in every request to the TTS endpoint.

Each account maintains one active key. If you generate a new key, the previous one becomes invalid immediately, ensuring tight control over access credentials without manual deactivation delays.

Bearer token format

Bearer token format

Pass your key in the header as Authorization: Bearer tts-.... This format ensures compatibility with standard HTTP clients and the OpenAI SDK.

The key identifies your account and tracks usage against your balance and rate limits.

  • Format: Authorization: Bearer tts-<your_key>
  • Include in every POST and GET request

Key rotation

Generate a new key at any time from your dashboard. The old key stops working immediately upon issuance of the new one.

This allows instant revocation if a key is compromised, without waiting for session timeouts.

Single active key

Only one key is active per account at any given time.

Use this to simplify integration; you do not need to manage multiple concurrent credentials for a single project.

Endpoint Reference

Sound wave illustration for: Endpoint Reference

The API exposes three core endpoints for generating audio, retrieving available voices, and listing model configurations. All endpoints use the same base URL structure with versioned paths, ensuring consistent routing for audiobook production workflows.

Each endpoint requires valid Bearer authentication. The speech endpoint handles synthesis, while the metadata endpoints provide static configuration data for integration planning without incurring usage charges.

POST /v1/audio/speech

Generates audio from text input. Accepts a JSON body with model, input, voice, format, and speed parameters. Returns the audio file directly in the response body.

Supports standard formats like MP3 and WAV. Text is limited to 4096 characters per request.

  • Endpoint: POST https://api.playtk66.com/v1/audio/speech
  • Returns audio binary data
  • Accepts JSON request body

GET /v1/voices

Returns a list of available voices, their associated languages, supported formats, and pricing details. Useful for pre-validating voice options before synthesis requests.

Each voice preset has distinct tonal characteristics suitable for different audiobook genres, from narrative to instructional content.

  • Endpoint: GET https://api.playtk66.com/v1/voices
  • Lists 8 voice presets
  • Includes language and format metadata

GET /v1/models

Returns available model identifiers (tts-1 and tts-1-hd). Both models use the same engine and pricing tier, allowing flexible selection based on quality preferences.

Use this endpoint to verify model availability and ensure compatibility with your integration setup.

  • Endpoint: GET https://api.playtk66.com/v1/models
  • Returns tts-1 and tts-1-hd
  • Same engine and price for both

Request Parameters

Sound wave illustration for: Request Parameters

The input field accepts UTF-8 text up to 4096 characters. Spaces and punctuation count toward the limit. For longer texts, split the content into chunks and join the resulting audio files sequentially. The API does not support streaming or partial audio responses.

Select a voice from the 8 available presets. Each voice handles all 23 supported languages. If the language parameter is omitted, the system guesses the language from the script; for non-English Latin text, explicitly set the language code to avoid incorrect synthesis.

Input text (max 4096 chars)

Pass your manuscript text in the input field. The limit is strict: 4096 characters per request. Longer audiobooks require client-side splitting. Failed requests do not consume character credits, ensuring you only pay for successfully generated audio.

The engine processes requests sequentially. Under load, synthesis may queue. Typical generation speed is roughly real-time (25 characters per second). Short phrases may take a few seconds to process.

  • Max 4096 characters per request
  • Spaces and punctuation count as characters
  • Client-side splitting required for longer texts
  • Failed requests return full credit

Voice selection

Choose from 8 distinct voice presets. All voices support all 23 languages. Select voice by name (e.g., aria, nova). You can also pass an optional language ISO code to guide synthesis if the script is ambiguous.

Voices are based on licensed recordings from LibriVox. Every generated file contains an inaudible watermark marking it as synthetic speech. No custom cloning or emotion tags are available.

  • 8 presets: aria, nova, luna, sage, felix, milo, atlas, orion
  • All voices speak all 23 supported languages
  • Set language for non-English Latin text
  • Inaudible watermark in all outputs

Response format

Specify the output format using response_format. Options include mp3, wav, opus, flac, and pcm. The API returns the audio file directly in the response body as binary data.

No SSML or phoneme dictionaries are supported. Speed can be adjusted between 0.25x and 4.0x. The model field accepts tts-1 or tts-1-hd, which use the same engine and price.

  • Supported formats: mp3, wav, opus, flac, pcm
  • Returns binary audio in response body
  • Speed adjustable from 0.25 to 4.0
  • No SSML or custom pronunciation support

Code Example: cURL

Sound wave illustration for: Code Example: cURL

The cURL command provides the most direct way to verify your API key and retrieve audio. Send a POST request to the speech endpoint with your JSON payload, ensuring the input text does not exceed 4096 characters per request.

This method requires no external libraries, making it ideal for quick testing or scripting within audiobook production pipelines. You must include the authorization header and specify the desired voice, model, and output format.

Basic curl command

Use the following command to generate speech. Replace YOUR_API_KEY with your active key and input_text with your content.

```bash curl -X POST https://api.playtk66.com/v1/audio/speech \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "Hello world", "voice": "nova", "response_format": "mp3"}' \ --output audio.mp3 ```

Headers required

Two headers are mandatory for every request. The Authorization header must contain your Bearer token (Bearer tts-...). The Content-Type must be set to application/json to parse the body correctly.

Omitting either header results in a 400 Bad Request or 401 Unauthorized error. Ensure no trailing spaces exist within the token string.

Binary audio output

The API returns raw audio bytes in the specified format (mp3, wav, opus, flac, or pcm). Use the --output flag to save the binary data directly to a file.

If you omit --output, the audio data prints to stdout, which is useful for piping into other tools but may corrupt the file if not handled correctly by your shell.

Code Example: OpenAI SDK

Sound wave illustration for: Code Example: OpenAI SDK

The API mimics the OpenAI speech endpoint structure, allowing direct reuse of official SDKs. Developers simply adjust the base_url to point to https://api.playtk66.com/v1 and supply their Audibook key.

This approach eliminates custom HTTP client code. The same request shape used for OpenAI models applies here, enabling rapid integration into existing audiobook production pipelines.

Base URL modification

Set the SDK base URL to https://api.playtk66.com/v1. Replace the standard OpenAI host with this domain. Ensure your authorization header uses the tts-... prefix format.

Python client setup

Initialize the OpenAI client with the modified base URL. Pass your API key via the api_key argument. Use client.audio.speech.create() to generate audio files synchronously.

  • Install openai package
  • Set base_url explicitly
  • Use response_format="mp3" or "wav"

Node.js client setup

Configure the Node.js client with the same base URL. Invoke the audio speech method with your text, voice preset, and desired format. The SDK handles binary response parsing automatically.

  • Install openai npm package
  • Define baseURL in config
Code Example: OpenAI SDK

Error Handling

Sound wave illustration for: Error Handling

Errors follow standard HTTP conventions. The API returns JSON with an error code and a human-readable message describing the failure, allowing your application to react programmatically without parsing raw strings.

400 Bad Request

Returned when input text exceeds 4096 characters, the voice ID is invalid, or the request body is malformed. The response includes a clear message indicating the specific validation failure.

401 Unauthorized

Returned if the provided API key is missing, invalid, or revoked. Since only one key is active per account, ensure you are using the current key from your dashboard.

429 Rate Limit

Returned when you exceed 60 requests per minute (or 10 before top-up). The response includes a Retry-After header indicating when to resume. Requests are processed sequentially, so queueing may also cause delays.

Rate Limits

Sound wave illustration for: Rate Limits

Requests are processed sequentially, meaning concurrent calls may queue depending on server load. Each key allows 60 requests per minute under normal conditions, but this limit drops to 10 requests per minute for new accounts until the first top-up is processed.

60 requests per minute

Once your account is funded, you can make up to 60 API calls per minute. This throughput supports standard audiobook production workflows without requiring complex batching logic.

10 requests before top-up

New accounts start with a 10 requests-per-minute limit. This applies until your first USDT (TRC-20) top-up is confirmed. Balance does not expire, and limits adjust automatically upon credit receipt.

Queue behavior

Requests are processed one after another. If you exceed the per-minute limit, subsequent requests will wait in a queue rather than failing immediately. This ensures fair usage during peak production hours.

Rate Limits

Audio Formats

Sound wave illustration for: Audio Formats

The API supports four response formats to suit different audiobook production workflows. You can choose between compressed and uncompressed audio based on your storage and processing needs. All formats are generated at standard sample rates suitable for final distribution.

Selecting the right format ensures compatibility with your publishing pipeline. MP3 offers efficient storage, while WAV provides lossless quality for mastering. Opus and FLAC provide additional options for specific technical requirements.

MP3 encoding

MP3 is a common format, offering efficient compression for easy distribution. It is suitable for web delivery and standard audiobook files where file size matters.

Use MP3 for final delivery to platforms that require compressed audio. The encoding quality is consistent and suitable for most listening environments.

  • Default response format
  • Optimized for web delivery
  • Reduced file size

WAV uncompressed

WAV provides lossless, uncompressed audio, preserving the full fidelity of the generated speech. This format is suitable for mastering or archival purposes where quality is paramount.

Use WAV when you need the highest quality source file for further editing or processing in your audio production pipeline.

  • Lossless quality
  • Ideal for mastering
  • Larger file size

Opus and FLAC options

Opus provides high-quality compression, suitable for modern streaming applications. FLAC offers lossless compression, reducing file size while retaining full audio quality.

Choose Opus for efficient streaming and FLAC for high-quality archival. Both formats offer advantages over standard MP3 and WAV depending on your specific use case.

  • Opus: efficient compression
  • FLAC: lossless compression
  • Alternative to MP3/WAV

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Empower authors to share their stories and build lasting careers through direct reader engagement.

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. IETF RFC 7845: Ogg Opus
  3. Python documentation
  4. OpenAI API reference: create speech
  5. openai-python on GitHub
  6. Tether (USDT)
  7. TRON developer hub: TRC-20
  8. Node.js documentation
  9. LibriVox public-domain audiobooks
  10. FFmpeg documentation
  11. LibriTTS-R corpus (OpenSLR 141)
  12. W3C WAI: making audio and video accessible

More on this site