NexiDub API Reference
One POST request. Full pipeline: translation, voice cloning, audio synthesis. 10 languages. Sub-2s latency. Base URL: https://neximedia.ai
Make Your First API Call
Copy this curl command, swap in your API key and target language, and you have a fully dubbed audio file in under two seconds.
curl -X POST https://neximedia.ai/api/dub \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "text": "Hello world", "source_lang": "EN", "target_lang": "ES" }'
{ "translated_text": "Hola mundo", "audio": "<base64-encoded MP3>", "duration_seconds": 1.2, "voice_cloned": false, "used": 1, "limit": 60, "plan": "pro" }
Endpoints
Translate text to a target language, synthesize speech, and optionally clone a provided voice — all in one request. Returns translated text and a base64-encoded MP3.
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | required | Source text to translate and dub. Max 2,000 characters. |
| source_lang | string | optional | Source language code. Default: EN. One of: EN FR ES DE PT AR HI ZH ID JA |
| target_lang | string | required | Target language code. Same options as source_lang. |
| audio_b64 | string | optional | Base64-encoded audio for voice cloning. WebM/Opus format. Record 5–10 seconds of clear speech. When provided, the response will use your voice for synthesis and return "voice_cloned": true. |
Health check. Returns pipeline status and current API version. No authentication required.
{ "status": "ok", "version": "1.0.0" }
HTTP Error Reference
| Status | Meaning | Action |
|---|---|---|
| 200 OK | Request successful. | Read audio, play or save the MP3. |
| 422 Unprocessable | text is empty, exceeds 2,000 chars, or an invalid language code was supplied. |
Validate input before sending. Check the detail field in the response body. |
| 429 Rate Limited | Request quota exceeded for your plan. | Check response headers: X-RateLimit-Limit and X-RateLimit-Reset (Unix timestamp). Retry after reset. |
| 503 Quota Reached | Monthly synthesis quota exhausted. | Contact our team to upgrade your plan. |
| 500 Pipeline Error | Temporary failure in translation or synthesis backend. | Retry after 5 seconds with exponential backoff. Usually self-resolves. |
Cloning Your Voice in the Browser
Use the MediaRecorder API to capture 5–10 seconds of audio, convert it to base64, then pass it as audio_b64. The pipeline will clone your voice and synthesize the dubbed audio in your timbre.
audio/webm;codecs=opus). Most Chromium-based browsers support this natively. Safari uses AAC — convert server-side if needed.
// 1. Request mic access const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); // 2. Set up recorder (WebM/Opus) const recorder = new MediaRecorder(stream, { mimeType: 'audio/webm;codecs=opus' }); const chunks = []; recorder.ondataavailable = e => chunks.push(e.data); // 3. When done — build base64 and send recorder.onstop = async () => { const blob = new Blob(chunks, { type: 'audio/webm' }); const b64 = await blobToBase64(blob); // Include as audio_b64 in your /api/dub request const res = await fetch('https://neximedia.ai/api/dub', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${YOUR_API_KEY}` }, body: JSON.stringify({ text: 'Hello world', source_lang: 'EN', target_lang: 'ES', audio_b64: b64 }) }); const data = await res.json(); }; // 4. Record for 8 seconds recorder.start(); setTimeout(() => recorder.stop(), 8000); // Helper function blobToBase64(blob) { return new Promise(r => { const fr = new FileReader(); fr.onload = () => r(fr.result.split(',')[1]); fr.readAsDataURL(blob); }); }
Playing Back the Dubbed Audio
The audio field in the response is a base64-encoded MP3. Play it directly in the browser or write it to disk in Node.js.
const audio = new Audio('data:audio/mpeg;base64,' + data.audio); audio.play();
import fs from 'fs'; const audioBuffer = Buffer.from(data.audio, 'base64'); fs.writeFileSync('output.mp3', audioBuffer); // output.mp3 is now a valid MP3 file
Rate Limits by Plan
All limits are enforced server-side. Remaining quota is returned in every response as used and limit fields.
| Plan | Limit | Window | API Key | Voice Cloning |
|---|---|---|---|---|
| Demo free | 3 requests | Per day, per IP | Not required | Not included |
| Free free | 3 requests | Per day | Required | Not included |
| Pro $29/mo | 60 requests | Per month | Required | Included |
| Business $99/mo | 300 requests | Per month | Required | Included + priority queue |
X-RateLimit-Limit (your plan ceiling) and X-RateLimit-Reset (Unix timestamp for when the window resets).
API key required for Free, Pro, and Business plans. Apply for early access to receive your key.
Supported Languages
Ten languages at launch, expanding to 30 in Q2 2026. Each language has a dedicated ElevenLabs voice model tuned for naturalness.
| Code | Language | Native Name | ElevenLabs Voice |
|---|---|---|---|
| EN | English | English | Rachel (multilingual) |
| FR | French | Français | Charlotte (multilingual) |
| ES | Spanish | Español | Matilda (multilingual) |
| DE | German | Deutsch | Callum (multilingual) |
| PT | Portuguese | Português | Bella (multilingual) |
| AR | Arabic | العربية | Aria (multilingual) |
| HI | Hindi | हिन्दी | Domi (multilingual) |
| ZH | Chinese (Mandarin) | 中文 | Elli (multilingual) |
| ID | Indonesian | Bahasa Indonesia | Josh (multilingual) |
| JA | Japanese | 日本語 | Drew (multilingual) |
API Keys & Authentication
All authenticated requests use Bearer token authentication. Tokens are Supabase JWTs issued when your account is approved.
Authorization: Bearer YOUR_API_KEY
API Changelog
audio_b64. Three-tier synthesis fallback (ElevenLabs → gTTS → silent). Full rate limit headers. Demo mode (no key, 3/day).