API Documentation for Audiobook Generation

By Audiobook Wire editorial team · Updated 2026-11-18

This documentation details the API for Audiobook Wire, a text-to-speech service designed for indie authors and audiobook producers. You will find precise specifications for converting manuscripts into audio files, including endpoint structures, required parameters, and response formats. The guide covers authentication, rate limits, and error handling to ensure reliable integration into your production workflow.

The API follows the OpenAI speech endpoint structure, allowing you to use official OpenAI SDKs by simply adjusting the base URL. We provide concrete examples for generating speech with eight distinct voices, handling long texts via character splitting, and managing credentials. This page serves as the complete reference for developers building efficient, license-safe audio narration pipelines.

API Documentation for Audiobook Generation

Frequently asked questions

Which SDKs are compatible with this API?

The API uses the same request shape as the OpenAI speech endpoint. You can use the official OpenAI SDKs by changing the base_url to https://api.8kbdcasino.com/v1 and providing your site-specific key. Alternatively, you can use any standard HTTP client library to send POST requests with the required JSON body.

What is the maximum text length per request?

Each request supports a maximum of 4096 characters in the input field. For longer manuscripts, split the text into parts of up to 4096 characters and join the resulting audio files. This ensures efficient processing while maintaining compatibility with the API's character-based billing model.

How do I specify the language in the request?

Include the optional language field with an ISO code in your JSON body. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language parameter to ensure accurate synthesis.

Can I stream the audio as it generates?

No. The API returns the complete audio file in the response body. There is no streaming, WebSocket, or real-time partial audio support. You receive the full file once synthesis is complete, which typically takes roughly real-time duration for long texts.

What happens if I exceed the rate limit?

You are limited to 60 requests per minute per key (10 per minute before the first top-up). If you exceed this, requests may queue or fail. Process requests sequentially or manage concurrency to stay within the 60 requests per minute limit for your active key.

Is there a JSON response or only binary audio?

The primary response is binary audio data in the format you requested (mp3, wav, opus, flac, or pcm). Metadata like usage is not returned in the audio stream. You rely on HTTP status codes and headers to confirm success or identify errors in the request.

How do I handle 403 Forbidden errors?

A 403 error indicates an authentication issue. Ensure your Authorization header contains a valid Bearer tts-... key. If you issued a new key, the old one stops immediately. Verify your key is active and correctly formatted in the request header.

Can I use the API in a background job?

Yes. Since the API returns the full audio file upon completion, it is ideal for background jobs. You can send the request, wait for the response, and store the audio file. Just ensure you handle rate limits and potential queueing delays in your job scheduler.

What is the difference between tts-1 and tts-1-hd?

Both models use the same engine and price. The only difference is the model identifier in your request. Choose tts-1 or tts-1-hd based on your preference, but note that the cost remains $10 per 1 million characters regardless of which model you select.

Do I need to install any specific libraries?

No specific proprietary libraries are required. You can use the official OpenAI SDKs by adjusting the base URL, or any standard HTTP client. No mobile SDKs or WordPress plugins are provided. Use whatever HTTP library your programming language supports for sending JSON requests.

How is the API key rotated?

You can issue a new key at any time from your account page. When a new key is generated, the old one stops working immediately. This allows for instant rotation without downtime. You only have one active key per account at any given time.

Can I use the same key for multiple projects?

Yes. Each account has one active key that can be used across multiple projects or services. The rate limit of 60 requests per minute applies to the key itself, so ensure your combined usage across all projects does not exceed this limit.

What audio format is recommended for audiobooks?

You can choose from mp3, wav, opus, flac, or pcm. MP3 and Opus are efficient for distribution, while WAV and FLAC offer lossless quality. PCM is raw audio. Select the format that best fits your production pipeline and distribution requirements.

How do I detect errors in the response?

Check the HTTP status code. A 200 OK indicates success with binary audio in the body. Non-200 codes indicate errors. Failed synthesis requests are free, and the charge is returned in full. Use standard HTTP client error handling to manage these responses.

First request

curl

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

Access the API by creating an account via Google or email on the /get-api-key/ page. Each account receives one active key visible in the dashboard. You can issue a new key at any time; the previous one stops immediately.

