🔌 TTS Integrations
YourVoic's MCP server allows you to harness the power of our generative AI voice technology directly within MCP-compatible clients, such as Claude Desktop.
This integration provides a seamless workflow for developers and creators to generate high-quality, lifelike speech for their projects. With access to over 250 voices in more than 50 languages and a wide array of speaking styles, you can bring your text to life without ever leaving your development environment.
Key Features #
- Seamless Integration: Works directly with MCP clients like Claude Desktop, Cursor, and more.
- Vast Voice Library: Access to YourVoic's complete collection of 250+ AI voices.
- Multi-Language Support: Generate speech in 50+ languages with native accents.
- Customization: Control pitch, speed, and style to match your needs.
- Multiple Models: Choose from Aura Prime, Aura Standard, and Helium for different use cases.
yourvoic-mcp
The official YourVoic MCP Server
Installation #
Choose your preferred installation method. Both TypeScript and Python versions are available.
Claude Desktop
To use the YourVoic MCP server with Claude Desktop, add the following configuration to your
claude_desktop_config.json file:
{
"mcpServers": {
"yourvoic": {
"command": "npx",
"args": ["-y", "@yourvoic/mcp-server"],
"env": {
"YOURVOIC_API_KEY": "your-api-key-here"
}
}
}
}
-y flag automatically confirms the npx installation prompt.
Make sure you have Node.js 18+ installed.
{
"mcpServers": {
"yourvoic": {
"command": "python",
"args": ["/path/to/yourvoic_mcp.py"],
"env": {
"YOURVOIC_API_KEY": "your-api-key-here"
}
}
}
}
First, install the required Python packages:
pip install mcp httpx
Configuration File Location
| Platform | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Usage #
Once configured, you can use the YourVoic MCP server directly in Claude Desktop by asking Claude to generate speech.
Example Prompts
"Generate speech saying 'Hello, welcome to our platform!' using the Peter voice"
"List all available English voices"
"Create audio for this paragraph in German with the Helga voice"
"Check my YourVoic API usage"
Webhooks #
Webhooks allow you to receive real-time notifications when events occur in your YourVoic account. Perfect for automation workflows with n8n, Zapier, Make.com, and custom integrations.
Setup
Configure webhooks in your API Dashboard Settings:
- Go to Settings → Webhooks tab
- Enable webhooks and enter your endpoint URL
- Generate a webhook secret for signature verification
- Select which events you want to receive
- Click "Test Webhook" to verify your endpoint
Available Events
| Event | Description |
|---|---|
tts.completed |
Audio generation completed successfully |
tts.failed |
Audio generation failed |
credits.low |
Credit balance is running low |
credits.added |
Credits were added to your account |
quota.warning |
Approaching monthly quota limit |
quota.exceeded |
Monthly quota has been exceeded |
Webhook Payload
{
"event": "tts.completed",
"timestamp": "2025-11-27T10:30:00Z",
"data": {
"request_id": "req_abc123",
"text": "Hello, this is a test.",
"voice": "Peter",
"model": "aura-prime",
"language": "en-US",
"characters": 23,
"audio_url": "https://yourvoic.com/api/audio/abc123.mp3",
"duration_ms": 1500
}
}
Signature Verification
All webhooks include an X-Webhook-Signature header containing an HMAC SHA256 signature.
Verify this signature to ensure the webhook came from YourVoic.
import hmac
import hashlib
def verify_webhook(payload: bytes, signature: str, secret: str) -> bool:
expected = hmac.new(
secret.encode(),
payload,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)
Automation Platforms #
Integrate YourVoic TTS into your automation workflows using popular no-code/low-code platforms.
n8n
Use the HTTP Request node in n8n to call the YourVoic API. For AI agent workflows, use
response_format: "json" to get a JSON response with base64-encoded audio.
"response_format": "json" to get a JSON response
with base64 audio data that can be easily used in downstream nodes.
Option 1: Binary Response (Download Audio File)
Returns raw audio bytes - good for saving files.
{
"text": "Hello, this is a test!",
"voice": "Peter",
"model": "aura-prime",
"output_format": "mp3"
}
Option 2: JSON Response (For AI Agents) ⭐
Returns JSON with base64 audio - perfect for AI agents and automation workflows.
{
"text": "Hello, this is a test!",
"voice": "Peter",
"model": "aura-prime",
"output_format": "mp3",
"response_format": "json"
}
JSON Response Structure
{
"success": true,
"request_id": "abc123-def456",
"audio": {
"data": "base64-encoded-audio...",
"format": "mp3",
"mime_type": "audio/mpeg",
"size_bytes": 12345,
"data_uri": "data:audio/mpeg;base64,..."
},
"metadata": {
"text": "Hello, this is a test!",
"voice": "Peter",
"model": "aura-prime",
"characters_used": 24,
"credits_used": 5,
"processing_time_ms": 150
}
}
n8n Setup Steps
- Method: POST
- URL:
https://yourvoic.com/api/v1/tts/generate - Authentication: Header Auth
- Header Name:
X-API-Key - Header Value: Your API key (get from dashboard)
- Body Content Type: JSON
- Body: Use the JSON above with
response_format: "json"
Using the Audio in n8n
- Play in browser: Use
{{ $json.audio.data_uri }}as audio src - Pass to next node: Access base64 data via
{{ $json.audio.data }} - Get audio size:
{{ $json.audio.size_bytes }} - Credits used:
{{ $json.metadata.credits_used }}
Option 3: Real-Time Streaming 🔴
For real-time voice applications, use the streaming endpoint to receive audio chunks as they're generated. Ideal for conversational AI, live voice assistants, and low-latency applications.
{
"text": "Hello, this is a streaming test!",
"voice": "Peter",
"model": "aura-prime"
}
Streaming Setup
- Method: POST
- URL:
https://yourvoic.com/api/v1/tts/stream - Header:
X-API-Key: your-api-key - Body: JSON with text, voice, and model
aura-lite,aura-prime,aura-max→ Returns raw PCM audio (24kHz, 16-bit, mono)rapid-max→ Returns OGG Opus encoded audio
Try it live: Real-Time Streaming Test Page →
Zapier
Create a Zap using the "Webhooks by Zapier" action with a custom request.
- Add "Webhooks by Zapier" as an action
- Select "Custom Request"
- Set Method to POST
- URL:
https://yourvoic.com/api/v1/tts/generate - Add header:
X-API-Key: your-api-key - Configure the JSON body with your text and voice settings
Make.com (Integromat)
Use the HTTP module to make API requests to YourVoic.
{
"url": "https://yourvoic.com/api/v1/tts/generate",
"method": "POST",
"headers": [
{ "name": "X-API-Key", "value": "your-api-key" },
{ "name": "Content-Type", "value": "application/json" }
],
"body": {
"text": "Your text here",
"voice": "Peter",
"model": "aura-prime",
"language": "en-US"
}
}
Voice AI Platforms #
Build real-time voice AI applications with streaming TTS capabilities.
Pipecat
Integrate YourVoic as a TTS service in your Pipecat voice agent pipeline.
import httpx
from pipecat.services.tts import TTSService
class YourVoicTTS(TTSService):
def __init__(self, api_key: str, voice: str = "Peter"):
self.api_key = api_key
self.voice = voice
self.base_url = "https://yourvoic.com/api/v1"
async def synthesize(self, text: str) -> bytes:
async with httpx.AsyncClient() as client:
response = await client.post(
f"{self.base_url}/tts/generate",
headers={"X-API-Key": self.api_key},
json={
"text": text,
"voice": self.voice,
"model": "aura-prime",
"output_format": "mp3"
}
)
return response.content
# Usage in pipeline
tts = YourVoicTTS(api_key="your-key", voice="Peter")
LiveKit
Use YourVoic TTS with LiveKit for real-time audio streaming in your applications.
from livekit.agents import tts
import httpx
class YourVoicTTSPlugin(tts.TTS):
def __init__(self, api_key: str):
self.api_key = api_key
async def synthesize(self, text: str) -> tts.SynthesizedAudio:
async with httpx.AsyncClient() as client:
response = await client.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": self.api_key},
json={"text": text, "voice": "Peter"}
)
return tts.SynthesizedAudio(
audio=response.content,
sample_rate=24000
)
Telephony #
Integrate YourVoic TTS into telephony systems for IVR, call centers, and voice assistants.
Asterisk PBX
YourVoic TTS integrates with Asterisk PBX through multiple approaches: AGI scripts, ARI (REST API), or dialplan applications. Perfect for dynamic IVR systems, announcements, and voice menus.
Method 1: AGI Script
Use an AGI script to fetch TTS audio and play it to callers. This is the most common approach.
#!/usr/bin/env python3
"""YourVoic TTS AGI Script for Asterisk"""
import sys
import os
import requests
import hashlib
import tempfile
# Configuration
API_KEY = "your-api-key"
API_URL = "https://yourvoic.com/api/v1/tts/generate"
CACHE_DIR = "/var/lib/asterisk/sounds/tts-cache"
def agi_command(cmd):
"""Send AGI command and get response"""
sys.stdout.write(f"{cmd}\n")
sys.stdout.flush()
return sys.stdin.readline().strip()
def generate_tts(text, voice="Peter", language="en-US"):
"""Generate TTS audio and cache it"""
# Create cache filename based on text hash
text_hash = hashlib.md5(f"{text}{voice}{language}".encode()).hexdigest()
cache_file = os.path.join(CACHE_DIR, f"{text_hash}")
wav_file = f"{cache_file}.wav"
# Return cached file if exists
if os.path.exists(wav_file):
return cache_file
# Generate new audio
response = requests.post(API_URL,
headers={"X-API-Key": API_KEY},
json={
"text": text,
"voice": voice,
"model": "aura-prime",
"language": language,
"output_format": "wav",
"sample_rate": 8000 # Telephony standard
}
)
if response.status_code == 200:
os.makedirs(CACHE_DIR, exist_ok=True)
with open(wav_file, 'wb') as f:
f.write(response.content)
return cache_file
return None
def main():
# Read AGI environment
env = {}
while True:
line = sys.stdin.readline().strip()
if not line:
break
if ':' in line:
key, value = line.split(':', 1)
env[key.strip()] = value.strip()
# Get text from AGI argument
text = env.get('agi_arg_1', 'Hello, welcome to YourVoic.')
voice = env.get('agi_arg_2', 'Peter')
language = env.get('agi_arg_3', 'en-US')
# Generate TTS
audio_file = generate_tts(text, voice, language)
if audio_file:
# Play the audio
agi_command(f"STREAM FILE {audio_file} #")
else:
agi_command("VERBOSE \"TTS generation failed\" 1")
if __name__ == "__main__":
main()
Dialplan Configuration
[ivr-menu]
; Simple IVR with dynamic TTS
exten => s,1,Answer()
same => n,AGI(yourvoic_tts.py,"Welcome to our company. Press 1 for sales, 2 for support.","Peter","en-US")
same => n,WaitExten(5)
exten => 1,1,AGI(yourvoic_tts.py,"Connecting you to sales.","Peter","en-US")
same => n,Dial(SIP/sales)
exten => 2,1,AGI(yourvoic_tts.py,"Connecting you to support.","Peter","en-US")
same => n,Dial(SIP/support)
; Dynamic announcement
[announcements]
exten => _X.,1,Answer()
same => n,Set(MESSAGE=${ODBC_GET_ANNOUNCEMENT(${EXTEN})})
same => n,AGI(yourvoic_tts.py,"${MESSAGE}","Peter","en-US")
same => n,Hangup()
Method 2: ARI (Asterisk REST Interface)
For more complex applications, use ARI with external media playback.
import ari
import requests
import tempfile
import os
# ARI connection
client = ari.connect('http://localhost:8088', 'asterisk', 'asterisk')
YOURVOIC_API_KEY = "your-api-key"
SOUNDS_DIR = "/var/lib/asterisk/sounds"
def generate_and_play_tts(channel, text, voice="Peter"):
"""Generate TTS and play to channel"""
# Generate audio via YourVoic API
response = requests.post(
"https://yourvoic.com/api/v1/tts/generate",
headers={"X-API-Key": YOURVOIC_API_KEY},
json={
"text": text,
"voice": voice,
"model": "aura-prime",
"output_format": "wav",
"sample_rate": 8000
}
)
if response.status_code == 200:
# Save to Asterisk sounds directory
filename = f"tts_{channel.id}"
filepath = os.path.join(SOUNDS_DIR, f"{filename}.wav")
with open(filepath, 'wb') as f:
f.write(response.content)
# Play using ARI
playback = channel.play(media=f'sound:{filename}')
playback.on_event('PlaybackFinished', lambda p, e: cleanup(filepath))
return playback
return None
def cleanup(filepath):
"""Remove temporary audio file"""
try:
os.remove(filepath)
except:
pass
def stasis_start_cb(channel, ev):
"""Handle incoming channel"""
channel.answer()
generate_and_play_tts(channel, "Welcome to our IVR powered by YourVoic.")
client.on_channel_event('StasisStart', stasis_start_cb)
client.run(apps='yourvoic-tts')
Audio Format Requirements
"sample_rate": 8000 and
"output_format": "wav" for standard telephony. For HD voice, use 16000 Hz.
| Use Case | Sample Rate | Format |
|---|---|---|
| Standard PSTN/SIP | 8000 Hz | WAV (PCM 16-bit) |
| HD Voice (G.722) | 16000 Hz | WAV (PCM 16-bit) |
| WebRTC / Opus | 24000 Hz | WAV or MP3 |
FreeSWITCH
Integrate YourVoic TTS with FreeSWITCH using mod_http_cache or Lua scripts.
-- YourVoic TTS for FreeSWITCH
local api_key = "your-api-key"
local api_url = "https://yourvoic.com/api/v1/tts/generate"
local cache_dir = "/var/lib/freeswitch/sounds/tts-cache/"
function yourvoic_tts(session, text, voice, language)
voice = voice or "Peter"
language = language or "en-US"
-- Create cache filename
local hash = session:md5(text .. voice .. language)
local cache_file = cache_dir .. hash .. ".wav"
-- Check cache
local f = io.open(cache_file, "r")
if f then
f:close()
else
-- Generate via API
local cmd = string.format(
'curl -s -X POST "%s" -H "X-API-Key: %s" -H "Content-Type: application/json" ' ..
'-d \'{"text":"%s","voice":"%s","language":"%s","model":"aura-prime",' ..
'"output_format":"wav","sample_rate":8000}\' -o "%s"',
api_url, api_key, text, voice, language, cache_file
)
os.execute(cmd)
end
-- Play audio
session:streamFile(cache_file)
end
-- Usage in dialplan XML:
-- <action application="lua" data="yourvoic_tts.lua 'Hello world' Peter en-US"/>
Troubleshooting #
Common Issues
- Invalid API Key: Verify your API key in the YourVoic dashboard
- Rate Limited: Check your plan's rate limits and wait before retrying
- Webhook not receiving: Ensure your endpoint is publicly accessible and returns 200 OK
- Audio format issues: Use
output_format: "mp3"for best compatibility