Integrating Okbajje Systems TTS with Python

By Okbajje editorial team · Updated 2026-11-19

This guide details the Python integration for the Okbajje Systems text-to-speech API, designed for product teams building assistive devices and elderly care solutions. It covers authentication, request structures, and SDK compatibility to ensure consistent audio output for critical communication tasks.

You will find specific examples for generating audio via the OpenAI SDK or standard HTTP requests, along with instructions for handling rate limits and error states. The documentation focuses on reliable, low-latency integration suitable for environments where accuracy and predictable performance are paramount.

Integrating Okbajje Systems TTS with Python

Frequently asked questions

How do I authenticate my Python requests?

Include your API key in the Authorization header as a Bearer token. Use the format 'Authorization: Bearer tts-...'. This key is issued upon account creation and is required for all API requests to authenticate your identity and track usage against your balance.

What is the base URL for the API?

The API base URL is https://api.okbajje.cc/v1. You configure this in your client settings. All endpoints, including speech generation and voice listing, are relative to this base URL. Ensure your Python HTTP client or SDK is directed to this specific domain.

Can I use the standard OpenAI Python SDK?

Yes. The request shape matches the OpenAI speech endpoint. You can use the official OpenAI Python SDK by changing the base_url to https://api.okbajje.cc/v1. This allows you to leverage existing code structures without rewriting your integration logic for our specific API requirements.

How do I specify the output audio format?

Set the response_format field in your JSON body to one of: mp3, wav, opus, flac, or pcm. This parameter determines the encoding of the returned audio file. The choice affects file size and compatibility but does not alter the synthesis engine or pricing structure.

What happens if I exceed the rate limit?

The rate limit is 60 requests per minute per key. If you exceed this, requests may queue or fail. Before your first top-up, the limit is stricter at 10 requests per minute. Failed requests do not incur charges, but successful ones do.

Is the API key rotation immediate?

Yes. You can issue a new key at any time via the dashboard. The old key stops working immediately upon issuance of the new one. This ensures secure access management without downtime, allowing you to rotate credentials instantly if needed.

How do I handle long texts in Python?

Split input text into parts of up to 4096 characters. Send each part as a separate request. Then, join the resulting audio files in your Python application. This approach ensures compliance with the character limit while preserving the full content of your source text.

What are the valid speed values?

The speed parameter accepts values between 0.25 and 4.0. This allows you to adjust the playback rate of the synthesized speech. Values outside this range will likely result in an error. Adjusting speed does not affect the voice characteristics or language detection.

Does the API return audio in chunks?

No. The API returns the complete audio file in the response body. There is no streaming or WebSocket support for partial audio. You receive the full synthesized audio once processing is complete.

How do I list available voices via code?

Send a GET request to /v1/voices. This endpoint returns details on available voices, languages, formats, and pricing. You can parse this response to dynamically select voices in your Python application based on the supported options provided by the API at that moment.

What is the character limit per request?

Each request supports up to 4096 characters of input text. Spaces and punctuation count toward this limit. If your text exceeds this length, you must split it into multiple requests. Each request is processed independently, and results are combined by your application.

Are there SSML tags supported?

No. The API does not support SSML tags, phoneme dictionaries, or custom pronunciation lexicons. You cannot control prosody or pauses via markup. Input is plain text. For precise control, you must manage timing and segmentation in your application logic before sending requests.

How is the language detected automatically?

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, you should explicitly set the language parameter. This ensures accurate synthesis for languages like German, Dutch, or Portuguese.

What is the authorization header format?

Use the header 'Authorization: Bearer tts-...'. Replace '...' with your specific API key. This header must be included in every request to the API. The key is tied to your account and is used for both authentication and usage billing tracking.

First request

curl

curl https://api.okbajje.cc/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.okbajje.cc/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.okbajje.cc/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 Okbajje Systems TTS API relies on a single active Bearer token per account. You generate this key via the /get-api-key/ dashboard, where it is displayed alongside your current balance and usage statistics. This token authenticates all requests to the API endpoint.

Generating API Keys

Generating API Keys

Access the /get-api-key/ page after signing in with Google or email. The interface displays your unique API key, allowing immediate integration into your Python applications. Each account maintains one active key; no additional keys are generated simultaneously unless rotated.

  • Keys are generated via the /get-api-key/ dashboard.
  • One active key per account at any time.
  • Keys are displayed immediately upon creation.

Bearer Token Format

Bearer Token Format

Include the header Authorization: Bearer tts-... in every HTTP request. The token string must be copied exactly as shown in your dashboard. Incorrect formatting or missing headers will result in an authentication error.

Key Rotation Process