Use the key in the HTTP header as a Bearer token. This standard authentication method works with official OpenAI SDKs by adjusting the base URL to the API endpoint.

API Key Generation

API Key Generation

Create an account using Google or email/password on the /get-api-key/ page. The dashboard displays your single active key, balance, and usage stats. You may generate a new key instantly, which invalidates the old one immediately.

  • One active key per account
  • Instant invalidation of old keys
  • Visible in the /get-api-key/ dashboard

Bearer Token Usage

Bearer Token Usage

Include your key in the Authorization header: Authorization: Bearer tts-.... This format ensures compatibility with standard HTTP clients and OpenAI SDKs. The key authenticates your requests for speech generation and voice listing.

Requests fail without a valid key or if the key was replaced. Ensure your key is active before sending payloads.

Endpoints

Sound wave illustration for: Endpoints

The Audiobook Wire API provides two core endpoints for generating narration and managing voice assets. The primary endpoint handles text-to-speech conversion, while the secondary endpoint allows you to list available voices, languages, and formats before generating audio.

Speech Generation POST

Send a POST request to /v1/audio/speech with a JSON body containing the model, input text, voice, and response_format. The API accepts texts up to 4096 characters per request. For longer manuscripts, split the text into chunks and join the resulting audio files sequentially.

Voices Listing GET

Use GET /v1/voices to retrieve the current list of eight voice presets, supported languages, and available audio formats. This endpoint helps you select the appropriate voice (e.g., 'aria' for warm narration or 'atlas' for neutral news) before initiating synthesis.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts raw text strings as the primary input for synthesis. Each request supports a maximum of 4,096 characters, including spaces and punctuation. For longer manuscripts, split your text into chunks that respect this limit and concatenate the resulting audio files to assemble the final audiobook.

Input Text Limits

Input is limited to 4,096 characters per request. Exceeding this length will result in an error. Split longer texts into multiple requests and join the output files sequentially to create complete chapters or full books without losing context or audio continuity.

  • Maximum 4,096 characters per request
  • Spaces and punctuation count toward the limit
  • Split long texts and join audio files manually

Voice Selection

Select from eight preset voices, including female options like Aria and Nova, and male options like Felix and Atlas. Each voice offers a distinct tone, from warm narration to energetic promo styles. You can optionally specify a language code to ensure accurate pronunciation for non-English scripts.

  • Choose from 8 distinct voice presets
  • Optional ISO language code for precise control
  • Voices support all 23 available languages

Response Formats

Sound wave illustration for: Response Formats

The API returns synthesized audio in the format specified by the response_format parameter. By default, the system generates MP3 files, which offer an optimal balance of file size and quality for most audiobook distribution channels and web players.

MP3 Output

MP3 is the standard output for general use. It ensures compatibility with virtually all audiobook platforms and media players.

WAV and Lossless Options

For producers requiring lossless audio or uncompressed PCM data, select wav, flac, or pcm. WAV and FLAC provide lossless or uncompressed audio, ideal for master files before final mastering. PCM returns raw audio bytes. Note that lossless formats result in significantly larger file sizes compared to MP3, which may impact storage and transfer costs for large manuscripts.

  • WAV: Uncompressed, widely supported
  • FLAC: Lossless compression, smaller than WAV
  • PCM: Raw audio bytes, no header

Error Handling

Sound wave illustration for: Error Handling

Reliable narration requires handling predictable failures gracefully. When generating audiobooks, you may encounter rate limits or invalid input states that interrupt the pipeline. Understanding these responses ensures your manuscript conversion process remains robust without manual intervention.

Rate Limit Errors

You are limited to 60 requests per minute per key. If you exceed this, the API returns a 429 status code. Before your first top-up, the limit is stricter at 10 requests per minute. Failed synthesis does not incur a charge, so retrying a rejected request is safe.

Invalid Input Codes

Input text must not exceed 4096 characters per request. If the text is too long, split it into smaller parts and join the resulting audio files. Invalid voice names or unsupported response formats also return clear error codes. Ensure your language parameter matches the text script if auto-detection fails.

Error Handling

SDK Integration

Sound wave illustration for: SDK Integration

