Documentation

Everything you need to integrate Vagary Voice into your applications

Code Examples

Get started quickly with these examples

Quick Start - Speech-to-Text

python
from vagary_voice import VagaryVoice

# Initialize client
client = VagaryVoice(api_key="your_api_key")

# Transcribe audio
result = client.transcribe(
    audio_file="audio.mp3",
    language="en-US",
    enable_diarization=True
)

print(result.transcript)
print(result.speakers)

Quick Start - Text-to-Speech

javascript
import { VagaryVoice } from '@vagary/voice-sdk';

// Initialize client
const client = new VagaryVoice({
  apiKey: process.env.VAGARY_API_KEY
});

// Synthesize speech
const audio = await client.synthesize({
  text: 'Hello from Vagary Voice!',
  voice: 'en-US-Neural-Female',
  emotion: 'friendly'
});

// Save or stream the audio
await audio.save('output.mp3');

Real-time Streaming

javascript
const stream = client.streamTranscribe({
  language: 'en-US',
  interimResults: true
});

// Handle transcripts
stream.on('transcript', (data) => {
  if (data.isFinal) {
    console.log('Final:', data.text);
  } else {
    console.log('Interim:', data.text);
  }
});

// Send audio data
microphone.on('data', (chunk) => {
  stream.write(chunk);
});

API Endpoints

Quick reference for all API endpoints

POST/v1/speech-to-text/transcribe

Transcribe audio file to text

POST/v1/text-to-speech/synthesize

Convert text to natural speech

WS/v1/stream/transcribe

Real-time streaming transcription

GET/v1/voices

List available voices

Need Help?

Our support team is here to help you succeed