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.

Voice Design is a two-step workflow for creating entirely new AI voices. In the first step you submit a natural-language description of the voice character you want and ElevenLabs generates several audio previews for you to evaluate. In the second step you select the preview you prefer and save it as a named, reusable voice in your ElevenLabs workspace. That saved voice then carries a permanent voice ID you can pass to any other SDK operation, including Generate::speech(). An optional remix operation lets you take an eligible existing voice and generate variations of it based on a description — the previews are then saved in exactly the same way.

Step-by-step flow

1

Design: generate previews

Call ElevenLabs::voiceDesign()->design() with a text description of the voice you want. ElevenLabs returns a VoiceDesignResult containing an array of audio previews along with any sample text that was auto-generated for the previews.
use AiSdk\ElevenLabs;

$design = ElevenLabs::voiceDesign()->design(
    'A warm, expressive documentary narrator with measured pacing.',
    [
        'model_id'           => 'eleven_ttv_v3',
        'auto_generate_text' => true,
    ],
);
Each preview in $design->previews is a VoicePreview with its own generatedVoiceId and audio content. Listen to each one to decide which to keep:
foreach ($design->previews as $preview) {
    $preview->audio->save(__DIR__.'/preview-'.$preview->generatedVoiceId.'.mp3');
}

// The sample text spoken in all previews
echo $design->text;
2

Save: turn a preview into a reusable voice

Once you have identified the preview you want to keep, pass its generatedVoiceId to ElevenLabs::voiceDesign()->create() along with a display name and description. The method returns a CreatedVoice whose id property is the permanent voice ID.
$voice = ElevenLabs::voiceDesign()->create(
    generatedVoiceId: $design->previews[0]->generatedVoiceId,
    name: 'Documentary Narrator',
    description: 'Warm and expressive with measured pacing.',
);

echo $voice->id; // Use this voice ID in Generate::speech()

Design and remix options

The $options array accepted by both design() and remix() supports the following fields. The $description string argument is sent to ElevenLabs under the voice_description JSON key; any voice_description key you also include in $options will override it.
model_id
string
The text-to-voice model to use. ElevenLabs recommends eleven_ttv_v3 for the highest quality voice generation results.
auto_generate_text
boolean
When true, ElevenLabs automatically generates a sample text passage for the previews. Set to false to supply your own text via the text field.
output_format
string
The desired audio format for the preview files returned in the response. Automatically extracted from $options and sent as a query parameter instead of a body field. Examples: mp3_44100_128, wav_44100.
output_format is silently removed from the JSON body and appended to the request URL as a query parameter. All other keys in $options are sent in the request body.

Create options

create() also accepts an optional $options array. Any keys supplied there are merged into the JSON body alongside generated_voice_id, voice_name, and voice_description. The $name and $description arguments map to the voice_name and voice_description JSON keys respectively; keys in $options override them when the same name is present in both.

Remix an existing voice

Use remix() to generate variations of an eligible existing voice based on a new description. The return type and save flow are identical to design().
use AiSdk\ElevenLabs;

$remix = ElevenLabs::voiceDesign()->remix(
    'JBFqnCBsd6RMkjVDRZzb',
    'Same voice but softer, more intimate tone.',
);

// Save the previews and listen
foreach ($remix->previews as $preview) {
    $preview->audio->save(__DIR__.'/remix-'.$preview->generatedVoiceId.'.mp3');
}

// Save the chosen preview as a new voice
$voice = ElevenLabs::voiceDesign()->create(
    generatedVoiceId: $remix->previews[0]->generatedVoiceId,
    name: 'Intimate Narrator',
    description: 'Softer, more intimate variation of the original.',
);

echo $voice->id;

Return types

VoiceDesignResult

Returned by both design() and remix().
previews
VoicePreview[]
An array of voice previews generated from the description. Each entry is a VoicePreview — see below.
text
string
The sample text that was spoken in all previews. When auto_generate_text is true this is filled in by ElevenLabs; otherwise it reflects the text you supplied.
rawResponse
array
The full decoded JSON response from ElevenLabs for advanced inspection.

VoicePreview

generatedVoiceId
string
A temporary identifier for this specific generated preview. Pass this to create() to save the preview as a permanent voice.
audio
AudioData
The preview audio decoded from the base-64 response.
language
string|null
The language of the audio preview when returned by ElevenLabs.

CreatedVoice

Returned by create().
id
string
The permanent ElevenLabs voice ID. Use this value anywhere a voice ID is accepted.
name
string
The display name assigned to the voice, as confirmed by ElevenLabs.
category
string|null
The voice category assigned by ElevenLabs, e.g. generated. May be null if not returned.
description
string|null
The description stored with the voice, or null if not returned.
rawResponse
array
The full decoded JSON response for advanced inspection.

Full example

use AiSdk\ElevenLabs;
use AiSdk\Generate;

ElevenLabs::create(['apiKey' => $_ENV['ELEVENLABS_API_KEY']]);

// Step 1 — generate previews
$design = ElevenLabs::voiceDesign()->design(
    'A warm, expressive documentary narrator with measured pacing.',
    [
        'model_id'           => 'eleven_ttv_v3',
        'auto_generate_text' => true,
    ],
);

echo "Sample text: {$design->text}\n";

foreach ($design->previews as $index => $preview) {
    $path = __DIR__.'/preview-'.$index.'.mp3';
    $preview->audio->save($path);
    echo "Preview {$index}: {$preview->generatedVoiceId} → {$path}\n";
}

// Step 2 — save the chosen preview
$voice = ElevenLabs::voiceDesign()->create(
    generatedVoiceId: $design->previews[0]->generatedVoiceId,
    name: 'Documentary Narrator',
    description: 'Warm and expressive with measured pacing.',
);

echo "Saved voice ID: {$voice->id}\n";

// Step 3 — use the saved voice for speech generation
$speech = Generate::speech('Welcome to the documentary.')
    ->model(ElevenLabs::model('eleven_flash_v2_5'))
    ->voice($voice->id)
    ->run();

$speech->output->save(__DIR__.'/narration.mp3');
The id returned by create() is a standard ElevenLabs voice ID. You can pass it directly to Generate::speech()->voice() or to ElevenLabs::voiceChanger()->convert() as the voiceId argument — no additional registration step is required.

Build docs developers (and LLMs) love