c.ai

Free API Documentation

Integrate cvoice.ai's free AI voice generation into your applications with our simple REST API — no usage limits, no cost.

🚀 Quick Start

  1. Create an API key from your dashboard
  2. Find a voice ID from our voice dataset
  3. Make a POST request to /api/tts

🎤 Finding Voice IDs

We provide two public JSON datasets, generated during our build process and updated regularly:

📦 Characters Dataset

dataset_search.json

20,000+ characters with names, occupations, countries, and voice counts

🎵 Voices Dataset

dataset_voices.json

All voice IDs grouped by character username (use this for TTS)

Characters Dataset Structure

// dataset_search.json - Characters
[
  {
    "id": 234322812,
    "name": "Jungkook",
    "username": "jungkook",
    "image_url": "https://static.cvoice.ai/profiles/jungkook.jpg",
    "avatar": true,
    "occupations": ["Pop Singer"],
    "country": "South Korea",
    "birth_year": 1997,
    "voice_count": 89,
    "fame_score": 5
  }
  // ... +20,000 more characters
]

Voices Dataset Structure

// dataset_voices.json - Voice IDs by character
{
  "jungkook": [
    {
      "voice_id": "00a77add-48d0-4088-b16b-695e5bd0fb73",
      "name": "Jungkook Official",
      "curated": true,
      "preview_url": "https://static.cvoice.ai/voices/00a77add.mp3"
    },
    {
      "voice_id": "uuid-456",
      "name": "Jungkook Voice 2",
      "curated": false,
      "preview_url": "https://static.cvoice.ai/voices/uuid-456.mp3"
    }
    // ... 87 more voices
  ],
  "barack-obama": [
    {
      "voice_id": "uuid-789",
      "name": "Obama Official",
      "curated": true,
      "preview_url": "https://static.cvoice.ai/voices/uuid-789.mp3"
    }
  ]
  // ... 20,000+ more characters
}

Example: Finding and Using Voices

// Step 1: Find a character
const characters = await fetch('https://cvoice.ai/dataset_search.json')
  .then(r => r.json());

const obama = characters.find(c =>
  c.name.toLowerCase().includes('obama')
);

console.log('Character:', obama.name);
console.log('Username:', obama.username); // "barack-obama"
console.log('Available voices:', obama.voice_count);

// Step 2: Get voices for this character
const voicesMap = await fetch('https://cvoice.ai/dataset_voices.json')
  .then(r => r.json());

const voices = voicesMap[obama.username];
console.log('First voice ID:', voices[0].voice_id);
console.log('Is curated:', voices[0].curated);

// Step 3: Generate audio with the voice
const ttsResponse = await fetch('https://cvoice.ai/api/tts', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'cvai_your_api_key_here'
  },
  body: JSON.stringify({
    voice_id: voices[0].voice_id,
    text: 'Yes we can! This is a test of AI voice generation.'
  })
});

const { url } = await ttsResponse.json();
console.log('Audio URL:', url);

💡 Tip: Cache the dataset locally to avoid fetching it on every request. It updates when we deploy new characters.

🔐 Authentication

Include your API key in the request header:

X-API-Key: cvai_your_api_key_here

🎯 Text-to-Speech Endpoint

POST /api/tts

Generate AI voice audio from text

Request Body

Field Type Required Description
voice_id string Required The voice ID from dataset
text string Required Text to convert (50-500 chars)
person_slug string Optional Character slug (for history display)
person_name string Optional Character name (for history display)

Response

{
  "url": "https://static.cvoice.ai/tts/voice_id/hash.mp3"
}

📝 Code Examples

🔧 cURL
curl -X POST https://cvoice.ai/api/tts \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cvai_your_api_key_here" \
  -d '{
    "voice_id": "00a77add-48d0-4088-b16b-695e5bd0fb73",
    "text": "Hello! This is a sample text for AI voice generation using cvoice.ai API."
  }'
JavaScript / Node.js
const response = await fetch('https://cvoice.ai/api/tts', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'cvai_your_api_key_here'
  },
  body: JSON.stringify({
    voice_id: '00a77add-48d0-4088-b16b-695e5bd0fb73',
    text: 'Hello! This is a sample text for AI voice generation.'
  })
});

const data = await response.json();
console.log('Audio URL:', data.url);
Python
import requests

response = requests.post(
    'https://cvoice.ai/api/tts',
    headers={
        'Content-Type': 'application/json',
        'X-API-Key': 'cvai_your_api_key_here'
    },
    json={
        'voice_id': '00a77add-48d0-4088-b16b-695e5bd0fb73',
        'text': 'Hello! This is a sample text for AI voice generation.'
    }
)

data = response.json()
print('Audio URL:', data['url'])
PHP
<?php
$ch = curl_init('https://cvoice.ai/api/tts');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'X-API-Key: cvai_your_api_key_here'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'voice_id' => '00a77add-48d0-4088-b16b-695e5bd0fb73',
    'text' => 'Hello! This is a sample text for AI voice generation.'
]));

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo 'Audio URL: ' . $data['url'];

⚡ Rate Limits

The cvoice.ai API is completely free — no usage limits, no paid tiers, no credit card required. We believe text-to-speech should be accessible to everyone.

Limit Value Price
Per Minute 10 requests Free
Daily 1,000 requests Free

Need higher limits? Contact us — we're happy to help, still free of charge.

⚠️ Error Codes

Status Code Description
400 Bad request (invalid parameters)
401 Unauthorized (invalid or missing API key)
429 Rate limit exceeded
500 Internal server error

✨ Best Practices

💾 Cache the Voice Dataset

Download /dataset_search.json once and cache it locally. It only changes when we deploy new characters.

🔁 Handle Rate Limits

Implement exponential backoff when you receive 429 errors. Check the response headers for retry timing.

🎵 Cache Generated Audio

Same voice_id + text always returns the same audio URL. Cache on your end to reduce API calls.

🔒 Keep Your API Key Secret

Never expose your API key in client-side code. Make API calls from your backend server only.

💬 Support

Need help? Have questions? Contact us at our support page or email support@cvoice.ai