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.

ElevenLabs Scribe v2 is a high-accuracy batch speech-to-text model with built-in speaker diarization, word-level timestamps, and multichannel audio support. It integrates with the portable Generate::transcription() API using Content::audio() to supply the audio, while ElevenLabs-specific controls are passed through providerOptions('elevenlabs', [...]).

Installation

composer require aisdk/elevenlabs
Configure the provider with your API key:
use AiSdk\ElevenLabs;

ElevenLabs::create([
    'apiKey' => 'xi-...',
]);

Basic Usage

Pass a local file path to Content::audio(), select the scribe_v2 model, and call .run(). The result exposes the transcript text and detected language directly on the output object.
use AiSdk\Content;
use AiSdk\ElevenLabs;
use AiSdk\Generate;

$result = Generate::transcription(Content::audio(__DIR__ . '/meeting.mp3'))
    ->model(ElevenLabs::model('scribe_v2'))
    ->providerOptions('elevenlabs', [
        'language_code' => 'en',
        'diarize'       => true,
    ])
    ->run();

echo $result->output->text;      // Full transcript text
echo $result->output->language;  // Detected language code, e.g. "en"

Remote URL Transcription

When Content::audio() receives an HTTPS URL, the adapter automatically sends it as a source_url multipart field instead of uploading the file. No manual option is required.
use AiSdk\Content;
use AiSdk\ElevenLabs;
use AiSdk\Generate;

$result = Generate::transcription(
        Content::audio('https://cdn.example.com/call.mp3')
    )
    ->model(ElevenLabs::model('scribe_v2'))
    ->providerOptions('elevenlabs', [
        'language_code' => 'en',
    ])
    ->run();

echo $result->output->text;
enable_logging is sent as a URL query parameter (?enable_logging=false), not as a multipart form field. The adapter handles this routing automatically — simply include it in providerOptions like any other field.

Provider Options

language_code
string
A BCP-47 language code hint (e.g. en, fr, de-DE). Providing a hint speeds up transcription and can improve accuracy for accented speech. When omitted, Scribe v2 auto-detects the language.
diarize
boolean
Enable speaker diarization. When true, each word in $result->output->segments includes a speaker identifier string such as "speaker_0".
keyterms
array
An array of domain-specific words or phrases that Scribe should recognize with higher priority. Useful for product names, technical vocabulary, and proper nouns.
'keyterms' => ['PHP AI SDK', 'ElevenLabs', 'Scribe'],
use_multi_channel
boolean
Enable multichannel transcription. Each channel is transcribed independently. Segments in the result carry a speaker value equal to the channel index ("0", "1", etc.).
enable_logging
boolean
When false, ElevenLabs does not store the request in your history. Sent as a URL query parameter, not a multipart field.

Word-Level Segments

When diarize is enabled, or when the API returns word-level timing, $result->output->segments contains one TranscriptSegment per word with its start time, end time, and speaker label.
use AiSdk\Content;
use AiSdk\ElevenLabs;
use AiSdk\Generate;

$result = Generate::transcription(Content::audio(__DIR__ . '/interview.mp3'))
    ->model(ElevenLabs::model('scribe_v2'))
    ->providerOptions('elevenlabs', [
        'diarize' => true,
    ])
    ->run();

foreach ($result->output->segments as $segment) {
    printf(
        "[%s] %.2f–%.2f  %s\n",
        $segment->speaker ?? 'unknown',
        $segment->start,
        $segment->end,
        $segment->text,
    );
}

TranscriptionResponse Output Shape

PropertyTypeDescription
$result->output->textstringFull transcript as a single string
$result->output->languagestring|nullBCP-47 language code detected by Scribe
$result->output->segmentsTranscriptSegment[]Word-level segments (empty when no word data is returned)
Each TranscriptSegment exposes:
PropertyTypeDescription
textstringThe word or token text
startfloatStart time in seconds
endfloatEnd time in seconds
speakerstring|nullSpeaker ID (diarization) or channel index (multichannel)

Multichannel Transcription

For recordings with separate audio channels — such as two-party call recordings — set use_multi_channel to true. ElevenLabs transcribes each channel independently and returns the results in a transcripts array. The adapter merges them into the standard output shape, and each segment’s speaker value reflects the channel index.
use AiSdk\Content;
use AiSdk\ElevenLabs;
use AiSdk\Generate;

$result = Generate::transcription(
        Content::audio('https://cdn.example.com/call.mp3')
    )
    ->model(ElevenLabs::model('scribe_v2'))
    ->providerOptions('elevenlabs', [
        'use_multi_channel' => true,
    ])
    ->run();

// Combined transcript from all channels
echo $result->output->text;

// Per-word segments with channel index as speaker label
foreach ($result->output->segments as $segment) {
    // $segment->speaker is "0" or "1" (channel index)
    echo "[channel {$segment->speaker}] {$segment->text}\n";
}

Full Example

use AiSdk\Content;
use AiSdk\ElevenLabs;
use AiSdk\Generate;

$result = Generate::transcription(Content::audio(__DIR__ . '/meeting.mp3'))
    ->model(ElevenLabs::model('scribe_v2'))
    ->providerOptions('elevenlabs', [
        'language_code'  => 'en',
        'diarize'        => true,
        'keyterms'       => ['PHP', 'AI SDK', 'ElevenLabs'],
        'enable_logging' => false,
    ])
    ->run();

echo "Transcript:\n{$result->output->text}\n\n";
echo "Language: {$result->output->language}\n\n";

echo "Word-level segments:\n";
foreach ($result->output->segments as $segment) {
    printf(
        "[%s] %.2fs–%.2fs: %s\n",
        $segment->speaker ?? 'unknown',
        $segment->start,
        $segment->end,
        $segment->text,
    );
}

Build docs developers (and LLMs) love