API documentation

REST + streaming APIs for text-to-speech, voice cloning, and real-time voice generation. SDKs for Python and Node.js.

Introduction

The aivoices.in API is a REST API for generating AI voice audio in 10+ Indian languages. All endpoints return JSON responses and accept JSON request bodies. Audio is returned as URL references or binary streams depending on the endpoint.

Base URL: https://api.aivoices.in/v1

Authentication

All API requests require a bearer token in the Authorization header. Get your API key from the dashboard.

Authorization: Bearer YOUR_API_KEY

Quickstart

Generate a Hindi voiceover in one HTTP request:

curl -X POST https://api.aivoices.in/v1/tts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "नमस्ते, यह एक AI आवाज़ है।",
    "voice": "priya",
    "language": "hi",
    "format": "mp3"
  }'

POST /tts

Generate audio from text.

Request body:

  • text (string, required) — text to synthesize. Max 5000 characters.
  • voice (string, required) — voice ID from /voices.
  • language (string, required) — language code (hi, te, ta, bn, mr, kn, ml, gu, pa, ur, en).
  • format (string, optional) — mp3, wav, ogg, flac. Default mp3.
  • speed (float, optional) — 0.5 to 2.0. Default 1.0.
  • pitch (float, optional) — -1.0 to 1.0. Default 0.
  • sample_rate (int, optional) — 8000, 16000, 24000, 44100, 48000. Default 24000.

Response:

{
  "id": "tts_abc123",
  "audio_url": "https://cdn.aivoices.in/audio/abc123.mp3",
  "duration_seconds": 12.4,
  "characters": 34,
  "credits_used": 34
}

GET /voices

List all available voices, optionally filtered by language.

curl https://api.aivoices.in/v1/voices?language=hi \
  -H "Authorization: Bearer YOUR_API_KEY"

POST /voice-clone

Create a custom voice model from reference audio. Enterprise plan only.

curl -X POST https://api.aivoices.in/v1/voice-clone \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "name=My Brand Voice" \
  -F "language=hi" \
  -F "reference_audio=@reference.wav" \
  -F "consent_document=@consent.pdf"

Streaming TTS (WebSocket)

Real-time streaming for low-latency applications. Connect to wss://api.aivoices.in/v1/stream, authenticate, and stream text chunks; receive audio chunks in return with sub-200ms first-byte latency.

Error codes

  • 400 — Invalid request body
  • 401 — Missing or invalid API key
  • 402 — Quota exceeded or payment required
  • 429 — Rate limit exceeded
  • 500 — Server error (retry with exponential backoff)

Rate limits

Free: 10 requests/minute. Pro: 60 requests/minute + 10,000 requests/month. Enterprise: negotiated per contract.

SDKs

Official SDKs available for Python (pip install aivoices) and Node.js (npm install aivoices). Community SDKs exist for Go, Ruby, and PHP. Full source and examples are documented in the developer portal — request access.

Ready to build?

Sign up for a Pro plan to get your API key, or contact us for Enterprise access.

Get API Access ▶