Home/AI Agents/elevenlabs-python
elevenlabs-python logo

elevenlabs-python

Enrichment pending
elevenlabs/elevenlabs-python

The official Python SDK for the ElevenLabs API.

GraphCanon updated today · GitHub synced today

3.0k
Stars
423
Forks
16
Open issues
51
Watchers
2d
Last push
Python MITCreated Mar 26, 2023

Trust & integrity

Full report
Maintenance
Very active (2d since push)
As of today · Source: github_public_v1
Provenance
Not a fork · Organization account
As of today · Source: github_public_v1
Security (OSV)
24 low (24 low)
As of today · Source: osv@v1

Public GitHub metadata and optional OSV dependency scans. Signals, not a guarantee. Trust methodology.

Overview

The official Python SDK for the ElevenLabs API.

Capability facts

Languages
python

Source: github.language+pyproject.toml · Jul 11, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Jul 11, 2026)

```python import asyncio
Source link

Tags

README

Install

pip install elevenlabs

Quick Start

import asyncio
from openai import AsyncOpenAI
from elevenlabs import AsyncElevenLabs

openai_client = AsyncOpenAI()
elevenlabs = AsyncElevenLabs()

async def main():
    engine = await elevenlabs.speech_engine.get("seng_123")

    async def on_transcript(transcript, session):
        stream = await openai_client.responses.create(
            model="gpt-4o",
            input=[
                {"role": "assistant" if m.role == "agent" else m.role, "content": m.content}
                for m in transcript
            ],
            stream=True,
        )
        await session.send_response(stream)

    async def on_init(conversation_id, session):
        print(f"Session started: {conversation_id}")

    async def on_close(session):
        print(f"Session ended: {session.conversation_id}")

    async def on_error(err, session):
        print(f"Error: {err}")

    await engine.serve(
        port=3001,
        debug=True,
        on_init=on_init,
        on_transcript=on_transcript,
        on_close=on_close,
        on_error=on_error,
    )

asyncio.run(main())