| 开发者 | empiriolabs |
|---|---|
| 更新时间 | 2026年11月26日 04:42 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.2 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
EMPIRIOLABS_API_KEY environment variable, or a PHP constant of the same name.$text = wp_ai_client_prompt( 'Write a two-sentence welcome message for a bakery website.' ) ->using_provider( 'empiriolabs' ) ->generate_text();
To prefer a specific model, pass its model ID, for example using_model_preference( 'MODEL_ID' ). Model IDs are listed at empiriolabs.ai/models. Without a preference, the AI Client picks the first EmpirioLabs AI model that supports the request.
To convert text to speech:
$audio = wp_ai_client_prompt( 'Welcome to our bakery. We open at seven every morning.' ) ->using_provider( 'empiriolabs' ) ->as_output_mime_type( 'audio/mpeg' ) ->convert_text_to_speech();
To choose a voice, add as_output_speech_voice( 'VOICE' ) with one of the model's voices. Each model's page in the documentation lists its voices.
A video takes minutes to generate. Start it, keep its operation ID, and read the result in a later request:
`
$model = \WordPress\AiClient\AiClient::defaultRegistry()->getProviderModel( 'empiriolabs', 'MODEL_ID' );
$operation = $model->generateVideoOperation(
array(
new \WordPress\AiClient\Messages\DTO\UserMessage(
array( new \WordPress\AiClient\Messages\DTO\MessagePart( 'A paper boat drifting down a rainy street' ) )
),
)
);
$operation_id = $operation->getId();
// Later, with the saved operation ID:
$operation = \EmpirioLabs\AiProvider\Provider\EmpirioLabsProvider::operationsHandler()->getOperation( $operation_id );
if ( $operation->getState()->isSucceeded() ) {
$video_url = $operation->getResult()->toVideoFile()->getUrl();
}
`
empiriolabs-ai-provider folder to the /wp-content/plugins/ directory.EMPIRIOLABS_API_KEY as an environment variable or as a constant in wp-config.php:
define( 'EMPIRIOLABS_API_KEY', 'your-api-key' );Sign in or create an account at platform.empiriolabs.ai, then create a key on the API Keys page. Requests use the credits on your EmpirioLabs AI account at the prices on the pricing page.
The text, image, speech, video, and embedding models in the EmpirioLabs AI catalog that the AI Client can call. The plugin reads the model list from the API, so new models appear without a plugin update. Browse the models at empiriolabs.ai/models.
Yes. The plugin adds a provider to the AI Client that ships with WordPress 7.0 and later.
WordPress allows each AI Client request 30 seconds by default, and some image models take longer. Raise the limit with the wp_ai_client_default_request_timeout filter, for example to 120 seconds:
add_filter( 'wp_ai_client_default_request_timeout', function () { return 120; } );
A video usually takes several minutes. generate_video() waits for it for as long as the request timeout allows, 30 seconds by default (the previous question shows how to raise it). A video that needs longer keeps running, and the error message contains its operation ID. To avoid waiting, start the video with generateVideoOperation() and read the operation in a later request, as shown in the description.
A key saved on the Settings > Connectors screen is stored in your site's database, and WordPress shows only its last four characters afterward. Deleting the plugin removes the saved key. A key set with the EMPIRIOLABS_API_KEY environment variable or constant is never stored in the database.
Read the EmpirioLabs AI documentation or email support@empiriolabs.ai.