Frequently asked questions
How do I get an API key?
Sign up on /get-api-key/ using Google or email plus password. Accounts are per site. The page displays your active key, balance, and usage stats. You can issue a new key at any time, which immediately invalidates the old one. Each account has one active key at a time.
Is the API compatible with OpenAI SDKs?
Yes. The endpoint shape matches the OpenAI speech endpoint. You can use official OpenAI SDKs by changing the base_url to https://api.ab777game.com/v1 and providing your site-specific key. This allows you to integrate quickly without learning a new library structure.
What is the maximum text length per request?
Each request supports up to 4096 characters of input text. For longer scripts, split your text into parts of this size and join the resulting audio files. This ensures consistent processing and avoids exceeding the single-request limit while maintaining audio continuity.
Which audio formats are supported?
You can choose from mp3, wav, opus, flac, or pcm. Select the format that best fits your game engine’s requirements. All formats are generated via the same POST endpoint. The choice affects file size and compatibility but not the synthesis quality or price.
How do I handle rate limits?
Your key allows 60 requests per minute. Before your first top-up, the limit is 10 requests per minute. If you exceed this, requests may queue or fail. Monitor your usage on the dashboard. For bulk NPC lines, consider batching requests or spacing them out.
Can I change my API key?
Yes, you can issue a new key at any time from your account page. When you generate a new key, the previous one stops working immediately. This is useful if you suspect a leak or want to rotate credentials for different game builds.
What happens if a request fails?
Failed requests are free. If synthesis fails, the charge is returned in full. You do not lose characters from your balance. Check your dashboard for status details. This ensures you only pay for successfully generated audio files without risking budget on errors.
How do I specify a language?
Pass an optional ISO language code in the request body. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, always set the language parameter to ensure accurate pronunciation and voice selection.
Is there a WebSocket endpoint?
No. There is no WebSocket endpoint or streaming support. You send a POST request and receive the audio file in the response. This synchronous model is suitable for pre-generating NPC dialogue lines rather than real-time interaction during gameplay.
Can I use the API in Unity or Unreal?
Yes. Since the API uses standard HTTP POST requests, you can call it from any language or engine that supports HTTP. Use the OpenAI SDK or plain HTTP libraries. No official mobile or engine-specific SDK is offered, making integration straightforward for indie developers.
How do I calculate character count?
Count all characters, including spaces and punctuation. The price is $10 per 1 million characters, or $0.01 per 1,000 characters. Spaces are not excluded. Accurate counting helps you estimate costs for your game’s total dialogue volume before generating audio files.
What is the response format?
The response contains the generated audio file directly. The format matches your selected response_format parameter (mp3, wav, opus, flac, or pcm). You receive the binary audio data or a base64-encoded string depending on your client library. No additional JSON metadata is included in the audio stream.
Do I need to handle SSML?
No. The API does not support SSML, phoneme dictionaries, or custom pronunciation lexicons. You cannot add emotion tags or pause markers. Just pass plain text. The voices are designed to sound natural without requiring complex markup for standard dialogue scripts.
How fast are the responses?
Typical speed is roughly real time, about 25 characters per second of generation. Short phrases take a few seconds. Requests are processed sequentially, so under load, a request may wait in a queue. Plan your generation pipeline accordingly for large dialogue sets.
First request
curl
curl https://api.ab777game.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.mp3Python (openai)
from openai import OpenAI
client = OpenAI(base_url="https://api.ab777game.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.ab777game.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 | |
|---|---|
aria | female |
nova | female |
luna | female |
sage | female |
felix | male |
milo | male |
atlas | male |
orion | male |
| language | |
|---|---|
ar | العربية |
zh | 中文 |
da | Dansk |
nl | Nederlands |
en | English |
fi | Suomi |
fr | Français |
de | Deutsch |
el | Ελληνικά |
he | עברית |
hi | हिन्दी |
it | Italiano |
ja | 日本語 |
ko | 한국어 |
ms | Bahasa Melayu |
no | Norsk |
pl | Polski |
pt | Português |
ru | Русский |
es | Español |
sw | Kiswahili |
sv | Svenska |
tr | Türkçe |
Get Your API Key
Start by visiting the /get-api-key/ page on ab777game.com. You can sign up using your Google account or create a standard email and password account. This step creates your unique environment for generating NPC dialogue.
Once registered, your dashboard displays your active API key, current balance, and usage statistics. You will copy this key to use in your game’s audio system for instant speech synthesis.
Sign Up on the Site
Navigate to the sign-up page and choose your preferred method. Google sign-in grants a $0.50 free trial valid for 7 days, while email accounts start without trial credit. This allows you to test voice quality immediately without payment.
Copy Your Bearer Key
After logging in, locate your API key in the dashboard. It begins with "tts-". Copy this string exactly, as it authenticates your requests to the API. Keep it secure, as it provides access to your character count and billing.
One Active Key Per Account
Each account maintains only one active key at a time. If you need to rotate your key for security reasons, issuing a new one instantly invalidates the previous one. This ensures simple tracking of your API usage and costs.
Make Your First Request
Generate NPC dialogue by sending text to the speech endpoint. The API processes your input and returns synthesized audio files, allowing you to iterate on voice lines without hiring actors. This direct approach keeps your audio pipeline lightweight and cost-effective for indie projects.
You control the output by specifying the model, voice preset, and audio format. The system handles the synthesis, delivering a ready-to-use audio file that you can immediately integrate into your game engine.
POST /v1/audio/speech
Send a POST request to https://api.ab777game.com/v1/audio/speech. Include your text in the JSON body along with the desired voice and format. The endpoint returns the audio file directly in the response body.
Ensure your text does not exceed 4096 characters. If your dialogue script is longer, split it into chunks and join the resulting audio files later in your pipeline.
- Endpoint:
POST /v1/audio/speech - Auth:
Authorization: Bearer <your-key> - Input: JSON with
model,input,voice
JSON Body Format
The request body uses standard JSON fields. Specify model as tts-1 or tts-1-hd. Set voice to one of the eight presets like aria or atlas. Define response_format as mp3, wav, opus, flac, or pcm.
Optional fields include speed (0.25–4.0) and language (ISO code). If language is omitted, the system guesses it from the text script, defaulting to English for Latin scripts.
model: "tts-1" or "tts-1-hd"voice: e.g., "aria", "atlas"input: your text (max 4096 chars)response_format: mp3, wav, opus, flac, pcm
Curl Example Provided
Use this curl command to test the endpoint. Replace <your-key> with your Bearer token and your-text with the NPC dialogue.
This example uses the tts-1 model with the nova voice in MP3 format. Adjust the voice and response_format fields to match your game's audio requirements.
curl -X POST https://api.ab777game.com/v1/audio/speech \-H "Authorization: Bearer <your-key>" \-H "Content-Type: application/json" \- `-d '{"model": "tts-1", "voice": "nova", "input": "Hello adventurer!", "response_format": "mp3"}'`
OpenAI SDK Compatibility
Our API mirrors the OpenAI speech endpoint structure, allowing you to reuse existing codebases with minimal changes. This compatibility means indie developers can integrate high-quality NPC voice lines without rewriting their entire audio pipeline.
By simply adjusting the base URL, you can leverage official SDKs to handle requests, making it easy to drop SpriteVoice into your game's dialogue system.
Change base_url
Update your client configuration to point to https://api.ab777game.com/v1. This single change redirects all speech requests to our infrastructure while maintaining the standard JSON format.
You do not need to modify the request payload structure. The endpoint expects the same model, input, voice, and response_format fields as the OpenAI standard.
- Base URL:
https://api.ab777game.com/v1 - Endpoint:
/v1/audio/speech - Method:
POST
Use Official SDKs
Leverage the official OpenAI SDKs for Python, Node.js, and other languages. Pass your tts-... API key in the Authorization header as Bearer <key>.
This approach ensures consistent error handling and authentication flows, reducing the time spent debugging custom HTTP clients for your game's backend.
Easy Integration
Generate NPC dialogue directly from your script files using familiar SDK methods. Pass the text up to 4096 characters and receive an audio file ready for your engine.
Since the request shape is identical, migrating from a placeholder or alternative TTS service requires only configuration updates, not code refactoring.
Available Voices and Models
SpriteVoice provides two model variants, tts-1 and tts-1-hd, which share the same engine and pricing. You can fetch the full list of available voices, languages, and formats by calling the GET /v1/voices endpoint.
GET /v1/voices Endpoint
Call GET https://api.ab777game.com/v1/voices to retrieve metadata for all 8 preset voices. The response includes each voice's ID, gender, and supported languages, allowing you to dynamically populate your game's dialogue settings without hardcoding values.
tts-1 and tts-1-hd Models
Both tts-1 and tts-1-hd use the same underlying engine and incur identical charges. Choose tts-1 or tts-1-hd based on your project's audio quality requirements; both have the same generation speed and price.
8 Preset Voices
Select from 8 licensed presets tailored for NPC roles. Voices like Aria (warm narrator) or Felix (energetic promo) help define character personalities. Each voice supports all 23 languages, enabling consistent voice acting across global releases.
- Aria: warm, clear narrator
- Felix: energetic, promo
- Luna: soft, storytelling
- Sage: calm, instructional
Supported Audio Formats
The API supports five audio formats: mp3, wav, opus, flac, and pcm. This flexibility lets you choose the right balance of quality and file size for your game's audio pipeline. You can select the format that best fits your engine's requirements and player devices.
MP3, WAV, OPUS, FLAC, PCM
Each format serves different use cases. MP3 offers compact size for general use. WAV and FLAC provide lossless quality for high-fidelity needs. OPUS is efficient for web-based delivery. PCM gives raw data for custom processing.
- mp3: compressed, widely supported
- wav: uncompressed, standard for many engines
- opus: efficient for web delivery
- flac: lossless compression
- pcm: raw audio data
Choose Based on Game Engine
Select formats compatible with your engine. Unity and Unreal typically support MP3 and WAV. Web games may benefit from OPUS. Use PCM if you need raw data for real-time effects.
Quality vs Size Trade-offs
Balance audio quality with storage limits. Lossless formats like WAV and FLAC offer better sound but increase download sizes. Compressed formats like MP3 and OPUS reduce file size with minimal quality loss for most dialogue.

Rate Limits and Quotas
API usage is governed by strict rate limits to ensure fair access for all indie developers. Understanding these quotas helps you plan your NPC voice generation workflows without unexpected interruptions or billing surprises.
60 Requests per Minute
Each API key is limited to 60 requests per minute. This limit applies per key. Plan your batch generation accordingly to avoid hitting the cap during peak development hours.
10 Requests Before Top-up
New accounts start with a reduced limit of 10 requests per minute. This applies until you make your first top-up. Once you add funds via USDT, your quota increases to the standard 60 requests per minute.
Queue Processing Under Load
Requests are processed sequentially. If you exceed the limit or the server is busy, your request may wait in a queue. Longer texts take more time to generate, so plan your submission times to avoid delays in your game build pipeline.
Handling Long Texts
Game dialogue often exceeds the 4096-character limit per request. You must split your script into smaller chunks and send them sequentially to the API.
After receiving each audio file, concatenate the segments to create a complete voice line for your NPC.
Split at 4096 Characters
Send each text chunk as a separate POST request. The API processes requests in order, so under heavy load, subsequent chunks may queue. Ensure your client waits for each response before sending the next.
Join Audio Files
The API returns individual audio files for each chunk. Your game engine or backend script must stitch these files together seamlessly. This ensures the final NPC line plays without gaps or interruptions.
Pre-generation
Since synthesis takes time, generate voice lines during loading screens or idle states. This pre-generation strategy hides latency, ensuring instant playback when the player triggers dialogue. It keeps the game experience smooth without real-time waiting.
Authentication and Errors
Secure your API calls by including a valid bearer token in the Authorization header. You can generate or rotate this key instantly via the dashboard, with old keys invalidated immediately upon issuance.
Bearer Token Auth
Include Authorization: Bearer tts-... in every request header. Ensure the key matches your account’s active credential to avoid rejection.
Common Error Codes
Errors like 401 indicate invalid or expired keys, while 429 signals rate limit exhaustion. Failed synthesis requests are free, ensuring you are not charged for invalid outputs.
- 401: Unauthorized – Check your Bearer token.
- 400: Bad Request – Verify JSON structure.
- 429: Too Many Requests – Wait or upgrade.
Retry Logic
Implement exponential backoff for transient errors. Since requests are processed sequentially under load, brief pauses between retries help avoid queue bottlenecks.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. We need the voice actor to capture the subtle shift in tone when the NPC realizes the player has betrayed their trust.
23 languages
Any voice speaks any of these languages.
