Frequently asked questions
What is the base URL for the API?
The API base URL is https://api.pk8ok.com/v1. Use this endpoint for all requests, including the speech generation POST request and the voices listing GET request. Ensure your client library points to this specific domain to route traffic correctly.
Do I need to install a specific SDK?
No proprietary SDK is required. You can use the official OpenAI SDKs by changing the base_url to https://api.pk8ok.com/v1. Alternatively, you may use standard HTTP libraries in Python, JavaScript, or PHP to send JSON payloads directly to the endpoint.
How do I set the authorization header?
Include the header Authorization: Bearer tts-... in every request. Replace tts-... with your unique API key found on the /get-api-key/ dashboard. Each account holds one active key; issuing a new key immediately invalidates the previous one.
What formats are supported for audio output?
You can specify the response_format field as mp3, wav, opus, flac, or pcm. These formats are available for all voice models. Select the format that best fits your application’s requirements for file size and playback compatibility.
How do I handle rate limits in my code?
The limit is 60 requests per minute per key (10 per minute before the first top-up). Implement exponential backoff or a queue in your code to handle retries. Requests are processed sequentially, so under load, subsequent requests may wait in a queue.
Can I use the OpenAI SDK with this API?
Yes. The request shape matches the OpenAI speech endpoint. Configure your OpenAI SDK client to use base_url as https://api.pk8ok.com/v1 and provide your LingvoLink API key. This allows you to use existing OpenAI client code with our API.
How do I change the speed of the audio?
Set the speed parameter in your request body to a value between 0.25 and 4.0. This adjusts the playback speed of the generated audio relative to the default rate. Values outside this range may result in errors or unexpected audio behavior.
What happens if I exceed the character limit?
The maximum input size is 4096 characters per request. If your text exceeds this, you must split it into chunks of 4096 characters or fewer. Generate audio for each chunk separately and join the resulting audio files in your application logic.
How do I list available voices?
Send a GET request to /v1/voices. This endpoint returns details on all 8 available voices, supported languages, formats, and pricing information. Use this data to dynamically populate your application’s voice selection interface before generating speech.
Is there a limit on request size?
Yes, the input field is limited to 4096 characters per request. Spaces and punctuation count toward this limit. For longer texts, split the content into multiple requests, generate audio for each part, and concatenate the outputs.
How do I rotate my API key?
Issue a new key from the /get-api-key/ dashboard. The new key becomes active immediately, and the old key stops working at once. Update your application configuration to use the new key to ensure continuous service without interruption.
What is the default language if not specified?
If the language field is omitted, the system guesses the language from the script. Latin script text defaults to English. For non-English Latin-script text, explicitly set the language parameter to the correct ISO code to ensure accurate synthesis.
How do I handle errors in the response?
Check the HTTP status code and response body for error details. Failed requests are free: if synthesis fails, the charge is returned in full. Implement logic to retry failed requests or handle specific error codes returned by the API to maintain robust integration.
Can I generate audio in multiple formats simultaneously?
No, each request generates a single audio file in one format. To get multiple formats, send separate requests for the same text, specifying different response_format values in each request. This allows you to produce mp3, wav, or other formats independently.
First request
curl
curl https://api.pk8ok.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.pk8ok.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.pk8ok.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 |
Authentication
Authentication is handled via a Bearer token sent in the Authorization header. You receive one active key per account upon signing in at /get-api-key/. This single key authenticates all API requests to the base URL https://api.pk8ok.com/v1.
Bearer Token
Include your key as Authorization: Bearer tts-... in every request. The key grants access to your balance and usage limits. Ensure the header is correctly formatted to avoid 401 Unauthorized errors.
Key Management
View your current key, balance, and character usage on the /get-api-key/ dashboard. The system supports only one active key per account at any time, simplifying credential management for your startup's infrastructure.
Key Rotation
You can issue a new key from the dashboard at any time. The old key stops working immediately, ensuring no concurrent usage. This allows you to rotate credentials without downtime or managing multiple active tokens.
Endpoints
The API exposes three primary endpoints for generating audio and retrieving metadata. The speech generation endpoint accepts text and returns an audio file, while the voice and model endpoints provide configuration details for integration.
Speech Generation
Send a POST request to /v1/audio/speech with your text and voice selection. The service returns the audio file directly in the response body, compatible with standard HTTP clients.
- Endpoint: POST /v1/audio/speech
- Accepts JSON body with model, input, and voice parameters
- Returns audio file in the requested format (mp3, wav, opus, flac, or pcm)
Voice Listing
Retrieve the full list of available voices and their supported languages via a GET request to /v1/voices. This endpoint also provides pricing and format details for each voice preset.
Use this data to dynamically populate your UI dropdowns or configure batch generation jobs with the correct voice IDs.
- Endpoint: GET /v1/voices
- Returns voice ID, name, gender, and supported languages
- Includes current pricing and available response formats
Model Listing
Fetch available model versions using GET /v1/models. Currently, this returns the standard "tts-1" and high-quality "tts-1-hd" models, which share the same engine and pricing tier.
Refer to this endpoint to ensure your integration is using the latest available model identifiers before synthesizing speech.
- Endpoint: GET /v1/models
- Lists all active model IDs (e.g., tts-1, tts-1-hd)
- Provides model metadata for version compatibility checks
Request Parameters
Configure the synthesis engine, input content, and vocal style to generate audio files. The API accepts standard JSON bodies for all requests, ensuring compatibility with existing HTTP clients in Python, JavaScript, and PHP stacks.
Model Selection
Choose between "tts-1" and "tts-1-hd". Both models use the same engine and pricing structure, allowing you to switch based on quality requirements without adjusting your billing logic.
Input Text
Pass your script via the input field. The API accepts up to 4096 characters per request. Spaces and punctuation count toward this limit. For longer texts, split your content into chunks and concatenate the resulting audio files.
- Maximum length: 4096 characters
Voice Selection
Select one of eight presets using the voice parameter. Voices are designed for clarity and consistency in language learning contexts. You can also optionally specify a language ISO code to ensure correct pronunciation for non-English Latin-script text.
- aria, nova, luna, sage (Female)
- felix, milo, atlas, orion (Male)
Response Formats
The API returns the audio file directly in the response body. You can select the output format via the response_format parameter to match your playback infrastructure or storage constraints.
MP3 Output
MP3 is the default format, offering a balance between file size and compatibility. It is ideal for web playback and general-purpose applications where bandwidth efficiency matters.
WAV Output
WAV provides uncompressed, lossless audio data. Choose this format if your downstream processing pipeline requires raw PCM samples or if you need to perform precise audio analysis without decoding artifacts. The resulting files are larger but preserve the full fidelity of the synthesis engine.
Other Formats
You can also request opus, flac, or pcm. Opus offers high compression for low-bandwidth scenarios. FLAC provides lossless compression for archival purposes. PCM returns raw audio data without container overhead, suitable for immediate playback in specific embedded systems.
Rate Limits
Rate limits ensure stable generation performance for language learning applications. The system processes requests sequentially, meaning high-volume batches may experience brief delays during peak usage.
Standard Limit
Each API key is allowed 60 requests per minute once your account is fully funded. This limit applies to all speech generation endpoints and ensures consistent throughput for your integration.
Initial Limit
New accounts start with a reduced limit of 10 requests per minute. This applies until you make your first top-up. After topping up, the standard 60 requests per minute limit activates immediately.
Queue Behavior
Requests are processed one after another. Requests are processed one after another, so under load a request may wait in a queue. This ensures your audio generation jobs complete even under load, though processing time may increase during high traffic.
- Requests are processed sequentially
- Excess requests enter a queue
- No immediate failure on limit exceed

