API Documentation for Game Voice Line Generation

By NPC Audio Lab editorial team · Updated 2026-11-19

This documentation outlines the API workflow for generating consistent NPC voice lines, tailored for indie developers and audio designers. You will find precise specifications for integrating synthetic speech into your game engine, covering endpoint structures, parameter constraints, and supported audio formats. The guide assumes you are building a workflow that requires reliable, character-specific dialogue without the overhead of managing full voice casts.

We focus on the technical details you need to implement the solution, such as key rotation, rate limits, and error handling for game integration. All examples use standard tools like cURL and the OpenAI SDK, ensuring you can drop the integration into your existing pipeline. The tone is editorial and specific, avoiding marketing fluff in favor of concrete, actionable data for your development cycle.

API Documentation for Game Voice Line Generation

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.89999.info/v1. You send POST requests to /v1/audio/speech for speech generation. Other endpoints like /v1/voices and /v1/models are also available at this base URL for retrieving voice lists and model details.

How do I get my API key?

Sign up on the /get-api-key/ page using Google or an email and password. Your account key is displayed on that page. You can issue a new key at any time, which immediately invalidates the old one.

Which SDKs are compatible?

The API uses the same request shape as the OpenAI speech endpoint. Therefore, the official OpenAI SDKs work directly by changing the base_url to https://api.89999.info/v1 and using your site-specific key. No proprietary SDK is required.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Configure your OpenAI SDK client to use base_url https://api.89999.info/v1 and provide your NPC Audio Lab API key. This allows you to use standard OpenAI SDK methods for generation.

What is the maximum text length?

Each request supports up to 4096 characters of input text. For longer texts, you must split the content into parts of this size and join the resulting audio files. Spaces and punctuation count toward the character limit.

Which audio formats are available?

You can request audio in mp3, wav, opus, flac, or pcm formats. Specify your preferred format using the response_format field in your JSON request body. All formats are generated using the same engine models with identical pricing.

How do I adjust the voice speed?

Use the speed parameter in your request, which accepts values between 0.25 and 4.0. This allows you to slow down or speed up the narration. The default speed is typically 1.0, suitable for most NPC dialogue lines.

What are the rate limits?

Your API key allows 60 requests per minute. If you have not yet topped up your account, the limit is 10 requests per minute. These limits apply per key, so ensure you manage your concurrency accordingly.

How many requests can I make per minute?

You can make 60 requests per minute after topping up your account. Before the first top-up, the limit is 10 requests per minute. This applies to all requests sent with your active API key.

What happens if I exceed the rate limit?

Requests are processed sequentially, so exceeding limits may cause your request to wait in a queue. If the queue waits too long or the limit is strictly enforced, you may receive a rate limit error response from the API.

Is the API compatible with Unity?

Yes. Since the API uses standard HTTP POST requests with JSON bodies, it is fully compatible with Unity. You can use Unity’s UnityWebRequest or other HTTP libraries to send text and receive the audio file response.

Is the API compatible with Unreal Engine?

Yes. The API works via standard HTTP requests. You can use Unreal Engine’s HTTP modules or REST plugins to send your JSON payload to the endpoint and handle the returned audio data for integration into your game.

How do I handle errors?

Check the HTTP status code and response body for error details. Failed requests are free, meaning the charge is returned in full if synthesis fails. Ensure your input text is under 4096 characters and your key is valid.

Do failed requests count against my limit?

Yes, requests count toward your rate limit even if they fail. However, failed requests are free, so the character charge is returned in full. You still consume one of your 60 (or 10) requests per minute.

First request

curl

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

Sound wave illustration for: Authentication and Keys

Authentication for the NPC Audio Lab API relies on a single active bearer token per account. You generate this key on the /get-api-key/ dashboard page, where it is displayed alongside your current balance and usage statistics.

Get Your API Key

Get Your API Key

Sign up via Google or email on the registration page to receive your initial key. Google sign-ups include a $0.50 free trial valid for 7 days, while email accounts start with zero balance. Use this key in all API requests to authorize character voice line generation.

  • Keys are displayed on the dashboard immediately after creation.
  • One active key per account at any time.
  • Google sign-up includes $0.50 trial credit.

Bearer Token Format

Bearer Token Format

Include your key in the HTTP header as Authorization: Bearer tts-.... The string begins with tts- followed by your unique alphanumeric identifier. Ensure no extra spaces are included in the header value to avoid 401 Unauthorized errors during synthesis requests.

Key Rotation

