# Get Voices
Source: https://docs.timepay.ai/api-reference/endpoint/get-voices
GET /api/v1/get_voices
Retrieves a list of all available high-fidelity voices.
# Text to Speech
Source: https://docs.timepay.ai/api-reference/endpoint/text-to-speech
POST /api/v1/get_speech
Converts text to audio and streams the result.
# Text to Speech (Websocket)
Source: https://docs.timepay.ai/api-reference/endpoint/text-to-speech-ws
The WebSocket API provides real-time text-to-speech streaming capabilities with high-quality voice synthesis. This API uses WebSocket to deliver audio chunks as they’re generated, enabling low-latency audio playback
# Introduction
Source: https://docs.timepay.ai/api-reference/introduction
Reference documentation for the Vox API
**Base URL**: `https://api.tts.timepay.ai/api/v1`
## Welcome
Welcome to the Vox API reference. These endpoints allow you to integrate hyper-realistic, low-latency text-to-speech capabilities directly into your application.
## Authentication
All API endpoints are authenticated using Bearer tokens. You must include your API key in the header of every request.
Head over to **[timepay.ai](https://timepay.ai)** to get your API key.
```bash theme={null}
Authorization: Bearer {YOUR_API_KEY_HERE}
```
## Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
# Text to Speech (WebSocket)
Source: https://docs.timepay.ai/api-reference/websocket
Real-time streaming TTS via WebSocket for low-latency voice applications.
## Overview
The WebSocket endpoint enables real-time audio streaming with low-latency. Unlike the REST API, audio chunks are delivered as they're generated, making it ideal for:
* Live voice assistants
* Real-time call center applications
* Interactive voice response (IVR) systems
* Any application requiring immediate audio feedback
## Authentication
Pass your API key in the `Authorization` header as a Bearer token when establishing the WebSocket connection.
```javascript JavaScript theme={null}
const ws = new WebSocket('wss://api.tts.timepay.ai/api/v1/get_speech', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
```
Always use `wss://` (secure WebSocket) in production environments.
## Concurrency Model
Users can open **multiple connections**. The concurrency limit only applies when actively processing speech requests.
For example, if your plan allows 5 concurrent requests:
* You can maintain 10 open connections
* Only 5 can generate speech simultaneously
* Additional requests will throw 429 rate limit error
## Request Format
Must be `"speech"` for TTS requests.
The text to convert to speech.
The specific voice ID to use for synthesis. See available voices below.
ISO language code for the speech output.
**Supported languages:** `en`, `hi`, `mr`, `ta`, `te`, `gu`, `kn`, `ml`, `bn`, `pa`, `od`, `as`
If `true`, adds a WAV header to the audio stream for immediate playback.
Audio sample rate in Hz.
**Supported values:** `8000`, `16000`, `24000`
Playback speed multiplier. Range: `0.5` to `2.0`, where `1.0` is normal speed.
Optional custom identifier for tracking requests. Auto-generated if not provided.
### Available Voices
| Voice Name | Voice ID |
| ---------- | ---------------------- |
| Kartik | `Ogbs15oBevLzXsUuTtA1` |
| Rahul | `Owbs15oBevLzXsUurdA_` |
| Nisha | `PAbs15oBevLzXsUu4dCi` |
| Tulsi | `PQbt15oBevLzXsUuNtD3` |
| Seema | `Pgbt15oBevLzXsUubdA6` |
```json Example Request theme={null}
{
"type": "speech",
"request_id": "req_12345",
"text": "Hello, welcome to Vox.",
"voice_id": "Ogbs15oBevLzXsUuTtA1",
"language": "en",
"add_wav_header": true,
"sample_rate": 24000,
"speed": 1.0
}
```
```json Minimal Request theme={null}
{
"type": "speech",
"text": "Hello, welcome to Vox.",
"voice_id": "PAbs15oBevLzXsUu4dCi"
}
```
## Response Messages
The server sends multiple message types during a speech generation request:
### Connection Established
Sent immediately after successful authentication.
Always `"connected"`
Unique identifier for this WebSocket connection.
```json theme={null}
{
"type": "connected",
"connection_id": "conn_abc123",
"message": "Connected successfully"
}
```
### Audio Chunks
Streamed audio data. Multiple chunks are sent per request.
Always `"audio_chunk"`
The request identifier.
Zero-indexed position in the audio stream.
Base64-encoded audio data (PCM 16-bit, 24kHz mono by default).
```json theme={null}
{
"type": "audio_chunk",
"request_id": "req_12345",
"chunk_index": 0,
"data": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgA..."
}
```
### Request Complete
Signals all audio has been sent.
Always `"complete"`
The request identifier.
Total number of audio chunks sent.
Characters processed (for billing verification).
```json theme={null}
{
"type": "complete",
"request_id": "req_12345",
"total_chunks": 15,
"characters": 47
}
```
### Error
Indicates a problem with the request.
Always `"error"`
The request identifier (if available).
Error code for programmatic handling.
Human-readable error description.
```json theme={null}
{
"type": "error",
"request_id": "req_12345",
"error": "concurrency_limit_exceeded",
"message": "Maximum concurrent requests (5) exceeded"
}
```
#### Error Codes
| Code | Description |
| ---------------------------- | ----------------------------------------- |
| `invalid_request` | Malformed JSON or missing required fields |
| `invalid_voice` | Specified voice not found |
| `invalid_language` | Unsupported language code |
| `text_too_long` | Text exceeds maximum character limit |
| `concurrency_limit_exceeded` | Too many simultaneous requests |
| `insufficient_credits` | Account balance too low |
| `internal_error` | Server-side processing error |
## Complete Example
```python Python theme={null}
import websockets
async def connect():
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
async with websockets.connect(
'wss://api.tts.timepay.ai/api/v1/get_speech',
extra_headers=headers
) as ws:
# Your code here
pass
```
```javascript Node.js theme={null}
const WebSocket = require('ws');
const ws = new WebSocket('wss://api.tts.timepay.ai/api/v1/get_speech', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
```
## Best Practices
* Reuse WebSocket connections for multiple requests
* Implement automatic reconnection with exponential backoff
* Send periodic pings to keep connections alive (every 30 seconds)
* Close connections gracefully when no longer needed
* Buffer audio chunks before playback for smoother experience
* Default audio format: PCM 16-bit, 24kHz, mono
* Use Web Audio API for browser playback
* Consider using a streaming audio player for real-time playback
* Always handle the `error` message type
* Implement request timeouts (recommended: 30 seconds)
* Queue requests when concurrency limit is reached
* Log `request_id` for debugging and support
# Text to Speech — Best Practices
Source: https://docs.timepay.ai/best-practices/tts-best-practices
Learn best practices for formatting text for optimal audio generation using TimePay AI.
This guide outlines the recommended practices to ensure accurate processing, improved quality, and consistent TTS output across all use cases.
***
## Language & Script Guidelines
### **Multi-Language Code-Mixing**
Vox-v1 natively supports seamless code-mixing between English and **12 Indic languages**—all in their native scripts.
**Rules:**
* English → **Latin script**
* Indic languages → **Native script only**
***
### **Supported Languages & Examples**
| Language | Script | Example |
| --------- | ------------ | -------------------------------------------------------- |
| Hindi | Devanagari | "आपका payment अभी तक नहीं आया, please check करें" |
| Tamil | Tamil | "நேத்து call பண்ணேன், but you didn't pick up" |
| Telugu | Telugu | "మీ order இன்னும் ship అవ్వలేదు, tomorrow expect చేయండి" |
| Kannada | Kannada | "ನಿಮ್ಮ account ಲಿ balance ಇಲ್ಲ, please recharge ಮಾಡಿ" |
| Malayalam | Malayalam | "ഞാൻ already message അയച്ചു, didn't you see it?" |
| Bengali | Bengali | "আপনার bill টা due হয়ে গেছে, please pay করুন" |
| Gujarati | Gujarati | "તમારું appointment આવતીકાલે છે, please confirm કરો" |
| Marathi | Devanagari | "तुमचा OTP expire झाला, resend करा please" |
| Punjabi | Gurmukhi | "ਤੁਹਾਡੀ delivery ਅੱਜ ਆ ਜਾਵੇਗੀ, be available please" |
| Odia | Odia | "ଆପଣଙ୍କ request process ହେଉଛି, please wait କରନ୍ତୁ" |
| Assamese | Assamese | "আপোনাৰ payment successful হৈছে, thank you!" |
| Urdu | Perso-Arabic | "آپ کا balance کم ہے، please recharge کریں" |
***
### **Complex Multi-Script Example**
A single sentence mixing multiple languages:
```
நேத்து call பண்ணினா, ਉਹने pick ही नहीं ਕੀਤਾ, பின்னெ ഞാൻ വെറുതെ കാത്തിരുന്നു!
```
*(Tamil + English + Punjabi + Hindi + Malayalam — all native scripts)*
***
### **Why Native Scripts Matter**
* ✅ Accurate pronunciation & intonation
* ✅ Proper syllable stress
* ✅ Natural-sounding speech
***
## Handling Numbers
### **Order IDs & Large Numbers**
* Send as **separate requests**
```
✅ "Your order id is one two three four five six seven eight nine zero"
❌ "Your order id is 1234567890"
```
### **Phone Numbers**
Default reading: **3-4-3 pattern**
```
9876543210 → "987-6543-210"
```
#### Custom Reading
```
✅ "double nine triple eight double seven double six"
❌ "9988877766"
```
***
## Date & Time Formatting
### **Accepted Date Formats**
```
12/02/2025 → twelve, two, twenty twenty-five
12-02-2025 → twelve, two, twenty twenty-five
```
**Incorrect**
```
31/12/2002
30-06-24
21st of June, 2003
12.02.2025
```
***
### **Time Formats**
```
14:30 → fourteen thirty
14:30:15 → fourteen thirty fifteen
```
**Incorrect**
```
14:30
14.30
7'5 AM
```
***
## Mathematical Expressions
Always write in full words:
```
✅ two plus three equals five
❌ 2+3=5
✅ five multiplied by three equals fifteen
❌ 5x3=15
✅ square root of sixteen equals four
❌ √16=4
```
***
## Approximate Values
```
✅ approximately twenty minutes
❌ ~20 mins
✅ around 500 people attended
❌ ~500 people attended
```
***
## Units & Measurements
```
✅ five kilometers
❌ 5km
✅ twenty kilograms of rice
❌ 20kg
✅ thirty degrees Celsius
❌ 30°C
✅ 5 feet 6 inches tall
❌ 5'6"
```
***
## Symbols & Special Characters
Spell out all special characters:
```
. → dot
@ → at
_ → underscore
- → dash
/ → forward slash
# → hashtag
& → and
```
***
## Digital Content Formatting
### **URLs**
```
✅ visit docs dot example dot com forward slash guide
❌ docs.example.com/guide
```
### **Email**
```
✅ support dot company at gmail dot com
❌ support.company@gmail.com
```
### **Social Media**
```
✅ at company underscore name
❌ @company_name
✅ hashtag trending now
❌ #TrendingNow
```
***
## Range & Interval Notation
```
✅ five to eight days
❌ 5-8 days
✅ between ten and fifteen minutes
❌ 10-15 minutes
❌ temperatures 20-30°
```
***
## Notes
* Consistency is critical
* Write in full words whenever possible
* Break complex URLs or numbers into smaller chunks
* Avoid symbols that may have multiple interpretations
# Speed & Emotion
Source: https://docs.timepay.ai/controllability/speed-&-emotion
Reference guide for controlling speech emotion, nonverbals, and speed.
## Emotions
Wrap your text in specific emotion tags to guide the tone of the generation.
**Vox interprets these parameters as guidance** instead of as strict adjustments to ensure natural speech, so we recommend testing them against your content to ensure the output matches your expectations.
| Emotion | Syntax |
| :----------- | :------------------------------- |
| **Netural** | `Text here` |
| **Angry** | `Text here` |
| **Shouting** | `Text here` |
| **Laughing** | `Text here` |
| **Sad** | `Text here` |
| **Whisper** | `Text here` |
| **Excited** | `Text here` |
| **Confused** | `Text here` |
For netural emotion, don't place any tag around the text.
The tag should wrap the entire sentence, not just part of it.
**Examples:**
```xml theme={null}
Wrong ❌: - I'm so frustrated with this delay right now.
Correct ✅: - I'm so frustrated with this delay right now.
```
**Examples:**
```xml theme={null}
I told you specifically not to touch that!
Don't make a sound, they might hear us.
I can't believe we actually won!
It's hard to say goodbye after all this time.
```
## Nonverbalisms
Insert specific non-speech sounds into the transcript using these standalone tags.
| Sound | Tag |
| :---------- | :---------- |
| **Cough** | `[cough]` |
| **Yawn** | `[yawn]` |
| **Sniffle** | `[sniffle]` |
| **Sigh** | `[sigh]` |
**Examples:**
```xml theme={null}
I think [cough] I'm coming down with a cold.
Alright [sigh], let's try this one more time.
It's just so beautiful... [sniffle]
I stayed up way too [yawn] late last night.
```
## Speed Control
Control the pacing of specific sections by wrapping the text in speed tags.
| Speed | Syntax |
| :------- | :----------------------- |
| **Slow** | `Text here` |
| **Fast** | `Text here` |
**Examples:**
```xml theme={null}
The secret code is... A... B... C...
Terms and conditions apply void where prohibited.
```
***
# Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
# Authentication
Source: https://docs.timepay.ai/getting-started/authentication
Learn how to authenticate your API requests and manage access keys securely.
## API Keys
Vox uses API keys to authenticate requests. You must include your key in the header of every API request to verify your identity and track usage against your quota.
Each API key allows us to enforce:
* **Rate Limits:** Controls the number of requests allowed within a specific timeframe.
* **Credit Quota:** Defines the maximum usage credits available for your account.
**Keep your key safe!** Your API key is confidential. Never share it with others or expose it in client-side code (browsers, mobile apps) or public repositories like GitHub.
## Making Requests
All API requests require your key in the `Authorization` header using the **Bearer** YOUR\_API\_KEY\_HERE format:
```bash theme={null}
Authorization: Bearer YOUR_API_KEY_HERE
```
### Example Request
You can test your authentication setup by fetching the list of available voices. Replace `YOUR_API_KEY_HERE` with the key found in your dashboard.
```bash cURL theme={null}
curl "https://api.tts.timepay.ai/api/v1/get_voices" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_HERE"
```
## Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
# Quickstart
Source: https://docs.timepay.ai/getting-started/quickstart
Generate your first speech in under 2 minutes.
Welcome to the Vox platform! This guide will help you generate your first hyper-realistic audio using the Vox API.
## Prerequisites
1. Visit [vox.timepay.ai](https://vox.timepay.ai) and sign up for an account.
2. Navigate to the **API Keys** tab.
3. Create a new API Key and copy it immediately.
It is best practice to keep your key secure. Export it in your terminal:
```bash theme={null}
export TIMEPAY_API_KEY="YOUR_API_KEY_HERE"
```
## Generate Speech
Since Vox is designed for flexibility, you can interact with the API using any standard HTTP client.
**Note on Streaming:** The endpoint streams audio data in chunks to ensure ultra-low latency. The examples below demonstrate how to capture this stream and save it to a file.
```bash cURL theme={null}
curl -X POST "https://api.tts.timepay.ai/api/v1/get_speech" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world! This is Vox speaking.",
"voice_id": "khvTFYgvagfvagvfuavdf",
"language": "en",
"add_wav_header": true,
"speed":1.0,
"sample_rate": 24000
}' \
--output output.wav
```
## Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
# Introduction
Source: https://docs.timepay.ai/index
Vox delivers hyper-realistic text-to-speech at lightning speed.
## Meet Vox
Welcome to [**Vox**](https://timepay.ai), the next-generation platform for real-time, lifelike speech synthesis.
Our infrastructure is built on advanced AI models designed to provide seamless, human-quality audio. Whether you are building voicebots, interactive IVR systems, or accessibility tools, Vox ensures your application speaks naturally.
## Why Vox?
Our flagship TTS model delivering human-quality speech with industry-leading clarity and naturalness.
Express joy, empathy, urgency, and calm—AI voices that feel genuinely human and contextually aware.
10+ indic languages and accents with native fluency. Engage audiences worldwide in their mother tongue.
Sub-150ms response times engineered for real-time conversations and live customer interactions.
***
## Community & Support
### Enterprise Inquiries
Building at scale? Contact our sales team directly at [support@timepay.ai](mailto:support@timepay.ai) for enterprise solutions.
### Developer Resources
Join the conversation and find the help you need.
Deep dives, implementation tutorials, and product updates.
Have a technical question? Reach out to our support team.
# Pricing & Plans
Source: https://docs.timepay.ai/pricing-&-plans/pricing
Choose the plan that best fits your needs. All plans include access to our high-quality Indian voice models with ultra-low latency.
## Plans Overview
| Plan | Price | Characters | Minutes | Concurrency | Support |
| ------------ | ------------- | ---------- | -------- | ----------- | ----------------- |
| **Free** | ₹0/month | 10K | \~100 | 2 | Community |
| **Starter** | ₹1050/month | 300K | \~300 | 5 | Community |
| **Pro** | ₹10,000/month | 3M | \~3,000 | 10 | Email |
| **Business** | ₹50,000/month | 18M | \~18,000 | 20 | Email + Dedicated |
***
## Plan Details
### Free Plan — ₹0/month
Perfect for getting started and exploring our API.
| Feature | Included |
| ----------------- | ---------------------------------------------- |
| Characters | 10,000 |
| Minutes (approx.) | \~10 |
| Concurrency | 2 simultaneous requests |
| Support | Community |
| **Ideal For** | Individual developers, prototyping, evaluation |
**Includes:**
* Access to all standard voice models
* Playground Access
* Community Discord support
* Basic documentation
***
### Starter Plan — ₹1050/month
For individual developers ready to build and deploy.
| Feature | Included |
| ----------------- | -------------------------------------------------- |
| Characters | 300,000 |
| Minutes (approx.) | \~300 |
| Concurrency | 5 simultaneous requests |
| Support | Community |
| **Ideal For** | Individual developers, prototyping, small projects |
**Includes:**
* Everything in Free, plus:
* 50× more characters than Free
* Higher concurrency for better throughput
* Commercial use permitted
***
### Pro Plan — ₹10,000/month
Built for startups and growing applications.
| Feature | Included |
| ----------------- | ------------------------------------------ |
| Characters | 3,000,000 (6M) |
| Minutes (approx.) | \~3,000 |
| Concurrency | 10 simultaneous requests |
| Support | Email |
| **Ideal For** | Startups, POCs, medium-volume applications |
**Includes:**
* Everything in Starter, plus:
* 12× more characters than Starter
* Priority email support
* Higher rate limits
* Ideal for production workloads
***
### Business Plan — ₹50,000/month
For scaling businesses with high-volume requirements.
| Feature | Included |
| ----------------- | ------------------------------------------- |
| Characters | 18,000,000 (18M) |
| Minutes (approx.) | \~18,000 |
| Concurrency | 20 simultaneous requests |
| Support | Email + Dedicated Support |
| **Ideal For** | Scaling businesses, enterprise applications |
**Includes:**
* Everything in Pro, plus:
* 2.5× more characters than Pro
* Dedicated account support
* Highest concurrency limits
* Priority feature requests
***
## Need More?
**Enterprise & Custom Plans**
For organizations with requirements beyond our Business plan, we offer custom solutions:
* **Custom character limits** tailored to your volume
* **Higher concurrency** for massive scale
* **SLA guarantees** for mission-critical applications
* **Dedicated infrastructure** options
* **Custom voice development**
* **On-premise deployment** (coming soon)
📧 **Contact us:** [support@timepay.ai](mailto:support@timepay.ai)
***
## Understanding Our Metrics
### Characters
Characters are the primary unit of measurement. Every character in your input text (including spaces and punctuation) counts toward your monthly limit.
**Example:**
```
"Hello, welcome to our service!" = 31 characters
```
### Minutes
Minutes are an approximate estimate based on average speech rate. Actual duration may vary based on:
* Voice model selected
* Speech speed settings
* Content type (numbers, abbreviations, etc.)
### Concurrency
Concurrency refers to the number of simultaneous API requests you can make. Higher concurrency means:
* Faster batch processing
* Better user experience for real-time applications
* Ability to serve more end-users simultaneously
***
## Frequently Asked Questions
### What happens when I exceed my character limit?
Once you reach your monthly character limit, API requests will return an error until your limit resets at the start of your next billing cycle. We recommend upgrading your plan or purchasing additional characters if you consistently hit your limits.
### Can I upgrade or downgrade my plan?
Yes! You can change your plan at any time from your dashboard.
* **Upgrading:** Takes effect immediately. You'll be charged the prorated difference for the remainder of the billing period.
* **Downgrading:** Takes effect at the start of your next billing cycle. You'll continue to enjoy your current plan's benefits until then.
### Do unused characters roll over?
Currently, unused characters do not roll over to the next month. Each billing cycle starts fresh with your plan's full character allocation.
### Is there a free trial for paid plans?
The Free plan serves as your trial — you can explore all features with 10K characters before committing to a paid plan. No credit card required.
### What payment methods do you accept?
We accept:
* Credit/Debit Cards (Visa, Mastercard, Rupay)
* UPI
### Do you offer annual billing?
Yes! Save up to 20% with annual billing. Contact us for annual plan pricing.
***
## Compare Plans
| Feature | Free | Starter | Pro | Business |
| --------------------- | ---- | ------- | ------- | -------- |
| **Monthly Price** | ₹0 | ₹1050 | ₹10,000 | ₹50,000 |
| **Characters** | 10K | 300K | 3M | 18M |
| **Minutes (approx.)** | \~10 | \~3,00 | \~3,000 | \~18,000 |
| **Concurrency** | 2 | 5 | 10 | 20 |
| **API Access** | ✗ | ✓ | ✓ | ✓ |
| **All Voice Models** | ✓ | ✓ | ✓ | ✓ |
| **Commercial Use** | ✗ | ✓ | ✓ | ✓ |
| **Community Support** | ✓ | ✓ | ✓ | ✓ |
| **Email Support** | ✗ | ✗ | ✓ | ✓ |
| **Dedicated Support** | ✗ | ✗ | ✗ | ✓ |
| **Priority Features** | ✗ | ✗ | ✗ | ✓ |
***
## Getting Started
1. **Sign up** for a free account
2. **Get your API key** from the dashboard
3. **Make your first request** using our quickstart guide
4. **Upgrade** when you need more capacity
```bash cURL theme={null}
curl -X POST "https://api.tts.timepay.ai/api/v1/get_speech" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world! This is Vox speaking.",
"voice_id": "khvTFYgvagfvagvfuavdf",
"language": "en",
"add_wav_header": true,
"speed":1.0,
"sample_rate": 24000
}' \
--output output.wav
```
***
# Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
***
*Prices are in Indian Rupees (INR) and exclude applicable taxes. Plans are billed monthly unless otherwise specified.*
# Get Available Voices
Source: https://docs.timepay.ai/text-to-speech/get-voices
Learn how to retrieve available voices.
The VoxVoice API allows you to fetch a list of all available voices that can be used for Text-to-Speech generation.
***
## Endpoint
### **GET `/api/v1/get_voices`**
Fetches all available voices.
#### **Headers**
```bash theme={null}
Authorization: Bearer {YOUR_API_KEY_HERE}
```
## Response
```json theme={null}
{
"success": true,
"voices": [
{
"name": "Kartik",
"description": "Warm, steady, and confident male voice suitable for banking.",
"languages": [
"English",
"Hindi"
],
"gender": "male"
}
]
}
```
* `success`: Boolean indicating request status
* `voices`: Array of voice objects
# Example — Fetch Voices (Node.js)
```javascript theme={null}
async function getVoices() {
const res = await fetch("https://timepay.ai/api/v1/get_voices", {
headers: {
Authorization: "Bearer YOUR_API_KEY_HERE"
}
});
const data = await res.json();
console.log(data);
}
getVoices();
```
## Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
# How to use Text to Speech
Source: https://docs.timepay.ai/text-to-speech/tts-index
Learn how to synthesize your text using the Vox AI API.
In this tutorial, you will learn how to use the Vox platform to synthesize text to speech both synchronously and asynchronously. By the end of this tutorial, you will be able to convert text into speech using our API.
***
## Requirements
Before you begin, ensure you have:
* Nodejs
* A Vox API Key
* Basic understanding of HTTP and JSON
***
## API Endpoint
### **POST `/api/v1/get_speech`**
Generates and streams speech audio.
#### **Headers**
```bash theme={null}
Authorization: Bearer {YOUR_API_KEY_HERE}
Content-Type: application/json
```
#### **Body**
```json theme={null}
{
"text": "Text to convert to speech",
"voice_id": "khvTFYgvagfvagvfuavdf",
"language": "en",
"add_wav_header": true,
"speed":1.0,
"sample_rate": 24000
}
```
#### **Response**
* Streams **audio/wav bytes**
* Headers include:
* `X-Request-ID`
***
# Sample cURL request
Below is a synchronous example using Python + `requests`.
```bash theme={null}
curl -X POST "https://api.tts.timepay.ai/api/v1/get_speech" \
-H "Authorization: Bearer $YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world! This is Vox speaking.",
"voice_id": "khvTFYgvagfvagvfuavdf",
"language": "en",
"add_wav_header": true,
"speed":1.0,
"sample_rate": 24000
}' \
--output output.wav
```
***
# Parameters
| Parameter | Type | Default | Description |
| ---------------- | -------------- | -------- | ----------------- |
| `text` | string | required | Text to convert |
| `voice_id` | string | required | Select voice |
| `language` | string | `"en"` | Language code |
| `sample_rate` | number | `24000` | Audio sample rate |
| `speed` | number (float) | `1.0` | Audio sample rate |
| `add_wav_header` | boolean | `true` | Adds WAV header |
***
# Need Help?
If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).