| 开发者 |
laurisaarni
whyisjake |
|---|---|
| 更新时间 | 2026年12月2日 22:26 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.2 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
TEXT_TO_SPEECH_CONVERSION -- convert text to speech using any ElevenLabs TTS modelSPEECH_GENERATION -- generate sound effects from text prompts/wp-content/plugins/ls-ai-provider-for-elevenlabs/ELEVENLABS_API_KEY environment variable or constantVisit https://elevenlabs.io/app/settings/api-keys to create an account and generate an API key. Using this plugin requires an ElevenLabs account, and ElevenLabs bills you for the requests it makes on your behalf.
No. This plugin contains only the ElevenLabs-specific implementation of the AI Client's provider interfaces, so the SDK has to be loadable for it to do anything. WordPress 7.0 and later bundle the SDK in core. On earlier WordPress, the SDK has to be provided by your project (for example through Composer); it is a library, not a plugin. When the SDK is missing, this plugin registers nothing and stays inert instead of erroring.
Set the outputSpeechVoice option in your ModelConfig to the voice ID. You can discover available voices using the VoiceDirectory class or the ElevenLabs voice library.
The provider resolves a default: the ELEVENLABS_DEFAULT_VOICE_ID environment variable or constant, the ai_provider_for_elevenlabs_default_voice_id option, a voice discovered from your own ElevenLabs account (preferring premade voices; requires the Voices permission on the API key), and finally the premade voice "George" (JBFqnCBsd6RMkjVDRZzb), which is available on every account. The result passes through the ai_provider_for_elevenlabs_default_voice_id filter. An explicitly configured outputSpeechVoice always takes precedence.
A prompt that names a model gets that model. Otherwise the provider uses the configured default: the ELEVENLABS_DEFAULT_MODEL_ID environment variable or constant, or the ai_provider_for_elevenlabs_default_model_id option, passed through the filter of the same name. Without one it uses Eleven v4, then Multilingual v2. The ai_provider_for_elevenlabs_allowed_models filter limits which text-to-speech models are offered. ElevenLabs offers the same text-to-speech models on every plan, so no per-plan check is needed.
Text longer than the model's per-request character limit is split on paragraph and sentence boundaries, narrated in several requests, and returned as one audio file. Note that narration is slow (roughly 90 to 95 characters per second) and runs inside one PHP request, so very long text can exceed the PHP execution time limit. Each chunk is billed as its own API request. See the README for details and for the public per-chunk methods a background-processing plugin can build on.
The WordPress.org AI plugin treats a connector as valid only when it can generate text, and ElevenLabs generates speech and sound. The warning is expected and does not affect this provider; add a text-generation connector alongside it to satisfy the AI plugin's own features.
The default output format is MP3 (mp3_44100_128). Other supported formats include PCM, ulaw, Opus, and AAC at various sample rates and bitrates. When long text has to be split across requests, only formats whose audio can be joined are allowed (MP3, PCM, ulaw, alaw).
No. Nothing leaves your site until code on your site asks the AI Client for speech, sound, a model list, or a voice list. There is no telemetry, no analytics, and no phone-home. The "External services" section below documents every request the plugin can make.
ELEVENLABS_DEFAULT_MODEL_ID environment variable or constant, the ai_provider_for_elevenlabs_default_model_id option, or the filter of the same nameai_provider_for_elevenlabs_allowed_models filterai_provider_for_elevenlabs_include_alpha_models filter enables themelevenlabs-sound-generation directly no longer waits on a /models request it does not needls-ai-provider-for-elevenlabs. The WordPress.org plugin directory requires a plugin name to begin with a distinctive identifier, and "AI Provider" on its own is a generic description; "LS" is the author's initialsls-ai-provider-for-elevenlabs.php and the text domain to ls-ai-provider-for-elevenlabs, both of which have to match the permalinkai_provider_for_elevenlabs_*) and the Composer package name (saarnilauri/ai-provider-for-elevenlabs) unchanged, so existing integrations and Composer installs are unaffectedconnectors_ai_elevenlabs_api_key) directly. WordPress passes the key to the AI Client itself, and the plugin already re-wraps it for the xi-api-key header ElevenLabs requires, so the direct read was redundant. This resolves a WordPress.org review finding about plugins handling AI Client credentialsplugin.php to ai-provider-for-elevenlabs.php, so the plugin headers live in the file matching the plugin slug as the WordPress.org directory expects. Sites that installed an earlier build from the GitHub ZIP have to reactivate the plugin once after updatingoutputSpeechVoice and no explicit default are configured, a voice is discovered from the account's own voices, preferring premade ones, before falling back to "George" (contributed by Jake Spurlock)/v1/voices endpoint to /v2/voices with full pagination, and cache the voice list per API key for 15 minutes (contributed by Jake Spurlock)customOptions in both the text-to-speech and sound generation models (e.g. language_code, seed, speed, apply_text_normalization); previously most keys were silently dropped (contributed by Jake Spurlock)/models response, seeded from measured values, and add eleven_v3 to the fallback model list (contributed by Jake Spurlock).env, .wp-env.override.json) and dev artifacts from the release ZIP, verified by a CI canary check (contributed by Jake Spurlock)wp-env environment, the GPL-2.0 license text, and fix test-suite autoloading on case-sensitive filesystemsoutputFileType support for text-to-speech and sound generation models, so support checks like isSupportedForTextToSpeechConversion() pass when callers request inline output (fixes compatibility with the WordPress AI plugin's Text to Speech experiment)outputSpeechVoice is configured, instead of throwing an exception; the default can be overridden via the ELEVENLABS_DEFAULT_VOICE_ID environment variable or constant, the ai_provider_for_elevenlabs_default_voice_id option, or the ai_provider_for_elevenlabs_default_voice_id filterconnectors_ai_elevenlabs_api_key, Settings > Connectors)