You can issue a new key from the dashboard at any time. The previous key stops working immediately upon generation of the new one, ensuring seamless transition between development and production environments without manual invalidation steps.

Base URL Configuration

Sound wave illustration for: Base URL Configuration

The API base URL is https://api.89999.info/v1. All requests use the POST method to /v1/audio/speech. This endpoint accepts a JSON body containing your text, selected voice, and format preferences. The structure mirrors the OpenAI speech endpoint, allowing you to swap the base URL in existing OpenAI SDK configurations without changing your code logic.

You can generate audio by sending text input directly to this endpoint. The system processes your request and returns an audio file. For developers using the OpenAI SDK, simply set the base_url parameter to https://api.89999.info/v1. This ensures compatibility with standard libraries while using our specific TTS engine.

Endpoint Structure

All audio generation requests are sent via POST to https://api.89999.info/v1/audio/speech. The request body must be a JSON object containing the model, input text, voice, and optional parameters like speed or language. The response returns the generated audio file in the requested format.

OpenAI SDK Compatibility

The API follows the same request shape as the OpenAI speech endpoint. This means you can use the official OpenAI SDKs by changing the base_url to https://api.89999.info/v1. You will still use the standard parameters like model, input, and voice. This allows for easy integration into existing game audio pipelines without rewriting client code.

Request Path

The primary path is /v1/audio/speech. Other endpoints include GET /v1/voices for listing available voices and GET /v1/models for model details. Ensure your API key is included in the Authorization header as a Bearer token for all requests to these paths.

Required Parameters

Sound wave illustration for: Required Parameters

Every synthesis request requires a model identifier, input text, and a voice preset. The model field accepts either "tts-1" or "tts-1-hd", both using the same engine and pricing tier. This simplifies integration for game developers who need consistent audio quality across different NPC dialogue lines without managing complex versioning.

Model Selection

The model parameter determines the synthesis engine. Both "tts-1" and "tts-1-hd" deliver identical audio quality and cost $0.01 per 1,000 characters. Developers can switch between them without altering other parameters, though the underlying processing remains the same.

Input Text Limit

The input field accepts plain text strings up to 4096 characters. Spaces and punctuation count toward this limit. For longer NPC dialogues, split the text into chunks of 4096 characters or fewer and join the resulting audio files sequentially to maintain character voice consistency.

Voice Selection

The voice parameter selects from eight distinct presets tailored for game audio. Choose from female voices like aria, nova, luna, or sage, or male voices like felix, milo, atlas, or orion. Each voice offers a specific tonal range, from warm narrators to energetic promo styles, ensuring distinct audio identities for your cast.

  • aria: warm, clear narrator
  • nova: bright, upbeat
  • luna: soft, storytelling
  • sage: calm, instructional
  • felix: energetic, promo
  • milo: friendly, conversational
  • atlas: neutral, news
  • orion: deep, documentary

Optional Parameters

Sound wave illustration for: Optional Parameters

Optional parameters allow you to fine-tune the audio output without changing the core synthesis engine. Adjusting speed lets you match the pacing of NPC dialogue, while setting the language code ensures correct pronunciation for non-English lines. You can also choose the output format that best fits your game’s audio pipeline.

Speed Adjustment

The speed parameter accepts values between 0.25 and 4.0. This range allows you to slow down narration for atmospheric scenes or speed up dialogue for rapid-fire exchanges. Note that extreme speeds may slightly affect voice quality, so test within your specific game context.

Language Code

While the API guesses language from the script, explicitly setting the language parameter (e.g., ja for Japanese, de for German) guarantees accuracy. This is crucial for Latin-script text that isn’t English, preventing mispronunciation of names or idioms in your game’s lore.

  • Use ISO 639-1 codes (e.g., 'en', 'fr', 'ko')
  • Overrides automatic detection for better precision
  • Supports all 23 available languages

Response Format

Choose mp3, wav, opus, flac, or pcm via the response_format field. MP3 is efficient for large dialogue trees, while WAV or FLAC preserves higher fidelity for close-up character interactions. PCM provides raw audio for custom processing pipelines.

  • mp3: Best for storage efficiency
  • wav/flac: High quality for critical lines
  • pcm: Raw data for custom engines

Audio Formats Supported

Sound wave illustration for: Audio Formats Supported

Choosing the right audio format balances file size against playback quality in your game engine. MP3 offers efficient storage for large dialogue trees where bandwidth is limited. WAV provides high quality for critical lines that require clear audio fidelity without compression artifacts.

