# Get Generation Source: https://docs.audixa.ai/api-reference/generation GET https://api.audixa.ai/v3/tts Retrieve the status and details of a TTS generation Poll this endpoint to check if your generation is complete. When `status` is `COMPLETED`, the `audio_url` field will contain the download link. ```bash Endpoint theme={null} GET https://api.audixa.ai/v3/tts ``` ## Request The generation ID returned from [POST /tts](/api-reference/tts). ## Response Unique identifier for the generation. Current status: `IN_QUEUE`, `GENERATING`, `COMPLETED`, `FAILED`. The input text that was submitted. Voice ID used. Human-readable voice name. Model used: `base` or `advanced`. Number of tokens consumed. Final cost in USD. Payment source: `CREDITS_BALANCE` (Monthly) or `API_WALLET` (Topup). Download URL for the audio file (only when status is `COMPLETED`). Error details if status is `FAILED`. ISO 8601 creation timestamp. ISO 8601 timestamp when processing started. ISO 8601 timestamp when processing completed. ```bash cURL theme={null} curl -X GET "https://api.audixa.ai/v3/tts?generation_id=gen_abc123" \ -H "x-api-key: YOUR_API_KEY" ``` ```python Python requests theme={null} import requests response = requests.get( "https://api.audixa.ai/v3/tts", headers={"X-API-Key": "YOUR_API_KEY"}, params={"generation_id": "gen_abc123"}, timeout=30, ) response.raise_for_status() generation = response.json() print(generation["status"]) if generation["status"] == "COMPLETED": print(generation["audio_url"]) ``` ```javascript JavaScript fetch theme={null} const query = new URLSearchParams({ generation_id: 'gen_abc123' }); const response = await fetch(`https://api.audixa.ai/v3/tts?${query}`, { method: 'GET', headers: { 'X-API-Key': 'YOUR_API_KEY' } }); if (!response.ok) throw new Error(await response.text()); const generation = await response.json(); console.log(generation.status); if (generation.status === 'COMPLETED') { console.log(generation.audio_url); } ``` ```json Response theme={null} { "generation_id": "gen_abc123", "status": "COMPLETED", "input_text": "Hello from Audixa. This completed request passed validation.", "voice_id": "am_ethan", "voice_name": "Ethan", "model": "base", "tokens": 12, "dollar_cost": 0.000012, "method": "API_WALLET", "audio_url": "https://cdn.audixa.ai/audio/gen_abc123.mp3", "created_at": "2024-03-20T10:00:00Z", "started_at": "2024-03-20T10:00:01Z", "completed_at": "2024-03-20T10:00:02Z" } ``` ## Polling Best Practices Use a short delay with backoff, and honor `429` plus any `Retry-After` header. Set a maximum polling duration appropriate for your application. Always handle the `FAILED` status gracefully with retry logic. Once completed, cache the `audio_url` to avoid re-polling. ## Error Responses Missing or invalid API key. ```json theme={null} { "detail": "Invalid or missing API key" } ``` Unknown generation ID, or a generation owned by another account. ```json theme={null} { "detail": "Generation not found" } ``` Rate limit exceeded. ```json theme={null} { "detail": "Rate limit exceeded. Please retry after 30 seconds." } ``` # History Source: https://docs.audixa.ai/api-reference/history GET https://api.audixa.ai/v3/history List generation history Retrieve your TTS generation history in reverse chronological order (most recent first). ```bash Endpoint theme={null} GET https://api.audixa.ai/v3/history ``` ## Request Maximum results to return (1-100). Number of results to skip. Filter by status: `IN_QUEUE`, `GENERATING`, `COMPLETED`, `FAILED`, `EXPIRED`. ## Response Limit used for pagination. Offset used for pagination. Number of results returned. List of generation objects. Unique generation ID. Generation status: `IN_QUEUE`, `GENERATING`, `COMPLETED`, `FAILED`, `EXPIRED`. Voice ID used. Human-readable voice name. TTS model used. Number of tokens consumed. Cost in USD. Payment method used: `API_WALLET` or `CREDITS_BALANCE`. Download URL (if status is COMPLETED). ISO 8601 creation timestamp. ```bash cURL theme={null} curl -X GET "https://api.audixa.ai/v3/history?limit=10" \ -H "x-api-key: YOUR_API_KEY" ``` ```python Python requests theme={null} import requests response = requests.get( "https://api.audixa.ai/v3/history", headers={"X-API-Key": "YOUR_API_KEY"}, params={"limit": 10}, timeout=30, ) response.raise_for_status() for item in response.json()["history"]: print(f"{item['generation_id']}: {item['status']}") ``` ```javascript JavaScript fetch theme={null} const query = new URLSearchParams({ limit: '10' }); const response = await fetch(`https://api.audixa.ai/v3/history?${query}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); if (!response.ok) throw new Error(await response.text()); const { history } = await response.json(); for (const item of history) { console.log(`${item.generation_id}: ${item.status}`); } ``` ```json 200 OK theme={null} { "limit": 10, "offset": 0, "length": 1, "history": [ { "generation_id": "gen_abc123", "status": "COMPLETED", "voice_id": "am_ethan", "voice_name": "Ethan", "model": "base", "tokens": 25, "dollar_cost": 0.000025, "audio_url": "https://cdn.audixa.ai/audio/gen_abc123.mp3", "created_at": "2025-02-05T12:00:00Z" } ] } ``` ## Error Responses Missing or invalid API key. ```json theme={null} { "detail": "Invalid or missing API key" } ``` Rate limit exceeded. ```json theme={null} { "detail": "Rate limit exceeded. Please retry after 30 seconds." } ``` # API Reference Source: https://docs.audixa.ai/api-reference/introduction Complete reference for the Audixa Text-to-Speech API Welcome to the Audixa API Reference. This section provides detailed documentation for all API endpoints. ## Base URL All API requests are made to: ``` https://api.audixa.ai/v3 ``` ## Authentication Authenticated endpoints accept an API key in the `X-API-Key` header: ```bash theme={null} -H "x-api-key: YOUR_API_KEY" ``` See the Authentication guide for details on obtaining and using API keys. `Authorization: Bearer YOUR_API_KEY` is also accepted. Keep API keys in server-side secrets and never ship them in public browser code. ## Language Examples No Audixa SDK package is required. The language guides use the REST API directly: Create and poll generations with `requests`. Use the native `fetch` API in a server runtime. Fixed voice previews are available at [audixa.ai/voices](https://audixa.ai/voices). Creating a dashboard or API generation requires a minimum \$10 top-up or an active subscription. ## Async Workflow Audixa uses an **asynchronous workflow** for audio generation: ```mermaid theme={null} sequenceDiagram participant Client participant Audixa API participant CDN Client->>Audixa API: POST /v3/tts (text, voice_id, model, audio_format) Audixa API-->>Client: 200 OK {generation_id, status: "IN_QUEUE"} loop Poll until complete Client->>Audixa API: GET /v3/tts?generation_id=... Audixa API-->>Client: {status: "GENERATING"} end Audixa API-->>Client: {status: "COMPLETED", audio_url: "..."} Client->>CDN: Download audio file CDN-->>Client: Audio file ``` POST to `/v3/tts` with non-empty text, a compatible `voice_id`, `model`, and `audio_format`. Receive a `generation_id` and initial status `IN_QUEUE`. Each generation is billed for at least 30 characters (8 tokens). GET `/v3/tts` with your `generation_id` until status is `COMPLETED`. Fetch the audio file from the returned `audio_url`. ## Available Endpoints Start a text-to-speech generation job. Check the status of a generation job. List available voices for a model. Retrieve generation history. Real-time audio streaming. ## Response Format All responses are JSON. Successful responses return status `2xx` with the requested data. **Success example:** ```json theme={null} { "generation_id": "gen_abc123xyz789" } ``` **Error example:** ```json theme={null} { "detail": "Error message explaining what went wrong" } ``` ## Quick Links Create and poll an authenticated generation. Understand and handle API errors. Learn about request limits and best practices. Understand paid generation and wallet expiry. # Real-time Streaming Source: https://docs.audixa.ai/api-reference/streaming WS https://api.audixa.ai/v3/tts/stream Stream audio in real-time via WebSocket Audixa provides a WebSocket endpoint for real-time text-to-speech streaming, allowing you to play audio as it is being generated. The requested `audio_format` (`wav` or `mp3`) controls the completed file. Live binary WebSocket chunks use the raw PCM format documented below. ## Connection ```bash Endpoint theme={null} wss://api.audixa.ai/v3/tts/stream ``` ### Authentication Pass your API key as a query parameter: ```bash theme={null} wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_API_KEY ``` ## Protocol ### 1. Send Request Once connected, send a JSON payload with your generation details. A voice must be compatible with the selected model; use `GET /v3/voices?model=base` or `GET /v3/voices?model=advanced` to select one. | Model | Compatible voices | Model-specific controls | | ---------- | ----------------------------------------------------------------- | -------------------------------------------------------------------- | | `base` | Base system voices | `speed` from `0.5` to `2.0` | | `advanced` | Advanced system voices and compatible account-owned custom voices | `cfg_weight` from `1.0` to `5.0`; `exaggeration` from `0.0` to `1.0` | ```json Base request theme={null} { "text": "Hello, world! This is a Base streaming test.", "voice_id": "am_ethan", "model": "base", "speed": 1.0, "audio_format": "wav", "language_code": "a" } ``` ```json Advanced request theme={null} { "text": "Hello, world! This is an Advanced streaming test.", "voice_id": "YOUR_ADVANCED_VOICE_ID", "model": "advanced", "cfg_weight": 2.5, "exaggeration": 0.5, "audio_format": "wav", "language_code": "en" } ``` ### 2. Receive Messages The server will send a mix of JSON control messages and binary audio data. **A. Started Message (JSON)** Sent when processing begins. ```json theme={null} { "type": "started", "generation_id": "gen_abc123", "channel": "generation:gen_abc123" } ``` **B. Audio Chunks (Binary)** Raw binary audio data streams immediately after the "started" message. See [Audio Format](#audio-format) below for decoding details. Append these chunks to your audio buffer or play them directly. **C. Completion (JSON)** Sent when the stream ends. ```json theme={null} { "type": "completed", "audio_url": "https://cdn.audixa.ai/..." // Backup complete file URL } ``` **D. Error (JSON)** ```json theme={null} { "type": "error", "message": "Invalid API Key" } ``` ## Audio Format All binary audio chunks are streamed in a **standardized format**, consistent across the supported `base` and `advanced` models: | Property | Value | | ----------------- | ------------------------ | | **Encoding** | Raw PCM (uncompressed) | | **Sample Format** | 32-bit float (`float32`) | | **Sample Rate** | 24,000 Hz | | **Channels** | 1 (Mono) | | **Byte Order** | Little-endian | The streamed chunks are **raw PCM float32** — not WAV or MP3. Each sample is a 4-byte IEEE 754 float, typically in the range `[-1.0, 1.0]`. You must decode them as `float32`, not `int16`, or the audio will sound like static noise. The `completed` message includes an `audio_url` pointing to the fully encoded file (WAV/MP3) on the CDN. You can use this as a fallback or for saving a complete copy. ## Examples ### Real-Time Playback Play audio chunks as they arrive rather than waiting for the completed file. ```python Python theme={null} import websockets import json import asyncio import numpy as np import sounddevice as sd # Audio format — must match server output RATE = 24000 # 24 kHz CHANNELS = 1 # Mono DTYPE = 'float32' # 32-bit float PCM async def stream_tts(): audio_stream = sd.RawOutputStream( samplerate=RATE, channels=CHANNELS, dtype=DTYPE, ) audio_stream.start() uri = "wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY" try: async with websockets.connect(uri) as websocket: await websocket.send(json.dumps({ "text": "Hello from the stream!", "voice_id": "am_ethan", "model": "base" })) while True: msg = await websocket.recv() if isinstance(msg, str): data = json.loads(msg) if data["type"] == "started": print("Stream started!") elif data["type"] == "completed": print(f"Done! CDN URL: {data.get('audio_url')}") break elif data["type"] == "error": print(f"Error: {data['message']}") break else: # Decode float32 PCM and play immediately audio_stream.write(np.frombuffer(msg, dtype=DTYPE)) finally: audio_stream.stop() audio_stream.close() asyncio.run(stream_tts()) ``` ```typescript TypeScript theme={null} import WebSocket from 'ws'; import Speaker from 'speaker'; const SAMPLE_RATE = 24000; // npm install speaker — streams raw PCM to system audio const speaker = new Speaker({ channels: 1, bitDepth: 32, sampleRate: SAMPLE_RATE, float: true, signed: true, }); const ws = new WebSocket('wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY'); ws.on('open', () => { ws.send(JSON.stringify({ text: 'Hello from the stream!', voice_id: 'am_ethan', model: 'base' })); }); ws.on('message', (data: WebSocket.Data, isBinary: boolean) => { if (isBinary) { // Write raw float32 PCM directly to speaker speaker.write(data as Buffer); } else { const msg = JSON.parse(data.toString()); if (msg.type === 'started') { console.log(`Stream started: ${msg.generation_id}`); } else if (msg.type === 'completed') { console.log(`Done! CDN URL: ${msg.audio_url}`); speaker.end(); ws.close(); } else if (msg.type === 'error') { console.error('Error:', msg.message); ws.close(); } } }); ``` ```javascript Browser theme={null} // Real-time playback in the browser using Web Audio API const SAMPLE_RATE = 24000; async function streamTTS(apiKey) { const ctx = new AudioContext({ sampleRate: SAMPLE_RATE }); const ws = new WebSocket(`wss://api.audixa.ai/v3/tts/stream?api_key=${apiKey}`); let nextStartTime = 0; ws.onopen = () => { ws.send(JSON.stringify({ text: 'Hello from the stream!', voice_id: 'am_ethan', model: 'base' })); }; ws.onmessage = (event) => { if (typeof event.data === 'string') { const msg = JSON.parse(event.data); if (msg.type === 'started') { console.log('Stream started:', msg.generation_id); nextStartTime = ctx.currentTime; } else if (msg.type === 'completed') { console.log('Done! CDN URL:', msg.audio_url); } else if (msg.type === 'error') { console.error('Error:', msg.message); ws.close(); } } else { // Decode float32 PCM and schedule seamless playback event.data.arrayBuffer().then((arrayBuf) => { const float32Data = new Float32Array(arrayBuf); const audioBuffer = ctx.createBuffer(1, float32Data.length, SAMPLE_RATE); audioBuffer.getChannelData(0).set(float32Data); const source = ctx.createBufferSource(); source.buffer = audioBuffer; source.connect(ctx.destination); const startAt = Math.max(ctx.currentTime, nextStartTime); source.start(startAt); nextStartTime = startAt + audioBuffer.duration; }); } }; } // Must be called from a user gesture (e.g., button click) // streamTTS('YOUR_KEY'); ``` *** ### Save to File Collect all audio chunks and save a complete file when the stream ends. ```python Python theme={null} import websockets import json import asyncio import numpy as np import soundfile as sf async def stream_tts(): uri = "wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY" async with websockets.connect(uri) as websocket: await websocket.send(json.dumps({ "text": "Hello from the stream!", "voice_id": "am_ethan", "model": "base" })) audio_chunks = [] while True: msg = await websocket.recv() if isinstance(msg, str): data = json.loads(msg) if data["type"] == "completed": print(f"Done! CDN URL: {data.get('audio_url')}") break elif data["type"] == "error": print(f"Error: {data['message']}") break else: # Decode float32 PCM audio_chunks.append(np.frombuffer(msg, dtype=np.float32)) # Combine chunks and save as WAV audio = np.concatenate(audio_chunks) sf.write("streamed_output.wav", audio, 24000) print("Saved to streamed_output.wav") asyncio.run(stream_tts()) ``` ```typescript TypeScript theme={null} import WebSocket from 'ws'; import * as fs from 'fs'; import { WaveFile } from 'wavefile'; const SAMPLE_RATE = 24000; const audioChunks: Buffer[] = []; const ws = new WebSocket('wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY'); ws.on('open', () => { ws.send(JSON.stringify({ text: 'Hello from the stream!', voice_id: 'am_ethan', model: 'base' })); }); ws.on('message', (data: WebSocket.Data, isBinary: boolean) => { if (isBinary) { const buffer = data as Buffer; console.log(`Received ${buffer.length / 4} samples`); audioChunks.push(buffer); } else { const msg = JSON.parse(data.toString()); if (msg.type === 'completed') { console.log(`Done! CDN URL: ${msg.audio_url}`); // Combine and save as WAV using wavefile const combined = Buffer.concat(audioChunks); const float32 = new Float32Array( combined.buffer, combined.byteOffset, combined.length / 4 ); const wav = new WaveFile(); wav.fromScratch(1, SAMPLE_RATE, '32f', float32); fs.writeFileSync('streamed_output.wav', wav.toBuffer()); console.log('Saved to streamed_output.wav'); ws.close(); } else if (msg.type === 'error') { console.error('Error:', msg.message); ws.close(); } } }); ``` ```javascript Node.js theme={null} const WebSocket = require('ws'); const fs = require('fs'); const SAMPLE_RATE = 24000; const audioChunks = []; const ws = new WebSocket('wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY'); ws.on('open', () => { ws.send(JSON.stringify({ text: 'Hello from the stream!', voice_id: 'am_ethan', model: 'base' })); }); ws.on('message', (data, isBinary) => { if (isBinary) { // Raw float32 PCM: 4 bytes per sample console.log(`Received ${data.length / 4} samples (${data.length} bytes)`); audioChunks.push(Buffer.from(data)); } else { const msg = JSON.parse(data.toString()); if (msg.type === 'completed') { console.log(`Done! CDN URL: ${msg.audio_url}`); // Save raw PCM — convert to WAV with ffmpeg: // ffmpeg -f f32le -ar 24000 -ac 1 -i output.pcm output.wav const combined = Buffer.concat(audioChunks); fs.writeFileSync('output.pcm', combined); console.log('Saved raw PCM to output.pcm'); ws.close(); } else if (msg.type === 'error') { console.error('Error:', msg.message); ws.close(); } } }); ``` *** ### Other Languages & CLI WebSocket is a bidirectional protocol — standard HTTP tools like **cURL** cannot be used for streaming. For CLI testing, you can use [websocat](https://github.com/vi/websocat), though binary audio handling is limited in terminal tools. For **any language** with a WebSocket client, the decoding rules are the same: * Connect to `wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY` * Send a JSON request, then listen for messages * **Text messages** → JSON control events (`started`, `completed`, `error`) * **Binary messages** → Raw PCM audio: **float32, little-endian, 24 kHz, mono** (4 bytes per sample) ## WebSocket Close Codes The server received data it cannot accept (e.g., malformed JSON, missing fields, or validation errors). Authentication failed (e.g., invalid or missing API key). An unexpected condition prevented the server from fulfilling the request (e.g., database or Redis connection failure). # Create Generation Source: https://docs.audixa.ai/api-reference/tts POST https://api.audixa.ai/v3/tts Start a text-to-speech generation job Submits a text-to-speech task and returns a `generation_id` for tracking. The audio is generated asynchronously—use the [Get Generation](/api-reference/generation) endpoint to check when it's ready. ```bash Endpoint theme={null} POST https://api.audixa.ai/v3/tts ``` ## Request The text to convert to speech. At least 1 character is required. Each generation is billed for at least 30 characters (8 tokens), even for shorter text. The maximum is set by the active plan and cannot exceed the API schema maximum of 50,000 characters. The voice ID to use. Get available voices from [/voices](/api-reference/voices). The model tier to use. * `base`: Supports `speed` and Base-compatible voices. * `advanced`: Supports `cfg_weight`, `exaggeration`, and Advanced-compatible voices. Playback speed multiplier. Range: `0.5` to `2.0`. ### Advanced Model Settings Controls how strictly the model follows the text/style. Range: `1.0` - `5.0`. Controls emotional fluctuation/expressiveness. Range: `0.0` - `1.0`. Output format: `wav` or `mp3`. Optional language code for the input text. The accepted values depend on `model`: * **Base model** uses single-letter codes: `a` (American English), `b` (British English), `j` (Japanese), `z` (Mandarin Chinese), `e` (Spanish), `f` (French), `h` (Hindi), `i` (Italian), `p` (Brazilian Portuguese). * **Advanced model** uses ISO 639-1 codes: `en`, `ar`, `da`, `de`, `el`, `es`, `fi`, `fr`, `he`, `hi`, `it`, `ja`, `ko`, `ms`, `nl`, `no`, `pl`, `pt`, `ru`, `sv`, `sw`, `tr`, `zh`. If omitted, the model falls back to its default language. ## Response Unique identifier for this generation job. Use this to poll [/tts](/api-reference/generation). Initial status: `IN_QUEUE`. The input text that was submitted. Voice ID used for generation. Human-readable voice name. TTS model used (`base` or `advanced`). Number of tokens consumed. Server-calculated cost in USD for the accepted generation. Payment method used: `API_WALLET` or `CREDITS_BALANCE`. URL to download the generated audio (when status=`COMPLETED`). Error details if status=`FAILED`. ISO 8601 timestamp of creation. ISO 8601 timestamp when processing started. ISO 8601 timestamp when processing completed. ```bash cURL theme={null} curl -X POST "https://api.audixa.ai/v3/tts" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "text": "Hello from Audixa. This request is long enough for generation.", "voice_id": "am_ethan", "model": "base", "speed": 1.0, "audio_format": "wav", "language_code": "a" }' ``` ```python Python requests theme={null} import requests response = requests.post( "https://api.audixa.ai/v3/tts", headers={"X-API-Key": "YOUR_API_KEY"}, json={ "text": "Hello from Audixa. This request is long enough for generation.", "voice_id": "am_ethan", "model": "base", "audio_format": "wav", }, timeout=30, ) response.raise_for_status() generation = response.json() print(generation["generation_id"], generation["status"]) ``` ```javascript JavaScript fetch theme={null} const response = await fetch('https://api.audixa.ai/v3/tts', { method: 'POST', headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ text: 'Hello from Audixa. This request is long enough for generation.', voice_id: 'am_ethan', model: 'base', audio_format: 'wav' }) }); if (!response.ok) throw new Error(await response.text()); const generation = await response.json(); console.log(generation.generation_id, generation.status); ``` ```json 200 OK theme={null} { "generation_id": "gen_abc123xyz", "status": "IN_QUEUE", "input_text": "Hello from Audixa. This request is long enough for generation.", "voice_id": "am_ethan", "voice_name": "Ethan", "model": "base", "tokens": 6, "dollar_cost": 0.000006, "method": null, "created_at": "2025-02-05T12:00:00Z", "started_at": null, "completed_at": null } ``` ## Error Responses Invalid parameters (e.g. invalid model, voice not found). Insufficient balance. Rate limit exceeded. # List Voices Source: https://docs.audixa.ai/api-reference/voices GET https://api.audixa.ai/v3/voices List available voices for TTS generation Retrieves a paginated list of available voices. Returns both system voices and your custom voices (if any). ```bash Endpoint theme={null} GET https://api.audixa.ai/v3/voices ``` ## Request Filter by model compatibility. `base` or `advanced`. Maximum results to return (1-500). Number of results to skip. ## Response Limit used for pagination. Offset used for pagination. Number of voices returned in this page. List of voice objects. Unique identifier to use in `/tts` requests. Human-readable name. Compatible model: `base` or `advanced`. `Male`, `Female`, or `Neutral`. Voice accent (e.g., `American`, `British`, `Australian`). Brief description of the voice characteristics. `true` if this is a custom voice created by you. Voice-access classification used by plan rules. A value of `true` does not make TTS generation free. ```bash cURL theme={null} curl -X GET "https://api.audixa.ai/v3/voices?model=base&limit=50" \ -H "x-api-key: YOUR_API_KEY" ``` ```python Python requests theme={null} import requests response = requests.get( "https://api.audixa.ai/v3/voices", headers={"X-API-Key": "YOUR_API_KEY"}, params={"model": "base", "limit": 50}, timeout=30, ) response.raise_for_status() for voice in response.json()["voices"]: print(f"{voice['name']} ({voice['voice_id']})") ``` ```javascript JavaScript fetch theme={null} const query = new URLSearchParams({ model: 'base', limit: '50' }); const response = await fetch(`https://api.audixa.ai/v3/voices?${query}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); if (!response.ok) throw new Error(await response.text()); const { voices } = await response.json(); for (const voice of voices) { console.log(`${voice.name} (${voice.voice_id})`); } ``` ```json 200 OK theme={null} { "limit": 50, "offset": 0, "length": 2, "voices": [ { "voice_id": "am_ethan", "name": "Ethan", "model": "base", "gender": "Male", "accent": "American", "description": "Clear professional voice", "free": true, "is_custom": false }, { "voice_id": "jake", "name": "Jake", "model": "advanced", "gender": "Male", "free": false, "is_custom": true } ] } ``` ## Error Responses Missing or invalid API key. ```json theme={null} { "detail": "Invalid or missing API key" } ``` Rate limit exceeded. ```json theme={null} { "detail": "Rate limit exceeded. Please retry after 30 seconds." } ``` # Account Management Source: https://docs.audixa.ai/features/account Manage your profile, subscription, and account access The Account page provides an overview of your profile, current plan, and critical account settings. ## Account Overview This section displays your key account information: * **Current Plan:** Your active subscription tier. * **Profile Details:** Name, Email, and Account Creation date. * **User ID:** Your unique internal ID (useful for support). ## Subscription Management You can quickly check your plan features here. To upgrade or manage your billing details, click **Manage Billing**. Subscription cancellation and account deactivation are separate actions. If you have an active subscription, use **Manage Subscription** in Billing to stop its renewal. A scheduled cancellation remains active through the date shown in Billing and can be revoked before that date. ## Danger Zone The dashboard action is a **soft account deactivation**. It does not cancel an active subscription and it does not immediately erase every database record. When you confirm deactivation, Audixa: * marks the account as deleted so it can no longer be used to sign in; * revokes the current session and clears its session cookie; and * attempts to remove user-uploaded files from object storage. Account, billing, generation, custom-voice, and API-key records may remain in the operational database for billing reconciliation, security and support work, analytics continuity, or possible administrator-assisted recovery. Audixa does not publish a fixed automatic-erasure period for those retained records. Before deactivating, cancel any subscription separately in Billing and contact support if you need help with retained data or a billing issue. Do not assume the deactivation button has stopped a payment-provider subscription. ## Need Help? If you have questions about your account or billing, you can use the **Contact Support** button to reach our team securely. # Affiliate Program Source: https://docs.audixa.ai/features/affiliate Earn commissions by referring users to Audixa The Audixa Affiliate Program allows you to earn ongoing commissions by referring new users to our platform. The Affiliate Program is currently **invite-only**. You must have an invite code to join. ## How It Works 1. **Join the Program:** Enter your invite code to access the affiliate dashboard. 2. **Share Your Link:** Copy your unique booking link and share it with your audience. 3. **Earn Commissions:** Earn **10%** commission on every payment made by users you refer. ## The Affiliate Dashboard Once registered, you have access to a comprehensive dashboard to track your performance. ### Statistics Track your success in real-time: * **Total Clicks:** How many times your link was clicked. * **Referrals:** Number of users who signed up. * **Total Earnings:** Gross commissions earned. * **Conversion Rate:** Percentage of clicks that turned into referrals. ### Balances * **Pending Balance:** Commissions that are awaiting payout. * **Total Paid:** Total amount you have successfully withdrawn. ## Payouts You can request a payout once your pending balance reaches the minimum threshold. * **Minimum Payout:** \$25.00 * **Supported Methods:** * PayPal * Bank Transfer * Wise * Crypto To request a payout, navigate to the **Payouts** tab, select your preferred method, and enter your payment details. Interested in joining or have questions? Contact our affiliate team. # Billing Source: https://docs.audixa.ai/features/billing Manage your plan, add funds, and view invoice history The Billing page is your central hub for managing your subscription, wallet balances, and viewing transaction history. ## The Billing Dashboard The dashboard uses a grid layout to show your most important financial data at a glance. ### 1. Total Available Balance The large card shows your **Total Available Balance**, which is the sum of your: * **Monthly Balance:** Included with your plan (resets monthly). * **Top-up Balance:** Purchased separately. Expiry depends on subscription status. ### 2. Add Funds (Topup) You can add funds to your **Topup Balance** at any time. This balance is used when your monthly balance runs out, ensuring uninterrupted service. * **Custom Amount:** Enter any amount between $10 and $1,000. * **Payment:** Securely processed via our payment provider. ### 3. Active Plan Card Shows your current subscription tier and its benefits, such as: * Monthly balance amount * Concurrent request limits * Feature access (e.g., Clone Voices) ## Managing Your Subscription Click the **Manage Subscription** button on your active plan card to open the subscription portal. Here you can: * **Upgrade/Downgrade:** Change your plan. * **Update Payment Method:** Change your card details. * **Cancel Subscription:** Stop auto-renewal. * **View Invoices:** Download past PDF invoices. If you cancel, you will see a cancellation banner with the end date. You can revoke cancellation at any time before that date to keep your plan active. ## Wallet System Explained Audixa uses a **Dual Wallet System**: 1. **Monthly Balance:** Consumed first. Resets on your billing cycle. Unused amounts do NOT roll over. 2. **Top-up Balance:** Consumed only after Monthly Balance is exhausted. Its expiry clock is paused while a subscription is active. Without an active subscription, remaining top-up grants expire after 30 days. If a subscription ends, the 30-day clock starts for remaining top-up grants. A new active subscription pauses the clock again for grants that have not expired. Use the expiry date shown in Billing as the account-specific source of truth. ## Billing History The bottom section contains tabs for: * **Payments:** History of your subscription charges and top-ups. * **Generations:** Detailed log of balance usage per generation. ## Current Plan Facts Rates, balances, generation limits, and commercial support terms can vary by plan. Review the plan card in Billing and the current [Pricing page](https://audixa.ai/pricing) instead of relying on a static matrix. Compare the currently available balances, rates, limits, and terms. Reach out to our team. # Clone Voices Source: https://docs.audixa.ai/features/custom-voices Create reusable synthetic voices for your brand or application **Clone Voices** (also known as Custom Voices) allow you to train a personal voice model that you can use across all your projects. Once created, you can generate speech with this voice repeatedly using the **Advanced Model**. Clone Voices result in a unique Voice ID saved to your account. ## How to Create a Voice Log in to your account and go to the [Clone Voices page](https://audixa.ai/app/custom-voices). You can provide audio in two ways: * **Upload File:** Upload an MP3 or WAV file (Max 10MB). * **Record Audio:** Record a 10-second sample directly in the browser. * **Voice Name:** Give your voice a recognizable name. * **Gender:** Select Male, Female, or Neutral. * **Description:** Optional notes about the voice characteristics. Confirm you have the rights to use the voice and click **Create Voice**. ## Using Your Clone Voice on the Dashboard 1. Go to the [Text to Speech](https://audixa.ai/app/text-to-speech) page. 2. Select the **Advanced Model** (v2). 3. Open the Voice Selector. 4. Your created voices will appear under the **"Your Voices"** or **"Custom"** section. ## Using Your Clone Voice in the API You can use your cloned voice programmatically by referencing its unique `voice_id`. ### 1. Find Your Voice ID In the [Clone Voices dashboard](https://audixa.ai/app/custom-voices), find your voice in the "Your Voices" grid. You can copy the Voice ID from there (if available) or use the API to list your voices. ### 2. Make the API Request Set the `voice_id` parameter to your Voice ID and the `model` parameter to `advanced`. ```python Python requests theme={null} import requests response = requests.post( "https://api.audixa.ai/v3/tts", headers={"X-API-Key": "YOUR_API_KEY"}, json={ "text": "This request uses an account-owned custom voice for speech.", "voice_id": "custom_voice_12345", "model": "advanced", "audio_format": "mp3", }, timeout=30, ) response.raise_for_status() print(response.json()["generation_id"]) ``` ```javascript JavaScript fetch theme={null} const response = await fetch('https://api.audixa.ai/v3/tts', { method: 'POST', headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ text: 'This request uses an account-owned custom voice for speech.', voice_id: 'custom_voice_12345', model: 'advanced', audio_format: 'mp3' }) }); if (!response.ok) throw new Error(await response.text()); console.log((await response.json()).generation_id); ``` ```bash cURL theme={null} curl -X POST "https://api.audixa.ai/v3/tts" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "text": "This request uses an account-owned custom voice for speech.", "voice_id": "custom_voice_12345", "model": "advanced", "audio_format": "mp3" }' ``` ## Billing Clone Voices use the **Advanced Model**, so the active plan's Advanced per-token rate and request limits apply. Review paid generation, wallet order, and top-up expiry. ## Managing Your Voices You can delete voices you no longer need from the [Clone Voices dashboard](https://audixa.ai/app/custom-voices). **Note:** Deletion is permanent and cannot be undone. # My Generations Source: https://docs.audixa.ai/features/generations View and manage your complete text-to-speech generation history The Generations page is your central hub for viewing and managing your complete text-to-speech generation history. Every time you create audio, whether through the dashboard or the API, a record of that job appears here. ## Audio File Retention Policy **Important Data Policy**: Audio files generated on our platform are only stored and available for download for **7 days**. After 7 days, the generation record (including the text, status, and voice used) will remain in your history, but the audio file itself will be purged and will no longer be downloadable. Please be sure to download any essential audio files within this 7-day window. ## Filtering and Searching History This page provides several tools to help you find specific generation tasks quickly. Narrow the list to show jobs with a specific status: * **Completed**: Successfully generated audio * **Generating**: Jobs still in progress * **Failed**: Jobs that could not be completed See only generations created with either the **Base** or **Advance** model. A free-text search bar to find a generation by searching the text content you submitted. Reset all active filters and searches, showing the complete, unfiltered history. ## Generation Details Each item in the list provides a complete summary of the generation task: | Field | Description | | ------------ | -------------------------------- | | **Text** | The original text input | | **Voice ID** | The voice used for generation | | **Model** | Base or Advance | | **Created** | The creation date and time | | **Status** | Completed, Generating, or Failed | | **Download** | Button to save the audio file | The Download button will only be active for "Completed" generations that are less than 7 days old. ## Pagination Your generation history is split into multiple pages. Use the **Previous** and **Next** buttons at the bottom of the list to navigate through your older records. Go to your Generations page in the dashboard. # Text To Speech Source: https://docs.audixa.ai/features/tts The **Text-to-Speech** dashboard submits paid audio generations through Audixa's Base and Advanced models. ## The Generation Workflow 1. **Select Your Model:** Choose **Base** for its speed control or **Advanced** for `cfg_weight` and `exaggeration` controls. 2. **Choose Your Voice:** Pick from our extensive library of preset voices or use your own **Clone Voices**. 3. **Enter Your Text:** Type or paste your script. 4. **Settings (Optional):** Adjust speed, language, or advanced controls. 5. **Generate:** Create your audio. ## Model Selection You can switch between two models depending on your needs: * **Base Model:** Uses Base-compatible voices and exposes speed control. * **Advanced Model:** Uses Advanced-compatible voices and exposes guidance and expressiveness controls. Required for **Clone Voices**. ## Quick Presets To help you get started, we provide several one-click presets for common use cases: * **Casual Conversation** * **Professional Narration** * **Short Story** * **Announcement** *** ## Settings ### Voice Selection Click the voice selector to open the Voice Modal. You can filter by: * **Accent** * **Gender** (Male, Female, Neutral) * **Free Voices** The “Free Voices” label is a voice-access classification used by plan rules. It does not make a generation free. ### Base Model Settings When the Base Model is selected, you can adjust: * **Language:** Select from available languages (e.g., American English). * **Speed:** Adjust playback speed from **0.5x** to **2.0x**. ### Advanced Model Settings These settings provide granular control over the vocal performance and are only available with the Advanced Model. | Setting | Description | | :--------------- | :-------------------------------------------------------------------------------------------------------------------- | | **CFG Weight** | Controls the guidance strength (1.0 - 5.0). Higher values force the model to follow the text and style more strictly. | | **Exaggeration** | Controls the expressiveness (0.0 - 1.0). Higher values result in more dramatic emotional fluctuation. | ### Output Format Choose your preferred file format: * **MP3:** Compressed, smaller file size (standard). * **WAV:** Uncompressed output. *** ## Generating & Playing Audio Once generated, the audio player appears at the bottom. * **Waveform:** Visual representation of the audio. * **Play/Pause/Download:** Standard controls. * **History:** Your recent generations appear in the sidebar list. ## Automate with the API You can automate this entire workflow using our API. * [**API Introduction**](/api-reference/introduction) * [**Generate Speech Route**](/api-reference/tts) # AI Models Source: https://docs.audixa.ai/guides/ai-models Compare the request controls and voice compatibility of Base and Advanced Audixa accepts `base` and `advanced` as the TTS `model`. Model selection changes the compatible voice set, language-code scheme, controls, and plan rate. It does not override the requirement that `voice_id` must match the selected model. ## Base Model Base requests support: * Base-compatible system voices returned by `GET /v3/voices?model=base`. * `speed` from `0.5` to `2.0`. * Single-letter `language_code` values. * `wav` or `mp3` output. ```json theme={null} { "text": "This Base request demonstrates the documented delivery controls.", "voice_id": "am_ethan", "model": "base", "speed": 1.1, "language_code": "a", "audio_format": "mp3" } ``` ## Advanced Model Advanced requests support: * Advanced-compatible system and account-owned custom voices. * `cfg_weight` from `1.0` to `5.0`. * `exaggeration` from `0.0` to `1.0`. * Advanced model language codes such as `en`, `de`, or `ja`. * `wav` or `mp3` output. ```json theme={null} { "text": "This Advanced request demonstrates its two guidance controls.", "voice_id": "YOUR_ADVANCED_VOICE_ID", "model": "advanced", "cfg_weight": 3.5, "exaggeration": 0.7, "language_code": "en", "audio_format": "mp3" } ``` ## Side-by-Side Contract | Capability | Base | Advanced | | ------------------- | -------------------- | ------------------------------------- | | Request value | `model: "base"` | `model: "advanced"` | | Delivery controls | `speed` | `cfg_weight`, `exaggeration` | | Language codes | Single-letter scheme | Model-supported ISO-style codes | | Audio formats | `wav`, `mp3` | `wav`, `mp3` | | Compatible voices | Base voices | Advanced and compatible custom voices | | Rate and text limit | Set by current plan | Set by current plan | ## Choose a Model 1. List voices for the intended model. 2. Select a returned `voice_id`. 3. Use only controls accepted for that model. 4. Review the current rate and limits in [Billing](https://audixa.ai/app/billing) or on [Pricing](https://audixa.ai/pricing). A Base voice cannot be used with `model: "advanced"`, and an Advanced voice cannot be used with `model: "base"`. The API rejects mismatched requests. # Authentication Source: https://docs.audixa.ai/guides/authentication How to authenticate your Audixa API requests All Audixa API requests require authentication using an API key. This guide explains how to obtain and use your API key. ## Getting Your API Key Sign in to your [Audixa Dashboard](https://audixa.ai/app). Go to [Developers → API Keys](https://audixa.ai/app/developers#api-keys). Click **Create New Key**, give it a name (e.g., "Production" or "Development"), and copy the generated key. Your API key is shown only once. Store it securely immediately after creation. ## Using Your API Key Include your API key in the `x-api-key` header with every request: ```bash cURL theme={null} curl -X POST "https://api.audixa.ai/v3/tts" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{"text": "This authenticated request contains at least thirty characters.", "voice_id": "am_ethan", "model": "base", "audio_format": "mp3"}' ``` ```python Python requests theme={null} import os import requests response = requests.get( "https://api.audixa.ai/v3/voices", headers={"X-API-Key": os.environ["AUDIXA_API_KEY"]}, timeout=30, ) response.raise_for_status() ``` ```javascript JavaScript fetch theme={null} const response = await fetch('https://api.audixa.ai/v3/voices', { headers: { 'X-API-Key': process.env.AUDIXA_API_KEY } }); if (!response.ok) throw new Error(await response.text()); ``` `Authorization: Bearer YOUR_API_KEY` is also accepted. ## Security Best Practices Never expose API keys in client-side code, public repos, or logs. Store keys in environment variables, not in source code. Rotate keys periodically and immediately if compromised. Use different keys for development and production environments. ## Authentication Errors If authentication fails, the API returns a `401 Unauthorized` error: ```json 401 Unauthorized theme={null} { "detail": "Invalid or missing API key" } ``` **Common causes:** * Missing `x-api-key` header * Invalid or revoked API key * Key copied incorrectly (extra spaces, partial copy) ## Managing API Keys In the dashboard, you can: * **View keys**: See all active keys (only the last 4 characters are shown for security) * **Revoke keys**: Immediately disable compromised or unused keys * **Create new keys**: Generate additional keys for different use cases # Error Codes Source: https://docs.audixa.ai/guides/error-codes HTTP status codes and error responses from the Audixa API The Audixa API uses HTTP status codes to indicate the success or failure of requests. Endpoint-specific details can add context to the common responses below. ## Error Response Format All error responses follow a consistent JSON format: ```json theme={null} { "detail": "Human-readable error message" } ``` Some errors may include additional context: ```json theme={null} { "detail": "Validation error", "errors": [ {"field": "text", "message": "Text is required"}, {"field": "voice_id", "message": "Invalid voice ID"} ] } ``` ## HTTP Status Codes ### Success Codes | Code | Status | Description | | ----- | ------ | -------------------------------------------------------- | | `200` | OK | Request succeeded, including an accepted `POST /tts` job | ### Client Error Codes | Code | Status | Description | | ----- | -------------------- | ---------------------------------------------------------- | | `400` | Bad Request | Invalid request parameters | | `401` | Unauthorized | Missing or invalid API key | | `402` | Payment Required | Insufficient balance | | `403` | Forbidden | The active plan cannot access the requested model or voice | | `404` | Not Found | Resource not found (e.g., invalid generation\_id) | | `422` | Unprocessable Entity | Validation error | | `429` | Too Many Requests | Rate limit exceeded | ### Server Error Codes | Code | Status | Description | | ----- | --------------------- | ------------------------------- | | `500` | Internal Server Error | Unexpected server error | | `503` | Service Unavailable | Service temporarily unavailable | ### WebSocket Close Codes | Code | Description | | ------ | -------------------------------------------------------------------------------------- | | `1003` | **Invalid Payload**: The server received data it cannot accept (e.g., malformed JSON). | | `1008` | **Policy Violation**: Authentication failed (e.g., invalid API key). | | `1011` | **Internal Error**: Unexpected server condition (e.g., Redis failure). | ## Common Errors ### 400 Bad Request Returned when request parameters are missing or invalid. ```json 400 Bad Request theme={null} { "detail": "Validation error", "errors": [ {"field": "text", "message": "Text is required"}, {"field": "model", "message": "Model must be 'base' or 'advanced'"} ] } ``` **Common causes:** * Missing required fields (`text`, `voice_id`) * Invalid `model` value (must be `base` or `advanced`) * Empty text or text longer than the active plan limit * Voice and model are incompatible *** ### 401 Unauthorized Returned when authentication fails. ```json 401 Unauthorized theme={null} { "detail": "Invalid or missing API key" } ``` **Common causes:** * Missing `x-api-key` header * Invalid or revoked API key *** ### 402 Payment Required Returned when your account has insufficient balance. ```json 402 Payment Required theme={null} { "detail": "Insufficient Balance" } ``` **Solution:** Add at least \$10 or start a subscription in the [Billing Dashboard](https://audixa.ai/app/billing). *** ### 404 Not Found Returned when a requested resource doesn't exist. ```json 404 Not Found theme={null} { "detail": "Generation not found" } ``` **Common causes:** * Invalid `generation_id` when checking status * The generation belongs to another account *** ### 429 Too Many Requests Returned when you exceed the rate limit. ```json 429 Too Many Requests theme={null} { "detail": "Rate limit exceeded. Please retry after 30 seconds." } ``` **Solution:** Implement exponential backoff retry logic. See [Rate Limits](/guides/rate-limits). *** ### 500 Internal Server Error Returned when an unexpected server error occurs. ```json 500 Internal Server Error theme={null} { "detail": "An unexpected error occurred. Please try again." } ``` **Solution:** Retry the request. If the error persists, contact [support@audixa.ai](mailto:support@audixa.ai). ## Error Handling Example Handle transport errors directly, then handle the asynchronous `FAILED` status while polling: ```python Python requests theme={null} response = requests.post(API_URL, headers=headers, json=payload, timeout=30) if response.status_code == 429: retry_after = response.headers.get("Retry-After") raise RuntimeError(f"Rate limited; Retry-After={retry_after}") if response.status_code == 402: raise RuntimeError("Insufficient balance") response.raise_for_status() generation = response.json() ``` ```javascript JavaScript fetch theme={null} const response = await fetch(API_URL, options); if (response.status === 429) { throw new Error(`Rate limited; Retry-After=${response.headers.get('Retry-After')}`); } if (response.status === 402) throw new Error('Insufficient balance'); if (!response.ok) throw new Error(await response.text()); const generation = await response.json(); ``` # Pricing Source: https://docs.audixa.ai/guides/pricing Understand Audixa's paid generation, plan rates, and wallet policy Audixa uses paid, plan-based generation. There are no free generations or trial credits. You can listen to fixed samples at [audixa.ai/voices](https://audixa.ai/voices) without creating audio. ## Enable Generation Choose one of these options before generating through the dashboard or API: * Purchase a top-up of at least **\$10**. * Start a subscription that includes a monthly generation balance. See [audixa.ai/pricing](https://audixa.ai/pricing) for the currently available plans, balances, rates, limits, and commercial terms. The pricing page and your authenticated billing dashboard are the source of truth; this guide does not duplicate a static price matrix. ## How Generation Cost Works The server calculates each accepted request from: 1. The submitted text length, represented as billable tokens. 2. The selected model: `base` or `advanced`. 3. The per-token rate attached to your active plan. Short text is accepted from 1 character. TTS billing uses `ceil(max(30, character_count) / 4)`, with a minimum charge of **8 tokens** per generation. This applies to standard, dedicated, and streaming TTS, and to each message in a conversation before the existing conversation multiplier. For example, `Hi!` and a 30-character sentence both cost 8 tokens at your plan's model rate; 100 characters cost 25 tokens. The minimum affects billing only; Audixa generates the submitted text without padding it. The create-generation response includes `tokens` and `dollar_cost`. Audixa reserves the required balance when the request is accepted and restores the reserved amount if processing fails. Text length is not a guaranteed audio duration. Speaking speed, language, punctuation, voice, and model can all affect the final duration. ## Billing Order When both balances are available, Audixa uses: 1. **Monthly balance** included with the subscription. 2. **Top-up balance** purchased separately. Monthly balance resets on the subscription billing cycle and unused monthly funds do not roll over. ## Top-Up Expiry Top-up expiry depends on subscription status: * While a subscription is active, the expiry clock for remaining top-up grants is paused. * Without an active subscription, remaining top-up grants expire after **30 days**. This applies to top-ups purchased without a subscription and to funds remaining after a subscription ends. * Starting a subscription again pauses the clock on active, unexpired grants. The Billing page displays the current expiry state and the next applicable expiry date returned by the backend. ## Checking Your Balance Open [Dashboard → Billing](https://audixa.ai/app/billing) to review monthly and top-up balances, current plan facts, payments, and generation charges. ## Insufficient Balance If the available monthly and top-up balances cannot cover the request, the API returns `402 Payment Required` and does not queue the generation. ```json 402 Payment Required theme={null} { "detail": "Insufficient balance. Cost: $0.0120, wallet: $0.00, topup: $0.00" } ``` Handle the HTTP status directly rather than depending on an Audixa-specific SDK: ```python Python theme={null} response = requests.post(API_URL, headers=headers, json=payload, timeout=30) if response.status_code == 402: raise RuntimeError("Insufficient balance; open https://audixa.ai/app/billing") response.raise_for_status() ``` ```javascript JavaScript theme={null} const response = await fetch(API_URL, { method: 'POST', headers, body: JSON.stringify(payload) }); if (response.status === 402) { throw new Error('Insufficient balance; open https://audixa.ai/app/billing'); } if (!response.ok) throw new Error(await response.text()); ``` ## Adding Funds or Subscribing 1. Go to [Dashboard → Billing](https://audixa.ai/app/billing). 2. Choose a top-up of at least \$10 or select a subscription. 3. Review the displayed amount and terms, then complete checkout. Add purchased balance as needed. Its expiry follows the subscription-status policy above. Receive the monthly balance, rates, and limits shown for the selected plan. # Rate Limits Source: https://docs.audixa.ai/guides/rate-limits Handle Audixa API request and concurrency limits Audixa limits API traffic by API key and also enforces the concurrent-generation limit attached to the account plan. Limits can change, so this guide does not publish a static plan matrix. Review the active plan in [Billing](https://audixa.ai/app/billing) and the current [Pricing page](https://audixa.ai/pricing). Enterprise terms, if any, are the terms agreed for that account. ## Response Headers Rate-limited endpoints can include standard limit headers such as: | Header | Description | | ----------------------- | ------------------------------------------------- | | `X-RateLimit-Limit` | Request allowance for the current window | | `X-RateLimit-Remaining` | Requests remaining in that window | | `X-RateLimit-Reset` | When the current window resets | | `Retry-After` | Delay to observe before retrying a `429` response | Clients should tolerate a missing optional header and should not hard-code a single allowance for every endpoint. ## Handling `429 Too Many Requests` Read the response and honor `Retry-After` when present. Otherwise, use bounded exponential backoff with jitter. ```python Python theme={null} import random import time import requests def request_with_retry(method, url, *, max_retries=5, **kwargs): for attempt in range(max_retries + 1): response = requests.request(method, url, **kwargs) if response.status_code != 429: return response if attempt == max_retries: response.raise_for_status() header_delay = response.headers.get("Retry-After") delay = float(header_delay) if header_delay else min(2 ** attempt, 30) time.sleep(delay + random.random()) raise RuntimeError("Retry loop exited unexpectedly") ``` ```javascript JavaScript theme={null} async function requestWithRetry(url, options, maxRetries = 5) { for (let attempt = 0; attempt <= maxRetries; attempt += 1) { const response = await fetch(url, options); if (response.status !== 429) return response; if (attempt === maxRetries) throw new Error(await response.text()); const headerDelay = Number(response.headers.get('Retry-After')); const seconds = Number.isFinite(headerDelay) ? headerDelay : Math.min(2 ** attempt, 30) + Math.random(); await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); } } ``` ## Concurrency Errors A request can be below its HTTP request allowance and still exceed the plan's concurrent-generation limit. When this happens, wait for an existing generation to reach `COMPLETED` or `FAILED` before submitting another one. ## Best Practices Honor `Retry-After`, cap retries, and add jitter to avoid synchronized retries. Add a delay between status requests and stop at `COMPLETED` or `FAILED`. Queue work in your application instead of submitting an unbounded burst. Store the returned audio URL or your own permitted copy instead of regenerating identical input. # Voice Library Source: https://docs.audixa.ai/guides/voice-library Browse and select voices for your text-to-speech projects Audixa exposes a catalog of system and account-owned voices. This guide explains how to list voices, check model compatibility, and use a `voice_id` in an API request. ## Voice Models Audixa provides two model tiers: | Model | Description | Use Case | | ------------ | ------------------------------------------ | ---------------------------------------- | | **Base** | Voices compatible with `model: "base"` | Supports the `speed` delivery control | | **Advanced** | Voices compatible with `model: "advanced"` | Supports `cfg_weight` and `exaggeration` | ## Listing Voices via API Fetch available voices using the `/voices` endpoint: ```bash cURL theme={null} # Get Base model voices curl -X GET "https://api.audixa.ai/v3/voices?model=base" \ -H "x-api-key: YOUR_API_KEY" # Get Advanced model voices curl -X GET "https://api.audixa.ai/v3/voices?model=advanced" \ -H "x-api-key: YOUR_API_KEY" ``` ```python Python requests theme={null} import requests response = requests.get( "https://api.audixa.ai/v3/voices", headers={"X-API-Key": "YOUR_API_KEY"}, params={"model": "base"}, timeout=30, ) response.raise_for_status() for voice in response.json()["voices"]: print(f"{voice['name']} ({voice['voice_id']}) - {voice.get('accent', 'N/A')}") ``` ```javascript JavaScript fetch theme={null} const query = new URLSearchParams({ model: 'base' }); const response = await fetch(`https://api.audixa.ai/v3/voices?${query}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); if (!response.ok) throw new Error(await response.text()); const { voices } = await response.json(); for (const voice of voices) { console.log(`${voice.name} (${voice.voice_id}) - ${voice.accent ?? 'N/A'}`); } ``` The `model` query parameter is optional. Use `base` or `advanced` to filter. ## Response Format ```json Voice List Response theme={null} { "limit": 100, "offset": 0, "length": 3, "voices": [ { "voice_id": "am_ethan", "name": "Ethan", "gender": "Male", "accent": "American", "description": "Clear, professional male voice" }, { "voice_id": "af_luna", "name": "Luna", "gender": "Female", "accent": "British", "description": "Warm, friendly British female voice" } ] } ``` ## Voice Properties Each voice object includes: | Property | Type | Description | | ------------- | ------- | ----------------------------------------------------------------------------------------- | | `voice_id` | string | Unique identifier to use in `/tts` requests | | `name` | string | Human-friendly voice name | | `gender` | string | `Male` or `Female` | | `accent` | string | Voice accent/language (e.g., "American") | | `description` | string | Brief description of voice characteristics | | `free` | boolean | Internal voice-access classification used by plan rules; it does not make generation free | | `is_custom` | boolean | Whether this is your custom voice | ## Using a Voice Once you've selected a voice, use its `voice_id` in your TTS request: ```json theme={null} { "text": "Hello, this example contains enough text for a generation.", "voice_id": "am_ethan", "model": "base", "audio_format": "mp3" } ``` Make sure the `model` in your TTS request matches the model the voice belongs to. ## Custom Voices (Advanced Model) With the **Advanced** model, you can: Create a custom voice from audio samples. Control emotional tone via `exaggeration` and `cfg_weight`. Adjust expressiveness for creativity control. Create unique voices for your brand. Custom voices appear in your `/voices?model=advanced` response with `is_custom: true`. ## Voice Selection Tips 1. **Match your audience**: Choose accents that resonate with your target users 2. **Consider context**: Professional content may need authoritative voices; casual content benefits from friendly tones 3. **Preview first**: Compare the fixed samples at [audixa.ai/voices](https://audixa.ai/voices) before purchasing 4. **Validate compatibility**: Use the model returned with each voice instead of guessing ## Browse in Dashboard For fixed, pre-generated audio previews: Listen to fixed samples without custom text or a generated trial. # Welcome to Audixa Source: https://docs.audixa.ai/index Text-to-Speech REST API with plan-based billing and fixed voice previews Audixa converts text into audio through an authenticated REST API. Choose a compatible voice and model, submit a generation, and poll its status until the audio is ready. ## Key Features List the voices available to your account and filter them by compatible model. Submit work without holding a connection open, then track it with a generation ID. Integrate with standard HTTP tools such as native `fetch`, Python `requests`, or cURL. ## How It Works Audixa uses an **asynchronous workflow** for audio generation: Send non-empty text to `POST /v3/tts` with `voice_id`, `model`, and `audio_format`. Each generation is billed for at least 30 characters (8 tokens). The response includes a `generation_id` and status. Request `GET /v3/tts?generation_id=...` until the status is `COMPLETED` or `FAILED`. A completed response includes `audio_url` for the generated MP3 or WAV file. ## Preview Before You Pay Listen to the fixed samples at [audixa.ai/voices](https://audixa.ai/voices) to compare voices before purchasing. These samples use pre-generated text; they do not accept custom input and do not create a generation. Audixa does not provide free generations or trial credits. Creating audio in the dashboard or API requires either a minimum **\$10 top-up** or an active subscription. ## Get Started Create and poll your first authenticated generation. Learn how to create and protect an API key. List available voices and select one compatible with your model. Review endpoints, parameters, response fields, and errors. # Quickstart Source: https://docs.audixa.ai/quickstart Create and poll a Text-to-Speech generation with the Audixa REST API This guide uses ordinary HTTP requests. There is no Audixa SDK package to install: use native `fetch`, Python `requests`, or cURL. ## Step 1: Prepare Your Account Listen to fixed samples at [audixa.ai/voices](https://audixa.ai/voices). The sampler does not accept custom text or create free generations. Create an account, then purchase at least a **\$10 top-up** or start a subscription. Audixa does not issue trial credits or free generations. Open [Developers → API Keys](https://audixa.ai/app/developers#api-keys), create a key, and copy it when it is shown. Keep your API key secret. Do not place it in browser code shipped to end users, public repositories, logs, or support messages. ## Step 2: Choose a Runtime ```text JavaScript theme={null} Browser console or Node.js 18+ ES module (native fetch) ``` ```bash Python theme={null} python -m pip install requests ``` ```text cURL theme={null} A POSIX shell with cURL and jq ``` ## Step 3: Create and Poll a Generation `POST /v3/tts` starts an asynchronous job. The request text must contain at least **1 character**, and the maximum length depends on the active plan. Each generation has a minimum billable length of **30 characters (8 tokens)**, so shorter sentences are accepted and charged at that minimum. Poll `GET /v3/tts?generation_id=...` until the status is `COMPLETED` or `FAILED`. ```javascript JavaScript theme={null} const API_KEY = 'YOUR_API_KEY'; const API_URL = 'https://api.audixa.ai/v3/tts'; const headers = { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' }; const createResponse = await fetch(API_URL, { method: 'POST', headers, body: JSON.stringify({ text: 'Hello from Audixa. This example is long enough to generate speech.', voice_id: 'am_ethan', model: 'base', audio_format: 'mp3' }) }); if (!createResponse.ok) throw new Error(await createResponse.text()); let generation = await createResponse.json(); while (!['COMPLETED', 'FAILED'].includes(generation.status)) { await new Promise((resolve) => setTimeout(resolve, 2000)); const statusResponse = await fetch( `${API_URL}?generation_id=${encodeURIComponent(generation.generation_id)}`, { method: 'GET', headers: { 'X-API-Key': API_KEY } } ); if (!statusResponse.ok) throw new Error(await statusResponse.text()); generation = await statusResponse.json(); } if (generation.status === 'FAILED') { throw new Error(generation.error_message || 'Generation failed'); } console.log(generation.audio_url); ``` ```python Python theme={null} import time import requests API_KEY = "YOUR_API_KEY" API_URL = "https://api.audixa.ai/v3/tts" headers = {"X-API-Key": API_KEY} response = requests.post( API_URL, headers=headers, json={ "text": "Hello from Audixa. This example is long enough to generate speech.", "voice_id": "am_ethan", "model": "base", "audio_format": "mp3", }, timeout=30, ) response.raise_for_status() generation = response.json() while generation["status"] not in {"COMPLETED", "FAILED"}: time.sleep(2) response = requests.get( API_URL, headers=headers, params={"generation_id": generation["generation_id"]}, timeout=30, ) response.raise_for_status() generation = response.json() if generation["status"] == "FAILED": raise RuntimeError(generation.get("error_message") or "Generation failed") print(generation["audio_url"]) ``` ```bash cURL theme={null} #!/usr/bin/env sh set -eu API_KEY="YOUR_API_KEY" API_URL="https://api.audixa.ai/v3/tts" generation=$(curl --fail-with-body --silent --show-error \ -X POST "$API_URL" \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Hello from Audixa. This example is long enough to generate speech.", "voice_id": "am_ethan", "model": "base", "audio_format": "mp3" }') generation_id=$(printf '%s' "$generation" | jq -r '.generation_id') status=$(printf '%s' "$generation" | jq -r '.status') while [ "$status" != "COMPLETED" ] && [ "$status" != "FAILED" ]; do sleep 2 generation=$(curl --fail-with-body --silent --show-error --get \ "$API_URL" \ -H "X-API-Key: $API_KEY" \ --data-urlencode "generation_id=$generation_id") status=$(printf '%s' "$generation" | jq -r '.status') done if [ "$status" = "FAILED" ]; then printf '%s\n' "$generation" | jq -r '.error_message // "Generation failed"' >&2 exit 1 fi printf '%s\n' "$generation" | jq -r '.audio_url' ``` ```json Completed response theme={null} { "generation_id": "gen_abc123xyz789", "status": "COMPLETED", "voice_id": "am_ethan", "model": "base", "audio_url": "https://cdn.audixa.ai/audio/gen_abc123xyz789.mp3", "error_message": null } ``` ## Request Controls | Field | Requirement | | --------------- | -------------------------------------------------------------------------------------------------------------------- | | `text` | Required; at least 1 character; minimum charge is 30 characters (8 tokens); maximum length is set by the active plan | | `voice_id` | Required; must exist, be accessible, and match the selected model | | `model` | `base` or `advanced`; defaults to `base` | | `audio_format` | `wav` or `mp3`; defaults to `wav` | | `speed` | Optional delivery multiplier from `0.5` to `2.0` | | `cfg_weight` | Advanced model guidance control from `1.0` to `5.0` | | `exaggeration` | Advanced model expressiveness control from `0.0` to `1.0` | | `language_code` | Optional; accepted values depend on the model | ## Next Steps Structure the same workflow with Python `requests`. Use native `fetch` with explicit status polling. List the voice IDs available to your account. Review every accepted request and response field. # JavaScript REST Guide Source: https://docs.audixa.ai/sdks/nodejs Call the Audixa Text-to-Speech API with native fetch Audixa does not require or publish a Node.js SDK package. Node.js 18 and later include `fetch`, so you can call the REST API directly and keep the request and polling behavior visible in your application. ## Requirements * Node.js 18 or later. * An Audixa API key created in [Developers](https://audixa.ai/app/developers#api-keys). * A minimum \$10 top-up or an active subscription. Set the key in your server environment: ```bash theme={null} export AUDIXA_API_KEY="YOUR_API_KEY" ``` This is server-side code. Do not embed an API key in JavaScript delivered to a browser. ## Quick Start ```javascript JavaScript (ES module) theme={null} const API_URL = 'https://api.audixa.ai/v3/tts'; const API_KEY = process.env.AUDIXA_API_KEY; if (!API_KEY) throw new Error('AUDIXA_API_KEY is required'); const authHeaders = { 'X-API-Key': API_KEY }; async function requestJson(url, options = {}) { const response = await fetch(url, options); const body = await response.json().catch(() => ({})); if (!response.ok) { throw new Error(body.detail || `Audixa request failed (${response.status})`); } return body; } async function startTTS(payload) { return requestJson(API_URL, { method: 'POST', headers: { ...authHeaders, 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); } async function getStatus(generationId) { const query = new URLSearchParams({ generation_id: generationId }); return requestJson(`${API_URL}?${query}`, { method: 'GET', headers: authHeaders }); } async function generateTTS(payload, pollIntervalMs = 2000) { let generation = await startTTS(payload); while (!['COMPLETED', 'FAILED'].includes(generation.status)) { await new Promise((resolve) => setTimeout(resolve, pollIntervalMs)); generation = await getStatus(generation.generation_id); } if (generation.status === 'FAILED') { throw new Error(generation.error_message || 'Generation failed'); } return generation; } const generation = await generateTTS({ text: 'Hello from Audixa. This request is long enough to generate speech.', voice_id: 'am_ethan', model: 'base', audio_format: 'mp3' }); console.log(generation.audio_url); ``` ## Request Contract | Parameter | Type | Required | Description | | --------------- | -------------------- | -------- | ----------------------------------------------------------------------------------------------------------- | | `text` | `string` | Yes | At least 1 character; minimum charge is 30 characters (8 tokens); maximum length depends on the active plan | | `voice_id` | `string` | Yes | Accessible voice compatible with the selected model | | `model` | `base` or `advanced` | No | Defaults to `base` | | `audio_format` | `wav` or `mp3` | No | Defaults to `wav` | | `speed` | `number` | No | Delivery multiplier from 0.5 to 2.0 | | `cfg_weight` | `number` | No | Advanced model guidance from 1.0 to 5.0 | | `exaggeration` | `number` | No | Advanced model expressiveness from 0.0 to 1.0 | | `language_code` | `string` | No | Model-specific language code | The initial `POST` response normally has status `IN_QUEUE`. Poll the same `/tts` endpoint with `generation_id`; do not treat the create response as completed audio. ## TypeScript Types These local interfaces describe the REST fields used by the example. They are not imported from an Audixa package. ```typescript theme={null} type TTSStatus = 'IN_QUEUE' | 'GENERATING' | 'COMPLETED' | 'FAILED'; interface StartTTSRequest { text: string; voice_id: string; model?: 'base' | 'advanced'; speed?: number; cfg_weight?: number; exaggeration?: number; audio_format?: 'wav' | 'mp3'; language_code?: string; } interface TTSResponse { generation_id: string; status: TTSStatus; input_text: string; voice_id: string; voice_name?: string | null; model: 'base' | 'advanced'; tokens: number; dollar_cost?: number | null; audio_url?: string | null; error_message?: string | null; created_at: string; started_at?: string | null; completed_at?: string | null; } ``` ## List Compatible Voices ```javascript theme={null} const query = new URLSearchParams({ model: 'base', limit: '50' }); const response = await fetch(`https://api.audixa.ai/v3/voices?${query}`, { headers: authHeaders }); if (!response.ok) throw new Error(await response.text()); const { voices } = await response.json(); for (const voice of voices) { console.log(`${voice.name}: ${voice.voice_id} (${voice.model})`); } ``` ## Error Handling Check the HTTP status before consuming a success response: | HTTP status | Meaning | | -------------- | ---------------------------------------------------------- | | `400` or `422` | Invalid text, voice, model, or parameter value | | `401` | Missing or invalid API key | | `402` | Available balance cannot cover the request | | `403` | The active plan cannot access the requested voice or model | | `429` | Request or concurrency limit reached | | `500+` | Server-side failure | `FAILED` is an asynchronous generation status, not necessarily an HTTP error. Always handle both transport errors and terminal generation statuses. ## Cancellation and Timeouts Use `AbortController` for a request-level timeout chosen by your application: ```javascript theme={null} const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 30000); try { const response = await fetch('https://api.audixa.ai/v3/voices?model=base', { headers: authHeaders, signal: controller.signal }); if (!response.ok) throw new Error(await response.text()); } finally { clearTimeout(timeout); } ``` Aborting a polling request does not cancel a generation already accepted by the API. # Python REST Guide Source: https://docs.audixa.ai/sdks/python Call the Audixa Text-to-Speech API with Python requests Audixa does not require or publish a Python SDK package. This guide uses the general-purpose `requests` library against the documented REST endpoints. ## Requirements * Python 3. * An Audixa API key created in [Developers](https://audixa.ai/app/developers#api-keys). * A minimum \$10 top-up or an active subscription. ## Installation ```bash theme={null} python -m pip install requests ``` Set your API key outside the source file: ```bash theme={null} export AUDIXA_API_KEY="YOUR_API_KEY" ``` ## Quick Start ```python theme={null} import os import time import requests API_URL = "https://api.audixa.ai/v3/tts" API_KEY = os.environ["AUDIXA_API_KEY"] HEADERS = {"X-API-Key": API_KEY} def start_tts(payload): response = requests.post( API_URL, headers=HEADERS, json=payload, timeout=30, ) response.raise_for_status() return response.json() def get_status(generation_id): response = requests.get( API_URL, headers=HEADERS, params={"generation_id": generation_id}, timeout=30, ) response.raise_for_status() return response.json() def generate_tts(payload, poll_interval=2): generation = start_tts(payload) while generation["status"] not in {"COMPLETED", "FAILED"}: time.sleep(poll_interval) generation = get_status(generation["generation_id"]) if generation["status"] == "FAILED": raise RuntimeError(generation.get("error_message") or "Generation failed") return generation result = generate_tts({ "text": "Hello from Audixa. This request is long enough to generate speech.", "voice_id": "am_ethan", "model": "base", "audio_format": "mp3", }) print(result["audio_url"]) ``` ## Request Contract | Parameter | Type | Required | Description | | --------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------- | | `text` | `str` | Yes | At least 1 character; minimum charge is 30 characters (8 tokens); maximum length depends on the active plan | | `voice_id` | `str` | Yes | Accessible voice compatible with the selected model | | `model` | `str` | No | `base` or `advanced`; defaults to `base` | | `audio_format` | `str` | No | `wav` or `mp3`; defaults to `wav` | | `speed` | `float` | No | Delivery multiplier from 0.5 to 2.0 | | `cfg_weight` | `float` | No | Advanced model guidance from 1.0 to 5.0 | | `exaggeration` | `float` | No | Advanced model expressiveness from 0.0 to 1.0 | | `language_code` | `str` | No | Model-specific language code | ## Model Controls The selected voice must be compatible with the requested model. Query `GET /v3/voices?model=base` or `GET /v3/voices?model=advanced` before selecting a voice ID. ```python Base request theme={null} payload = { "text": "This Base model request demonstrates the optional speed control.", "voice_id": "am_ethan", "model": "base", "speed": 1.1, "audio_format": "wav", "language_code": "a", } ``` ```python Advanced request theme={null} payload = { "text": "This Advanced model request demonstrates its guidance controls.", "voice_id": "YOUR_ADVANCED_VOICE_ID", "model": "advanced", "cfg_weight": 3.5, "exaggeration": 0.7, "audio_format": "mp3", "language_code": "en", } ``` ## Language Codes The two models use different language-code schemes: | Code | Language | | ---- | -------------------- | | `a` | American English | | `b` | British English | | `j` | Japanese | | `z` | Mandarin Chinese | | `e` | Spanish | | `f` | French | | `h` | Hindi | | `i` | Italian | | `p` | Brazilian Portuguese | `en`, `ar`, `da`, `de`, `el`, `es`, `fi`, `fr`, `he`, `hi`, `it`, `ja`, `ko`, `ms`, `nl`, `no`, `pl`, `pt`, `ru`, `sv`, `sw`, `tr`, `zh` If `language_code` is omitted, the model uses its default language. A code from the wrong scheme can produce incorrect pronunciation. ## List Compatible Voices ```python theme={null} response = requests.get( "https://api.audixa.ai/v3/voices", headers=HEADERS, params={"model": "base", "limit": 50}, timeout=30, ) response.raise_for_status() for voice in response.json()["voices"]: print(voice["voice_id"], voice["name"], voice["model"]) ``` ## Download Completed Audio Only download after the generation status becomes `COMPLETED`: ```python theme={null} audio_response = requests.get(result["audio_url"], timeout=60) audio_response.raise_for_status() with open("output.mp3", "wb") as audio_file: audio_file.write(audio_response.content) ``` ## Error Handling ```python theme={null} try: result = generate_tts({ "text": "This request contains enough text for backend validation.", "voice_id": "am_ethan", "model": "base", "audio_format": "mp3", }) except requests.HTTPError as error: response = error.response detail = response.json().get("detail", response.text) if response.status_code == 402: print("Add funds or start a subscription:", detail) else: print(f"Audixa HTTP error {response.status_code}: {detail}") except RuntimeError as error: print("Generation reached FAILED status:", error) ``` | HTTP status | Meaning | | -------------- | ---------------------------------------------------------- | | `400` or `422` | Invalid text, voice, model, or parameter value | | `401` | Missing or invalid API key | | `402` | Available balance cannot cover the request | | `403` | The active plan cannot access the requested voice or model | | `429` | Request or concurrency limit reached | | `500+` | Server-side failure | ## Authentication Safety Keep `AUDIXA_API_KEY` in a secret manager or server environment. Do not commit it, print it, include it in exception reports, or expose it to browser code.