The API mirrors the OpenAI speech endpoint structure, allowing you to use the official OpenAI SDKs with minimal changes. This compatibility ensures that existing codebases can integrate Audiobook Wire’s narration engine without requiring a complete rewrite or learning a new client library.

You only need to adjust the base URL to point to our infrastructure and provide your specific API key. This approach leverages familiar SDK methods for generating audio files, making the transition seamless for developers already accustomed to standard TTS workflows.

OpenAI SDK Compatibility

The request shape matches the OpenAI speech endpoint exactly. This means you can use the same code structure to send text and receive audio files, ensuring consistent behavior across different platforms and programming languages supported by the official SDKs.

  • Compatible with official OpenAI SDKs
  • Identical JSON request body structure
  • Standard audio response formats (mp3, wav, opus, flac, pcm)

Base URL Configuration

Configure your SDK client to use https://api.8kbdcasino.com/v1 as the base URL. This directs all requests to our processing infrastructure while maintaining the standard endpoint path for speech generation.

Include your API key in the Authorization header as Bearer tts-.... The SDK handles the header injection automatically if configured correctly, ensuring secure and authenticated requests for each synthesis task.

  • Base URL: https://api.8kbdcasino.com/v1
  • Auth Header: Authorization: Bearer tts-...

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a strict limit of 60 requests per minute per active key. New accounts start with a lower threshold of 10 requests per minute until the first top-up is processed. This structure supports steady batch processing for audiobook chapters without requiring enterprise-grade infrastructure.

When demand exceeds capacity, requests are processed sequentially. Under heavy load, synthesis jobs may enter a queue, causing slight delays before generation begins. Failed requests do not consume character credits, ensuring accurate billing even during high-volume attempts.

Requests Per Minute

Your API key allows a maximum of 60 requests per minute. Before your first top-up, this limit is reduced to 10 requests per minute to prevent immediate resource exhaustion. This limit applies per key, so generating multiple voice samples concurrently is possible by using different keys if needed.

  • Standard limit: 60 requests/minute
  • Pre-top-up limit: 10 requests/minute
  • One active key per account

Queue Behavior

Requests are processed one after another in a sequential queue. If many requests are submitted simultaneously, earlier requests may wait in line before synthesis begins. This ensures consistent audio quality but means short phrases may take a few seconds longer during peak usage periods.

Because processing is linear, long texts split into multiple requests will generate sequentially. The total time depends on the queue depth at the moment of submission. Failed requests are removed from the queue immediately without charge.

  • Sequential processing order
  • No parallel synthesis per key
  • Failed requests do not queue
  • Queue depth varies by load

Curl Example

Sound wave illustration for: Curl Example

The API accepts standard JSON payloads to generate audio files instantly. Use the tts-1 or tts-1-hd model; both use the same engine and price.

Longer chapters often exceed the 4,096-character limit. Split your text into smaller chunks, generate each segment individually, and concatenate the resulting audio files to maintain continuous playback for full audiobook chapters.

Basic Request

Send a POST request to the speech endpoint with your text, selected voice, and preferred output format. The system returns a direct audio file response.

Ensure your API key is passed in the Authorization header to avoid billing errors during generation.

  • Use tts-1 or tts-1-hd for the model.
  • Set response_format to mp3, wav, opus, flac, or pcm.
  • Specify voice like aria or atlas for narration styles.
  • Keep input under 4,096 characters per request.

Long Text Splitting

Divide manuscripts into segments of 4,096 characters or fewer. Generate each part separately to stay within limits.

Process requests sequentially to manage queue behavior, as requests are handled one after another during high load.

  • Split text at natural paragraph breaks.
  • Join audio files after generation.
  • Monitor rate limits (60 req/min).
  • Check balance before bulk processing.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Transform your written stories into immersive audio experiences that captivate listeners and grow your loyal audience.

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. LibriTTS-R corpus (OpenSLR 141)
  4. Node.js documentation
  5. ISO 639 language codes
  6. Python documentation
  7. FFmpeg documentation
  8. TRON developer hub: TRC-20
  9. Tether (USDT)
  10. IETF RFC 7845: Ogg Opus
  11. LibriTTS-R paper (arXiv 2305.18802)
  12. W3C WAI: making audio and video accessible

More on this site