Error Handling
Handling API errors ensures your language learning pipeline remains robust. When synthesis fails, no characters are deducted from your balance, and the full cost is returned. This guarantees that transient network issues or invalid inputs do not inflate your usage costs unexpectedly.
Common Errors
The most frequent issues involve exceeding the 4,096 character limit per request or providing an invalid voice ID. If the input text contains unsupported characters or the model is unavailable, the API returns a clear error message indicating the specific constraint violated.
- 400 Bad Request: Invalid JSON or missing required fields like
inputorvoice. - 401 Unauthorized: Invalid or expired Bearer token in the Authorization header.
- 429 Too Many Requests: Exceeded the 60 requests per minute limit per key.
Retry Logic
Implement exponential backoff for transient errors like 500 or 503 status codes. Since requests are processed sequentially under load, brief delays between retries prevent overwhelming the queue. Retry failed requests immediately; they are guaranteed to be free of charge.
Status Codes
Standard HTTP status codes apply. A 200 OK response contains the audio file. Use 4xx codes for client-side errors (e.g., bad parameters) and 5xx for server-side issues. Check the HTTP status code and response body for error details.
- 200: Success. Audio data returned.
- 400: Bad Request. Check input format and limits.
- 429: Rate Limit. Wait and retry with backoff.
Code Examples
Generate audio instantly with our drop-in compatible API. The following examples demonstrate integration for Python, JavaScript, and PHP environments, leveraging standard HTTP libraries or the official OpenAI SDK with a custom base URL.
Use these snippets as a foundation for your language learning app's text-to-speech engine. Adjust parameters like voice and speed to match your curriculum's tone.
Curl Example
Send a POST request to the speech endpoint with your Bearer token. Replace YOUR_API_KEY and adjust the model, voice, and input text as needed.
- `curl -X POST https://api.pk8ok.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"}'`
Python SDK
Install the OpenAI Python package and configure the base URL to point to our API. Initialize the client with your API key and call audio.speech.create to generate MP3 files.
import openaiclient = openai.OpenAI(base_url="https://api.pk8ok.com/v1", api_key="YOUR_API_KEY")- `audio = client.audio.speech.create(model="tts-1", voice="nova", input="Language learning is fun.", response_format="mp3")`
audio.write_to_file("output.mp3")
JavaScript SDK
Use the openai npm package with the custom base URL. Initialize the client and call the speech method to receive audio data as a stream or file.
const { OpenAI } = require('openai');const client = new OpenAI({ baseURL: 'https://api.pk8ok.com/v1', apiKey: 'YOUR_API_KEY' });- `const response = await client.audio.speech.create({ model: 'tts-1', voice: 'nova', input: 'Study hard.', response_format: 'mp3', });`
const buffer = await response.arrayBuffer();
Advanced Usage
Fine-tune audio characteristics and handle multi-language content programmatically. Adjust playback speed and explicitly define languages to ensure accurate synthesis for diverse language learning materials.
For texts exceeding the 4,096-character limit, split input into chunks, generate individual audio files, and concatenate them. This ensures complete coverage without truncation.
Speed Control
Adjust the speed parameter between 0.25 and 4.0. Use slower speeds for pronunciation practice or faster rates for rapid content generation.
- Default speed is 1.0
- Lower values enhance clarity for learners
- Higher values reduce generation time
Language Override
Set the language field to an ISO code (e.g., 'fr', 'de') to force a specific language. This prevents incorrect language guessing for Latin-script texts.
- Supported: Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish
Text Splitting
Split input text into parts of up to 4,096 characters. Generate audio for each part and join the resulting files to create a single continuous audio track.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. There are no monthly plans, no subscriptions, and no VAT invoices.
23 languages
Any voice speaks any of these languages.
