Scripts2026年3月29日·1 分钟阅读

ElevenLabs Python SDK — AI Text-to-Speech

Official ElevenLabs Python SDK for AI voice generation. Create realistic voiceovers with 30+ languages, voice cloning, and streaming support.

TO
TokRepo精选 · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

pip install elevenlabs
from elevenlabs import ElevenLabs

client = ElevenLabs(api_key="your_key")
audio = client.text_to_speech.convert(
    text="Hello world, this is a test.",
    voice_id="JBFqnCBsd6RMkjVDRZzb",
    model_id="eleven_multilingual_v2",
)
with open("output.mp3", "wb") as f:
    for chunk in audio:
        f.write(chunk)

介绍

The official ElevenLabs Python SDK for AI voice generation. Create realistic voiceovers in 30+ languages with emotion control, voice cloning, and real-time streaming. The go-to TTS service for video production pipelines — used by Remotion, podcast creators, and content automation tools.

Best for: Video narration, podcast production, content automation, voice cloning Works with: Python 3.8+, any audio/video pipeline Setup time: 2 minutes (needs API key from elevenlabs.io)


Key Features

  • 30+ languages with natural prosody
  • Voice cloning from audio samples
  • Emotion control via text markup
  • Real-time streaming for interactive use
  • Multiple models: Multilingual v2, Turbo v2.5, Flash

Streaming Audio

from elevenlabs import ElevenLabs, play

client = ElevenLabs()
audio_stream = client.text_to_speech.convert_as_stream(
    text="Streaming audio in real time.",
    voice_id="JBFqnCBsd6RMkjVDRZzb",
)
play(audio_stream)

Voice Cloning

voice = client.clone(
    name="My Voice",
    files=["sample1.mp3", "sample2.mp3"],
)

FAQ

Q: What is ElevenLabs? A: An AI text-to-speech platform with the most realistic voice generation available. The Python SDK provides programmatic access to voice generation, cloning, and streaming.

Q: Is ElevenLabs free? A: Free tier includes 10,000 characters/month. Paid plans start at $5/month for 30,000 characters.


🙏

来源与感谢

Created by ElevenLabs. Licensed under MIT. elevenlabs-python — ⭐ 3,000+ elevenlabs.io

相关资产