Frequently asked questions
What is the base URL?
The base URL is https://api.lawpan.info/v1. You send POST requests to https://api.lawpan.info/v1/audio/speech with your JSON payload. This endpoint handles all text-to-speech synthesis operations. Ensure you use the correct domain for your specific site account. All other endpoints like /voices and /models are relative to this base URL.
How do I set the speed?
Include the speed field in your JSON request body. Acceptable values range from 0.25 to 4.0. A value of 1.0 plays at normal speed. Lower values slow down the narration, while higher values increase the pace. This allows you to adjust voice timing for game dialogue or content pacing.
Can I use the OpenAI SDK?
Yes, the official OpenAI SDKs work perfectly. Change the base_url to https://api.lawpan.info/v1 and use your GamerVoice API key. The request shape matches the OpenAI speech endpoint exactly. This allows you to use existing code with minimal configuration changes for integration into your projects.
What languages are supported?
We support 23 languages including Spanish, English, German, French, Japanese, and Chinese. Any voice can speak any of these languages. If you do not set the language, it is guessed from the script. For non-English Latin text, explicitly set the language code to ensure accuracy.
How do I handle long texts?
Split your text into parts of up to 4096 characters per request. Generate audio for each part separately. Then join the resulting audio files together. This ensures stable synthesis. Each request processes independently, so manage your queue to handle multiple segments efficiently during generation.
What is the rate limit?
The limit is 60 requests per minute per API key. New accounts without top-ups are limited to 10 requests per minute. Requests are processed sequentially, so load may cause queuing delays. Monitor your usage to stay within limits and avoid delays in your audio generation workflow.
How do I authenticate?
Include your API key in the Authorization header. Use the format: Authorization: Bearer tts-... Your key is issued when you sign up. You can generate a new key at any time; the old one stops immediately. Keep your key secure to prevent unauthorized usage of your balance.
What formats are supported?
You can request audio in mp3, wav, opus, flac, or pcm formats. Specify the response_format field in your JSON body. Choose mp3 for small file sizes or wav for high quality. Each format serves different needs for game assets or content creation workflows.
What is the character limit?
Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. For longer texts, split them into chunks. This limit applies to the input field in your JSON payload. Exceeding it will result in an error.
Do I need to install a SDK?
No, you do not need our specific SDK. You can use the official OpenAI SDK or plain HTTP requests. Just update the base_url to our endpoint. This flexibility allows you to integrate the API into any environment that supports standard HTTP calls or popular SDKs.
How do I retry a failed request?
Failed requests are free, so you can retry them without cost. If synthesis fails, the charge is returned in full. Simply resend the same JSON payload with your API key. Check the response status to confirm failure before retrying.
Is SSML supported?
No, SSML is not supported. We provide simple text input for synthesis. There are no phoneme dictionaries or custom pronunciation lexicons. You control pacing using the speed parameter. For complex audio needs, generate separate segments and join them manually in your audio editor.
First request
curl
curl https://api.lawpan.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.mp3Python (openai)
from openai import OpenAI
client = OpenAI(base_url="https://api.lawpan.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.lawpan.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 | |
|---|---|
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
Get your API key to start generating NPC dialogue. Sign up on /get-api-key/ using Google or email. Google sign-ups include a $0.50 free trial (50,000 characters) valid for 7 days. Email accounts start with zero credit.
Your key authenticates requests. You can generate a new key anytime; the old one stops immediately. This ensures secure access for your game's audio pipeline without downtime.
Sign Up Process
Navigate to /get-api-key/ and choose Google or email registration. Google sign-ups receive immediate trial credit. Email accounts require a manual top-up to begin generating audio.
- Google sign-up: instant $0.50 credit
- Email sign-up: zero initial credit
- 7-day trial validity
Key Management
Your dashboard displays your active key, balance, and usage stats. Keep this key secure as it grants access to your account's credits.
- View key, balance, and usage
- One active key per account
- Secure credential storage
Key Revocation
Generate a new key anytime from your dashboard. The previous key becomes invalid immediately, ensuring no unauthorized usage continues if your key is exposed.
- Instant key invalidation
- No downtime during rotation
- Simple revocation process
First Request with Curl
Send a JSON payload to the speech endpoint to generate audio instantly. This method works with any HTTP client, requiring only a valid API key and the text you wish to convert.
JSON Body Structure
The request body must be a JSON object containing the model, input text, voice selection, and output format. Keep the payload under 4096 characters to ensure immediate processing.
- model: "tts-1" or "tts-1-hd"
- input: your NPC dialogue text
- voice: e.g., "aria" or "atlas"
- response_format: "mp3", "wav", "opus", "flac", or "pcm"
Required Fields
Every request requires a model, input, voice, and response_format. The language field is optional; if omitted, the system guesses the language from the script, defaulting to English for Latin text.
Response Format
On success, the response contains the raw audio binary data. Failed requests return an error JSON object and incur no charge, ensuring you only pay for successful synthesis.
OpenAI SDK Integration
Integrate GamerVoice into your game or content pipeline using the official OpenAI SDK. By simply adjusting the base URL, you can leverage familiar tools to generate NPC dialogue or narration without learning a new library.
This approach ensures consistent behavior with standard TTS workflows while giving you access to our specific voice presets and language options directly through your existing codebase.
Base URL Configuration
Point your SDK client to our API endpoint. Use https://api.lawpan.info/v1 as the base URL. This allows the OpenAI SDK to route requests correctly to our speech generation engine.
Client Initialization
Initialize the client with your API key. Ensure you pass the key via the Authorization header. The SDK handles the request structure automatically.
Code Example
Here is a Python example using the OpenAI SDK:
```python import openai client = openai.OpenAI( base_url="https://api.lawpan.info/v1", api_key="tts-your-api-key-here" ) response = client.audio.speech.create( model="tts-1", voice="aria", input="Hola mundo", response_format="mp3", speed=1.0 ) response.write_to_file("output.mp3") ```
Supported Voices
GamerVoice provides eight distinct voice presets, carefully designed to serve diverse NPC roles and narrative styles. Each voice is derived from licensed recordings and public-domain audiobook readings, ensuring high-quality, royalty-free audio for your game projects.
Female Voices
Our female voices offer versatile tonal ranges. Aria provides a warm, clear narrator style ideal for exposition. Nova delivers a bright, upbeat tone suitable for energetic characters. Luna offers a soft, storytelling voice for atmospheric scenes, while Sage brings a calm, instructional presence perfect for tutorial NPCs.
Male Voices
The male selection includes Felix, an energetic voice great for promotional dialogue or action sequences. Milo offers a friendly, conversational tone for everyday interactions. Atlas provides a neutral, news-like delivery for objective information, and Orion delivers a deep, documentary-style voice for serious lore or background narration.
Voice Selection
All eight voices can speak any of the 23 supported languages, including Spanish. To ensure accurate pronunciation for non-English Latin script text, explicitly set the language parameter. The API also attempts automatic language detection based on the script if not specified, defaulting to English for Latin characters.
Audio Formats
GamerVoice supports five audio formats to suit different game engine pipelines and streaming needs. Choose the output that best balances file size, quality, and compatibility for your NPC dialogue system.
MP3 Compatibility
MP3 is the most widely supported format for game engines and web browsers. It offers a good balance between file size and audio quality, making it ideal for streaming dialogue or storing large voice lines without consuming excessive disk space.
WAV Quality
WAV provides uncompressed, high-fidelity audio directly from the synthesis engine. Use this format when you need pristine sound quality for cutscenes or when your game engine requires lossless input for further audio processing.
FLAC and OPUS
FLAC offers lossless compression, retaining full audio quality while reducing file size compared to WAV. OPUS is a highly efficient format for small file sizes, though the API does not provide real-time streaming.
Rate Limits
GamerVoice enforces a strict rate limit of 60 requests per minute per API key. This ensures fair usage for game developers integrating NPC dialogue or content creators generating audio assets. If you exceed this threshold, requests will be queued or rejected until the window resets.
Requests Per Minute
Each active API key is allowed a maximum of 60 requests every minute. Since requests are processed sequentially, longer texts may take a few seconds to generate, potentially causing your effective throughput to drop below the theoretical maximum during peak loads. Plan your batching accordingly to avoid latency in your game’s audio pipeline.
Initial Limit
New accounts without a top-up start with a reduced limit of 10 requests per minute. This lower tier is designed to prevent abuse during the free trial phase, allowing you to test the API’s stability and voice quality without overwhelming the server infrastructure. You can upgrade this limit by adding funds.
Limit After Top-Up
Once you top up your balance via USDT (TRC-20), your rate limit increases to the full 60 requests per minute. The limit applies per key, so if you need higher throughput, you can issue a new key or manage multiple keys. Failed requests do not consume your character credit.
- Top-up via USDT on TRON (TRC-20) only.
- Minimum top-up amount is $5.
- Balance does not expire.
Error Handling
API errors indicate specific issues during synthesis. The system returns standard HTTP status codes to help you debug requests quickly.
Common Error Codes
A 400 Bad Request means your JSON body is malformed or missing required fields. A 401 Unauthorized indicates an invalid or expired API key. A 429 Too Many Requests triggers when you exceed the 60 requests per minute limit.
- 400: Invalid JSON or missing input text
- 401: Invalid Bearer token
- 429: Rate limit exceeded
- 500: Internal synthesis error
Retry Logic
Implement exponential backoff for 429 and 500 errors. Wait briefly before retrying to avoid overwhelming the queue during high load.
Billing Errors
A 402 Payment Required appears if your balance is insufficient. Failed synthesis requests are free, so you are not charged for errors. Ensure your USDT top-up is processed before making high-volume requests.

Text Processing
This API treats input as plain text, counting every space and punctuation mark toward your 4,096-character limit per request. For NPC dialogue, keep lines concise to avoid truncation, or split longer conversations into multiple calls and join the resulting audio files manually.
You can control pacing using the speed parameter, accepting values from 0.25 to 4.0. This allows you to match the voice’s delivery to your game’s atmosphere, from slow, emotional monologues to rapid-fire combat instructions.
Character Limits
Each request supports up to 4,096 characters. Spaces and punctuation count toward this total. If your dialogue exceeds this, split the text into smaller chunks and concatenate the audio outputs.
Failed requests do not consume your character credit, ensuring you only pay for successfully generated speech.
Language Detection
The API guesses the language from the script if you do not specify one. Latin script text defaults to English. For non-English Latin text, always set the language parameter to avoid mispronunciation.
Supported languages include Spanish, French, German, and 20 others. Unsupported languages like Vietnamese or Thai will fall back to default English pronunciation.
Speed Adjustment
Use the speed field to adjust playback rate between 0.25 and 4.0. A value of 1.0 is normal speed. Lower values create slower, more deliberate speech for cutscenes, while higher values suit fast-paced action.
Speed changes affect the final audio duration but do not alter the voice character or pitch.
Advanced Usage
Handle dialogue-heavy scripts by splitting input text into segments of up to 4,096 characters. Each segment generates a separate audio file, which you then concatenate to form the complete NPC voice line or quest narration.
Long Text Splitting
Break your script into chunks not exceeding 4,096 characters per request. This ensures consistent synthesis quality and prevents timeouts for longer quest lines or character monologues.
- Maximum 4,096 characters per request
- Segments are processed sequentially
Audio Joining
Receive individual audio files for each chunk. Use your preferred audio library to join these files seamlessly, preserving the natural flow of the dialogue without gaps.
Speed Variations
Adjust speech rate between 0.25 and 4.0 to match character personality. Use slower speeds for thoughtful NPCs and faster rates for energetic, rushed dialogue, all within the same API call.
- Range: 0.25–4.0
- Adjust per request
Voice Models
The API exposes two model identifiers, tts-1 and tts-1-hd, which share the same underlying engine and pricing. Selecting either model delivers identical audio quality and price, as they use the same engine.
TTS-1 Model
Use tts-1 as your standard identifier. It processes requests through the same engine as the HD variant, ensuring consistent voice characteristics and latency profiles for your NPC dialogue generation.
TTS-1-HD Model
The tts-1-hd identifier points to the same high-fidelity engine. There is no quality difference between the two models; the name is primarily for SDK compatibility and future-proofing your code structure.
Engine Consistency
Both models utilize the same synthesis engine, meaning voice presets like Aria or Felix behave identically regardless of the model tag. This consistency simplifies testing, as you can develop with tts-1-hd and deploy with tts-1 without any audible changes in your game's audio pipeline.
Authentication
Authentication is handled via a simple Bearer token in the Authorization header. This key grants access to your account’s quota and voice presets for every request sent to the API.
Bearer Token
Include your key as Authorization: Bearer tts-... in every request. The API validates this token before processing audio synthesis, ensuring only authorized users consume credits.
Key Security
Keep your key private. Unlike some services, you have only one active key per account. If compromised, revoke it immediately via your dashboard to stop usage.
- Store keys in environment variables, not hard-coded in client-side code.
Single Key Policy
Each account holds exactly one active API key. Generating a new key instantly invalidates the previous one, ensuring a single point of control for your NPC dialogue billing.
Troubleshooting
When the API is under load, requests may queue briefly. If you see timeout errors, wait a moment and retry. For persistent issues, check your internet connection and ensure your firewall allows outbound traffic to api.lawpan.info.
Audio format mismatches often cause silent failures or playback issues. Verify that the response_format in your request matches the file extension you expect. Some players may not support OPUS or FLAC natively.
Connection Issues
If your request times out, the server might be processing other queued jobs. Wait a few seconds and retry. Ensure your network allows HTTPS traffic to the API domain.
- Check firewall rules for outbound HTTPS.
- Verify internet stability.
- Retry after 5-10 seconds if queued.
Format Errors
Ensure the response_format field matches a supported type: mp3, wav, opus, flac, or pcm. Using an unsupported format returns a 400 error. Some audio players may not support OPUS or FLAC natively.
- Supported formats: mp3, wav, opus, flac, pcm.
- Check player compatibility for OPUS/FLAC.
- Verify file extension matches format.
Voice Not Found
If you receive a 400 error for an invalid voice, ensure the voice name is one of the eight presets (e.g., aria, nova, felix). Case sensitivity usually does not apply, but typos do. Check the /v1/voices endpoint for the current list.
- Use only the 8 preset voice names.
- Check for typos in voice names.
- Refer to /v1/voices for the full list.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. Use her for characters who serve as guides or historians in your game.
23 languages
Any voice speaks any of these languages.
