Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/phpaisdk/elevenlabs/llms.txt

Use this file to discover all available pages before exploring further.

aisdk/elevenlabs is the official ElevenLabs provider for the PHP AI SDK. It brings ElevenLabs’ full generative-media surface — speech synthesis, batch and realtime transcription, voice transformation, music composition, sound effects, dialogue generation, dubbing, and forced alignment — into the portable, interface-driven SDK model so you can use a single consistent API across all of it.
This package requires PHP ^8.3 and aisdk/core ^0.8.0. Install it with Composer: composer require aisdk/elevenlabs.

Capabilities

The package is divided into two groups: core SDK capabilities that integrate with the standard Generate and Live interfaces, and provider-owned media services that expose ElevenLabs-specific creative APIs directly.

Installation

Install aisdk/elevenlabs via Composer and optionally add aisdk/transport for realtime WebSocket transcription.

Configuration

Configure the provider with ELEVENLABS_API_KEY, an optional base URL override, and custom request headers.

Speech

Generate audio from text using any ElevenLabs TTS model (e.g. eleven_flash_v2_5, eleven_v3). Supports voice settings, output formats, and all documented provider options.

Transcription

Transcribe audio files using Scribe v2 (scribe_v2). Supports language hints, speaker diarization, and all ElevenLabs transcription options.

Realtime Transcription

Stream audio over WebSocket to Scribe v2 Realtime (scribe_v2_realtime) using the core Live::transcribe() API with partial and committed transcript events.

Voice Changer

Convert uploaded audio to a target voice with optional background-noise removal using ElevenLabs::voiceChanger().

Voice Isolator

Remove background noise and isolate the primary voice from any audio file using ElevenLabs::voiceIsolator().

Voice Design

Generate voice previews from a text description, remix an existing voice, and save a selected preview as a permanent usable voice.

Music

Compose music from a text prompt, generate from a plan, produce detailed output with timestamps, convert video to music, upload source audio, and separate stems.

Sound Effects

Generate short audio effects from a text description using ElevenLabs::soundEffects().

Dialogue

Produce multi-speaker dialogue audio from an array of text-and-voice-ID turns, with optional character alignment and per-voice segment timestamps.

Dubbing

Create asynchronous dubbing jobs from local or URL-backed media, poll job status, and retrieve dubbed output and SRT/VTT transcripts.

Forced Alignment

Align supplied audio against a known transcript to obtain precise word-level start and end timestamps.

Access Patterns

The package exposes two equivalent access patterns. You can use either or both in the same application.

Static Facade — ElevenLabs::

ElevenLabs is a static facade that manages a single default ElevenLabsProvider instance. It is the quickest way to get started because the provider is lazily created from environment variables the first time any static method is called.
use AiSdk\ElevenLabs;
use AiSdk\Generate;

// Lazily resolved from ELEVENLABS_API_KEY
$result = Generate::speech('Hello from the static facade.')
    ->model(ElevenLabs::model('eleven_flash_v2_5'))
    ->voice('JBFqnCBsd6RMkjVDRZzb')
    ->run();

$result->output->save(__DIR__ . '/speech.mp3');

// Media services are available the same way
$effect = ElevenLabs::soundEffects()->generate('A wooden door slowly creaking open.');

Provider Instance — ElevenLabsProvider

ElevenLabs::create() returns an ElevenLabsProvider instance and simultaneously registers it as the static default. Use the instance directly when you need explicit configuration control, want to manage multiple providers, or are working in a dependency-injection container.
use AiSdk\ElevenLabs;
use AiSdk\Generate;

$provider = ElevenLabs::create([
    'apiKey'  => 'xi-...',
    'baseUrl' => 'https://api.elevenlabs.io/v1',
    'headers' => ['X-Custom-Header' => 'value'],
]);

// Use the instance directly
$music = $provider->music()->compose('A warm acoustic intro.');

// The static facade now resolves to the same instance
$sameResource = ElevenLabs::music();
Both patterns share the same ElevenLabsOptions configuration and produce identical HTTP requests. The static facade is a thin delegation layer over the underlying provider instance.

What Is Included and What Is Not

This package deliberately stays on the direct generative-media surface of the ElevenLabs API.
Included: TTS, batch STT, and realtime Scribe; voice changer, isolation, design, and remixing; music generation and direct music transforms; sound effects and text-to-dialogue; dubbing creation and result retrieval; forced alignment.Deliberately excluded: ElevenAgents and its telephony/runtime management APIs; voice-library browsing, cloning/training, and general voice CRUD; music finetune, asset/history, and marketplace management; Studio, Audio Native, Flows, and project/editor management; Dubbing Studio resource editing, listing, and deletion; account, workspace, API-key, billing, analytics, and administrative APIs.Saving a generated voice preview is included because it is the required second step of the Voice Design and Remix APIs. Pronunciation-dictionary management, AI-audio detection, human production services, and HTTP streaming variants of otherwise one-shot media endpoints are outside this package surface. Core realtime transcription remains fully supported through Live::transcribe().

Build docs developers (and LLMs) love