Set up ElevenLabs
Researched from ElevenLabs's official documentation on 2026-11-02. Not yet walked through end to end.
- Current: Create or sign in to your account
In ElevenLabs, open Developers and select the API Keys tab.
- Not started: Create a restricted API key
Name a separate application key, allow the speech synthesis endpoints it needs and choose an appropriate credit limit. Keep useful restrictions enabled.
- Not started: Choose a model and voice
Select a speech synthesis model and voice that your account can use. Set their identifiers on your own machine as PRISM_SETUP_MODEL and PRISM_SETUP_VOICE; the example does not create or clone a voice.
- Not started: Configure your .env
Use the environment names below in your own application. Keep its environment file out of source control. Never paste a key into this website.
- Not started: Run the local check
Choose a model you can use and run the matching example below on your own machine. Check any applicable usage charges first.
This provider is available in PHP Prism. The TypeScript and Python ports do not implement it.
Configure and verify locally
Environment names and defaults below come from the installed package. Choose a model you can use by setting PRISM_SETUP_MODEL on your machine. Run the verification only when you are ready for one billed request. No request is sent by this page.
use Prism\Prism\Facades\Prism;
// Run in your own configured Laravel application.
$model = getenv('PRISM_SETUP_MODEL');
if (!$model) {
throw new RuntimeException('Set PRISM_SETUP_MODEL to a model your account can use.');
}
try {
$voice = getenv('PRISM_SETUP_VOICE');
if (!$voice) {
throw new RuntimeException('Set PRISM_SETUP_VOICE to a voice your account can use.');
}
$result = Prism::audio()
->using('elevenlabs', $model)
->withVoice($voice)
->withInput('Hello.')
->withProviderOptions(['model_id' => $model])
->asAudio();
echo strlen($result->audio->rawContent()), ' audio bytes', PHP_EOL;
} catch (Throwable $error) {
echo get_class($error), PHP_EOL;
}