If you issue a new key, the previous one stops working immediately. This ensures that only the most recent key is active. There is no overlap period, so update your integration code promptly after generating a replacement key.

Basic Request Structure

Sound wave illustration for: Basic Request Structure

The Okbajje Systems TTS API accepts text input via a single POST endpoint. For production integrations, configure your client to send requests to https://api.okbajje.cc/v1/audio/speech. This endpoint processes standard JSON payloads and returns synthesized audio files directly to the calling application.

Requests must conform to the standard OpenAI speech endpoint structure. This ensures compatibility with existing libraries and simplifies integration into assistive device firmware or elderly care software ecosystems where consistent data schemas are required for reliable audio generation.

Endpoint URL Configuration

Direct requests target the specific speech generation path. Use https://api.okbajje.cc/v1/audio/speech for all synthesis operations. This URL remains constant across all model tiers and voice presets, ensuring stable endpoint behavior for assistive hardware.

JSON Body Parameters

The request body is a JSON object containing the text to convert and configuration metadata. Key parameters include the model identifier, the input string, the desired voice preset, the output format, and an optional speed multiplier. All fields are transmitted in a single payload.

  • model: "tts-1" or "tts-1-hd"
  • input: text string (max 4096 characters)
  • voice: one of 8 preset identifiers
  • response_format: mp3, wav, opus, flac, or pcm
  • speed: float between 0.25 and 4.0
  • language: optional ISO code

Required Fields Overview

Every request must include the model, input, and voice fields. The model determines the engine tier. The input field carries the text, which must not exceed 4096 characters. The voice field selects the specific preset for the output audio.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

Okbajje Systems uses the same request shape as the OpenAI speech endpoint, allowing direct integration via official OpenAI SDKs. Developers simply update the base_url to https://api.okbajje.cc/v1 and provide the standard Bearer token for authentication.

Base URL Modification

Configure your SDK client to point at https://api.okbajje.cc/v1. This ensures all requests, including POST /v1/audio/speech, are routed through the correct gateway while maintaining standard headers and payload structures.

SDK Compatibility Details

The API mirrors the OpenAI interface, meaning existing Python code requires minimal changes. You only need to adjust the base URL and inject your tts-... key. No proprietary client libraries are required.

Code Example Snippet

```python import openai client = openai.OpenAI(base_url="https://api.okbajje.cc/v1", api_key="tts-your-key") speech = client.audio.speech.create( model="tts-1", voice="aria", input="System check complete." ) speech.write_to_file("output.mp3") ```

Curl Command Example

Sound wave illustration for: Curl Command Example

Use the provided cURL command to verify your integration before implementing the Python client. This standard MP3 request demonstrates the core syntax required for synthesizing text into audio files using the Okbajje Systems API.

Standard MP3 Request

Send a POST request to https://api.okbajje.cc/v1/audio/speech with your Bearer token. The JSON body must include the model (tts-1 or tts-1-hd), the input text (max 4096 characters), and the desired voice preset. Specify response_format as mp3 for standard compatibility.

Voice Parameter Specification

Select from eight licensed voices such as aria for clear narration or atlas for neutral, news-style delivery. Each voice supports all 23 available languages. Ensure the language field is set explicitly for non-English Latin script text to guarantee accurate synthesis.

Speed Adjustment in Curl

Adjust the speed parameter between 0.25 and 4.0 to match the pacing requirements of assistive devices. Faster speeds reduce generation time but may impact clarity. The default speed is 1.0, providing balanced audio output for critical communication tasks.

Response Formats and Audio

Sound wave illustration for: Response Formats and Audio

The API accepts mp3, wav, opus, flac, or pcm via the response_format field. MP3 is the standard for efficient storage and playback in assistive devices. WAV and FLAC provide lossless quality for archival or high-fidelity elderly care systems requiring uncompressed audio fidelity.

Audio is returned as a binary file in the response body. The client must handle the raw bytes directly. No intermediate storage occurs; the audio is generated and delivered immediately upon synthesis completion.

MP3 Output Configuration

Set response_format to mp3 for compressed audio. This reduces bandwidth usage for devices with limited connectivity. The output is compatible with standard media players in assistive hardware.

WAV and FLAC Options

Use wav or flac for lossless audio. These formats preserve all generated details without compression artifacts. Ideal for critical communication tasks where audio integrity is paramount.

Binary Audio Response

The response contains raw audio bytes. Your Python script should write these bytes directly to a file or No JSON wrapper surrounds the audio data.

Response Formats and Audio

Error Handling and Status Codes

Sound wave illustration for: Error Handling and Status Codes

Errors are returned as JSON objects with specific codes. Failed synthesis requests incur no charge, ensuring that billing reflects only successful audio generation.

Rate Limit Exceeded Errors