MP3 for Compression

MP3 is the standard for reducing file size while maintaining acceptable listening quality. Use this format for background NPC chatter or extensive dialogue trees where storage space is at a premium. It integrates seamlessly with most modern game engines.

WAV for Quality

WAV preserves higher fidelity, making it ideal for close-up interactions or main character lines where audio clarity is paramount. The uncompressed nature ensures no data loss during playback, though files will be larger than MP3 equivalents.

FLAC and PCM

FLAC offers lossless compression, providing high quality with smaller files than WAV. PCM provides raw audio data, suitable for custom processing pipelines or immediate playback without decoding overhead. Both formats ensure bit-perfect reproduction of the synthesized speech.

Audio Formats Supported

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

The API enforces a hard limit of 60 requests per minute per active key. This cap applies to all synthesis endpoints and is measured in rolling windows. Because requests are processed sequentially, high-volume generation for large dialogue trees may experience queueing delays during peak usage.

60 Requests Per Minute

Each API key allows a maximum throughput of 60 requests per minute. This limit is strict and applies uniformly across all models and formats. If you exceed this threshold, subsequent requests will receive a 429 Too Many Requests error until the window resets.

  • Limit is per key, not per account.
  • Applies to both tts-1 and tts-1-hd models.
  • Queued requests may incur slight latency under load.

Initial Limit

New accounts start with a reduced limit of 10 requests per minute. This lower threshold remains active until you perform your first top-up. It is designed to prevent abuse during the trial phase while allowing initial testing of voice quality and integration logic.

Limit Increase

To increase your rate limit, add funds to your account using USDT on the TRON network (TRC-20). Once the transfer is confirmed, your limit automatically increases to the full 60 requests per minute. Credits are applied within minutes, and the limit boost is immediate.

Error Handling

Sound wave illustration for: Error Handling

API errors are explicit and actionable. When a request fails, the response includes a specific error code and message, allowing you to handle failures gracefully in your game’s audio manager without crashing the voice line system.

Understanding these codes helps you distinguish between temporary network hiccups and configuration issues, ensuring your NPC dialogue triggers reliably during gameplay sessions.

Common Error Codes

The API returns standard HTTP status codes. A 400 indicates invalid parameters, such as an unsupported voice or text exceeding 4096 characters. A 401 signifies an expired or incorrect API key, while 429 means you’ve exceeded the rate limit of 60 requests per minute.

These codes help you debug integration issues quickly, whether you’re testing locally or running live in a multiplayer environment.

  • 400: Bad Request (invalid input)

Retry Logic

Implement exponential backoff for transient 5xx errors or 429 rate limits. Since requests are processed sequentially under load, brief pauses between retries prevent overwhelming the queue.

Avoid immediate aggressive retries, which can exacerbate latency for time-sensitive NPC lines during peak usage hours.

Failed Request Billing

If synthesis fails entirely, the charge is returned in full. You are only billed for successfully generated audio files.

This ensures you don’t pay for empty audio assets when network issues or invalid parameters cause a failure, keeping your per-character cost accurate.

Example Code Snippets

Sound wave illustration for: Example Code Snippets

The following examples demonstrate how to integrate NPC Audio Lab’s TTS API into your game’s audio pipeline. Each snippet targets a common developer workflow, ensuring you can generate voice lines for characters efficiently without managing complex infrastructure.

These code samples cover the basic request structure, highlighting the necessary parameters for model selection, voice choice, and output format. They serve as a starting point for integrating synthetic speech into your game engine or server-side logic.

cURL Request

Use cURL for quick testing or server-side scripts. Replace YOUR_API_KEY with your key from the dashboard and adjust the voice and text as needed.

This command sends a POST request to the speech endpoint, returning the audio file directly in the response body for immediate playback or storage.

OpenAI Python SDK

The OpenAI Python SDK works seamlessly by pointing to our base URL. Install the package via pip and configure the client to use https://api.89999.info/v1.

Pass your text, selected voice, and desired format to the audio.speech method. The SDK handles the request and returns the audio bytes, which you can save to a file or stream directly.

Node.js Example

For JavaScript environments, use the openai npm package with the same base URL configuration. Initialize the client with your API key and set the base URL accordingly.

Call the speech endpoint with your character’s dialogue text. The response contains the audio data, which you can write to disk or process further within your Node.js game server.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This ensures consistent voice delivery across extended conversations without hitting request limits.

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

More on this site