DevelopmentDecember 3, 20245 min read

LangVoice Python SDK: Complete Developer Guide

Comprehensive guide to the LangVoice Python SDK. Installation, basic usage, async operations, and AI agent integrations.

LT

LangVoice Team

Engineering

LangVoice Python SDK: Complete Developer Guide

LangVoice Python SDK: Complete Guide

Everything you need to use LangVoice in Python.

Installation

pip install langvoice-sdk

Basic Usage

from langvoice_sdk import LangVoiceClient

client = LangVoiceClient(api_key="your-api-key")

# Generate speech
response = client.generate(
    text="Hello, world!",
    voice="heart",
    language="american_english"
)

# Save to file
response.save("hello.mp3")

Available Voices

# List all voices
voices = client.get_voices()
for voice in voices:
    print(f"{voice.name}: {voice.description}")

28+ voices including: Heart, Emma, Michael, James, Sarah, Emily...

Multi-Voice Conversations

script = """
[heart] Welcome to our podcast!
[michael] Thanks for having me.
[heart] Let's dive into today's topic.
"""

response = client.generate_multi_voice(
    text=script,
    language="american_english"
)

Async Operations

import asyncio
from langvoice_sdk import AsyncLangVoiceClient

async def generate_audio():
    client = AsyncLangVoiceClient(api_key="your-key")
    
    response = await client.generate(
        text="Hello async!",
        voice="heart"
    )
    
    return response

audio = asyncio.run(generate_audio())

AI Agent Integration

from langvoice_sdk.tools.langchain_tools import LangVoiceLangChainToolkit

toolkit = LangVoiceLangChainToolkit(api_key="your-key")
tools = toolkit.get_tools()

Get started with the LangVoice Python SDK today!

Tags

Python SDKLangVoicedeveloper guideAPItext to speechpip install

Ready to Transform Your Text to Speech?

Try LangVoice free and experience the most natural AI voices for your content.

Try LangVoice Free

Related Articles

The Complete Guide to AI Voice Generators in 2024
Guide

The Complete Guide to AI Voice Generators in 2024

Discover how AI voice technology has evolved and learn how to choose the best text-to-speech solution for your needs. From podcasts to audiobooks, AI voices are revolutionizing content creation.