The API enforces a limit of 60 requests per minute per key. If you exceed this threshold, the server returns a 429 status code. Note that new accounts start with a lower limit of 10 requests per minute until the first top-up is processed.

  • Status code: 429 Too Many Requests
  • Limit: 60 req/min (standard), 10 req/min (initial)

Invalid Voice Names

Ensure the voice parameter matches one of the eight available presets. Using an unrecognized voice ID results in a 400 Bad Request error. Valid voices include aria, nova, luna, sage, felix, milo, atlas, and orion.

  • Status code: 400 Bad Request
  • Check GET /v1/voices for valid IDs

Input Text Length Errors

Each request supports a maximum of 4096 characters in the input field. If your text exceeds this limit, split it into parts. Requests containing text longer than 4096 characters will return a 400 error.

  • Status code: 400 Bad Request
  • Max length: 4096 characters per request

Rate Limits and Queuing

Sound wave illustration for: Rate Limits and Queuing

Okbajje Systems enforces a strict rate limit of 60 requests per minute per API key. This constraint ensures consistent audio generation for assistive devices and elderly care solutions. The limit applies uniformly regardless of text length, requiring product teams to plan their integration architecture accordingly to maintain reliable service levels.

Requests Per Minute Limit

Each API key allows a maximum of 60 requests within a rolling one-minute window. Exceeding this threshold triggers a 429 Too Many Requests error, halting further synthesis until the window resets. Product teams should implement exponential backoff strategies in their Python SDK integrations to handle these limits gracefully without disrupting the user experience.

  • Limit: 60 requests/minute/key
  • Error code: 429
  • Applies to all models

Pre-Topup Limitations

New accounts without a top-up are restricted to 10 requests per minute. This lower threshold allows for initial testing with the free trial credit without overwhelming the service. Once a USDT (TRC-20) top-up is processed, the limit automatically increases to the standard 60 requests per minute, enabling higher-volume deployments.

Queue Behavior Under Load

Requests are processed sequentially. Under heavy load, additional requests may wait in a queue before synthesis begins. This queuing mechanism ensures that each audio file is generated with high accuracy, though it may introduce latency for long texts. Teams relying on real-time feedback should account for this potential delay in their device firmware.

Voice and Model Selection

Sound wave illustration for: Voice and Model Selection

Selecting the correct voice and model ensures audio compatibility with your assistive devices. The API supports eight distinct voice presets, ranging from warm narrators to deep documentary styles, all capable of speaking any of the 23 supported languages. Consistent voice selection is critical for elderly care solutions where users rely on familiar auditory cues.

The model parameter accepts either tts-1 or tts-1-hd. Both utilize the same engine and pricing structure ($0.01 per 1,000 characters), allowing you to switch between standard and high-definition output without changing your integration logic or budget calculations.

Listing Available Voices

Retrieve the full list of available voices, languages, and formats by sending a GET request to /v1/voices. This endpoint returns metadata for all eight presets, including their specific tonal characteristics such as 'warm, clear narrator' for Aria or 'calm, instructional' for Sage.

Each voice is based on licensed recordings from LibriTTS-R and LibriVox. The generated audio files include an inaudible watermark to identify them as synthetic speech, which may be relevant for compliance in certain assistive device deployments.

  • Female voices: aria, nova, luna, sage
  • Male voices: felix, milo, atlas, orion
  • Supports 23 languages including English, Spanish, and German

Model Parameter Usage

Pass tts-1 or tts-1-hd in the model field of your JSON body. Both options draw from the same underlying engine and incur identical costs, providing flexibility for testing audio quality against device capabilities.

Since both models share the same character limit of 4096 per request, you must implement client-side text splitting for longer passages. The API processes requests sequentially, so queue behavior may affect total generation time for large texts.

Language Code Specification

Specify the language using an ISO code in the language field to ensure accurate synthesis. If omitted, the system guesses the language based on the script, defaulting to English for Latin-script text. For non-English Latin text, explicit language setting is required.

The API supports 23 languages, including Arabic, Chinese, Japanese, and Swahili. Any voice can speak any of the 23 supported languages. Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, and Bengali are not supported.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Input text is not stored or used for training, ensuring that no long-term data drift affects voice consistency.

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. W3C WAI: making audio and video accessible
  3. curl documentation
  4. LibriVox public-domain audiobooks
  5. Creative Commons Attribution 4.0
  6. Python documentation
  7. TRON developer hub: TRC-20
  8. IETF RFC 7845: Ogg Opus
  9. Node.js documentation
  10. LibriTTS-R paper (arXiv 2305.18802)
  11. OpenAI API reference: create speech
  12. LibriTTS-R corpus (OpenSLR 141)

More on this site