DocsQuickstart

Quickstart

Your first TTS request in 2 minutes

1. Get Your API Key

  1. Sign in to your dashboard
  2. Go to the API tab
  3. Click Create Key
  4. Copy your key (starts with tts_)
Save your key now — you won't see it again.

2. Make Your First Request

curl
curl -X POST https://aitts.theproductivepixel.com/api/v1/tts \
  -H "Authorization: Bearer tts_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world!", "voice": "google:en-US-Chirp3-HD-Charon", "model_type": "premium"}'
Python
import requests

response = requests.post(
    "https://aitts.theproductivepixel.com/api/v1/tts",
    headers={"Authorization": "Bearer tts_YOUR_KEY"},
    json={
        "text": "Hello world!",
        "voice": "google:en-US-Chirp3-HD-Charon",
        "model_type": "premium"
    }
)
data = response.json()["data"]
print(f"Job ID: {data['job_id']}")
Node.js
const response = await fetch("https://aitts.theproductivepixel.com/api/v1/tts", {
  method: "POST",
  headers: {
    "Authorization": "Bearer tts_YOUR_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "Hello world!",
    voice: "google:en-US-Chirp3-HD-Charon",
    model_type: "premium"
  })
});
const { data } = await response.json();
console.log(`Job ID: ${data.job_id}`);

3. Poll for Completion

The API returns immediately with a job_id. Poll until status is completed:

curl https://aitts.theproductivepixel.com/api/v1/tts/YOUR_JOB_ID \
  -H "Authorization: Bearer tts_YOUR_KEY"

Response when processing:

{
  "success": true,
  "data": {
    "job_id": "...",
    "status": "processing"
  }
}

Response when ready:

{
  "success": true,
  "data": {
    "job_id": "...",
    "status": "completed",
    "audio_url": "https://storage.googleapis.com/...",
    "chars_charged": 12
  }
}

4. Download Your Audio

curl -o output.wav "AUDIO_URL_FROM_RESPONSE"

Done. The audio_url is a signed URL valid for 24 hours.

Complete Python Example

import requests
import time

API_KEY = "tts_YOUR_KEY"
BASE = "https://aitts.theproductivepixel.com/api/v1"

# 1. Submit job
resp = requests.post(
    f"{BASE}/tts",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"text": "Hello world!", "voice": "google:en-US-Chirp3-HD-Charon", "model_type": "premium"}
)
job_id = resp.json()["data"]["job_id"]
print(f"Job submitted: {job_id}")

# 2. Poll until complete
while True:
    status = requests.get(
        f"{BASE}/tts/{job_id}",
        headers={"Authorization": f"Bearer {API_KEY}"}
    ).json()["data"]
    
    if status["status"] == "completed":
        print(f"Audio ready: {status['audio_url']}")
        break
    elif status["status"] == "failed":
        print(f"Failed: {status.get('error')}")
        break
    
    time.sleep(1)  # Poll every second
Back to Documentation

© 2026 AI TTS Microservice. All rights reserved.