100+
May 17, 2026
October 9, 2024
This WordPress plugin introduces central infrastructure which allows other plugins to make use of AI capabilities. It exposes APIs that can be used in various contexts, whether you need to use AI capabilities in server-side or client-side code. Furthermore, the APIs are agnostic of the AI service – whether that’s Anthropic, Google, or OpenAI, to only name a few, you can use any of them in the same way. You can also register your own implementation of another service, if it is not supported out of the box.
The plugin does intentionally not come with specific AI driven features built-in, except for an AI Playground screen to explore AI capabilities as well as a settings screen to configure AI service credentials. The purpose of this plugin is to facilitate use of AI by other plugins. As such, it is a perfect use-case for plugin dependencies.
Here’s a (non-comprehensive) feature list:
Disclaimer: The AI Services plugin is still in its early stages, with a limited feature set and more being added. A crucial part of refining the plugin is shaping the APIs to make them easy to use and cover the different generative AI capabilities that the AI services offer in a uniform way. That’s why your feedback is much appreciated!
While the plugin APIs allow registering custom AI services, the plugin comes with a few popular AI services built-in. These AI services rely on the respective third party API. Their use is optional and it is up to you to choose which third party service you would like to use or whether you would like to use multiple.
The use of the third party AI services is subject to the respective terms of service. The following third party services are supported out of the box:
Generate the answer to a prompt in PHP code:
use Felix_Arntz\AI_Services\Services\API\Enums\AI_Capability;
use Felix_Arntz\AI_Services\Services\API\Helpers;
if ( ai_services()->has_available_services() ) {
$service = ai_services()->get_available_service();
try {
$candidates = $service
->get_model(
array(
'feature' => 'my-test-feature',
'capabilities' => array( AI_Capability::TEXT_GENERATION ),
)
)
->generate_text( 'What can I do with WordPress?' );
$text = Helpers::get_text_from_contents(
Helpers::get_candidate_contents( $candidates )
);
echo $text;
} catch ( Exception $e ) {
// Handle the exception.
}
}
Generate the answer to a prompt in JavaScript code:
const helpers = aiServices.ai.helpers;
const { hasAvailableServices, getAvailableService } = wp.data.select( 'ai-services/ai' );
if ( hasAvailableServices() ) {
const service = getAvailableService();
try {
const candidates = await service.generateText(
'What can I do with WordPress?',
{ feature: 'my-test-feature' }
);
const text = helpers.getTextFromContents(
helpers.getCandidateContents( candidates )
);
console.log( text );
} catch ( error ) {
// Handle the error.
}
}
Generate the answer to a prompt using WP-CLI:
wp ai-services generate-text "What can I do with WordPress?" --feature=my-test-feature
You can also use a specific AI service, if you have a preference, for example the google service.
Generate the answer to a prompt using a specific AI service, in PHP code:
use Felix_Arntz\AI_Services\Services\API\Enums\AI_Capability;
use Felix_Arntz\AI_Services\Services\API\Helpers;
if ( ai_services()->is_service_available( 'google' ) ) {
$service = ai_services()->get_available_service( 'google' );
try {
$candidates = $service
->get_model(
array(
'feature' => 'my-test-feature',
'capabilities' => array( AI_Capability::TEXT_GENERATION ),
)
)
->generate_text( 'What can I do with WordPress?' );
$text = Helpers::get_text_from_contents(
Helpers::get_candidate_contents( $candidates )
);
echo $text;
} catch ( Exception $e ) {
// Handle the exception.
}
}
Refer to the plugin documentation for granular examples including explainers.
For complete examples such as entire plugins built on top of the AI Services infrastructure, please see the examples directory on GitHub.
ai-services folder to the /wp-content/plugins/ directory.Once the plugin is active, you will find a new Settings > AI Services submenu in the WordPress administration menu. In there, you can configure your AI service API keys. After that, you can use the Tools > AI Playground screen to explore the available AI capabilities of the different connected services.
If you have enabled the WordPress assistant chatbot via filter, you should see a small “Need help?” button in the lower right throughout WP Admin after you have configured at least one (valid) API key.
Please refer to the plugin documentation for instructions on how you can actually use the AI capabilities of the plugin in your own projects.
You can use the ai_services_model_params filter in PHP to customize the model parameters before they are used to retrieve a given AI service model.
This filter is run consistently in any context, regardless of whether the AI model is used via PHP, JavaScript, or WP-CLI.
This can be helpful, for example, if you need to inject custom model configuration parameters or a custom system instruction for a specific feature in a way that it happens dynamically on the server.
Here is an example code snippet which injects a custom system instruction whenever the feature my-movie-expert is used with any google model:
add_filter(
'ai_services_model_params',
function ( $params, $service ) {
if ( 'my-movie-expert' === $params['feature'] && 'google' === $service ) {
$params['systemInstruction'] = 'You are a movie expert. You can answer questions about movies, actors, directors, and movie references.';
$params['systemInstruction'] .= ' If the user asks you about anything unrelated to movies, you should politely deny the request.';
$params['systemInstruction'] .= ' You may use famous movie quotes in your responses to make the conversation more engaging.';
}
return $params;
},
10,
2
);
Note that this filter does not allow you to change the feature parameter, as that needs to be controlled by the caller.
There is a simple WordPress Assistant chatbot available as an experimental feature of the plugin, effectively acting as a proof of concept. Since the plugin is purely an infrastructure plugin that other plugins can use to access AI capabilities in WordPress, that chatbot feature is disabled by default.
If you want to test or use the chatbot, you can easily enable it via filter:
add_filter( 'ai_services_chatbot_enabled', '__return_true' );
The wp ai-services generate-text command streams text responses by default. This can help provide more immediate feedback to the user, since chunks with partial response candidates will be available iteratively while the model still processes the remainder of the response.
An exception where it does not stream the response, but returns it all at once is if any function declarations are present.
If you prefer to show the complete text response in one go instead, you can disable streaming in WP-CLI by using the ai_services_wp_cli_use_streaming filter.
add_filter( 'ai_services_wp_cli_use_streaming', '__return_false' );
If you prefer to not expose the sensitive controls over the AI service API keys to the site’s end users, you can programmatically specify the keys by filtering the relevant service’s option value.
For example, to enforce an API key to use for the Google AI service, you could use a code snippet like the following:
add_filter(
'pre_option_ais_google_api_key',
function () {
return 'my-google-api-key';
}
);
The same approach works for any other services too. Simply use the correct service slug, e.g. openai for the OpenAI integration and anthropic for the Anthropic integration.
Please see the documentation article on customizing the available plugin capabilities.
Most certainly at some point, in some form. But maybe not yet. While generative AI has been around for a few years, in the grand scheme of things we are still only scratching the surface of what’s possible. But most importantly, the lack of standardization makes it difficult to consider built-in AI support in WordPress Core.
WordPress Core rarely adds support for features that rely on third party services. An exception is oEmbed support for many popular services, however via the common oEmbed endpoint that each service implements there is a standard way to have it work correctly without having to individually maintain each integration. Doing so would be a maintenance burden and it would make it almost impossible to stay on top of everything: Imagine one of the services makes a change – not only would this require to manually update the WordPress Core integration, but it would also require to quickly ship a new release ASAP because otherwise the WordPress sites using the service would break. Unfortunately, there is no such standard for how generative AI APIs provided by third party services should work. In other words, if you implement support for a generative AI API in your plugin, that implementation is subject to the same concern, and it applies to the AI Services plugin too. However, by centralizing the implementation in one plugin, the problem surface is greatly reduced. And differently from WordPress Core, it’s more straightforward and more reasonable to ship a quick hotfix for this plugin.
The other reason that integrating generative AI in WordPress Core would be difficult is because (almost all) the services that make those APIs available require paid subscriptions. This is not well aligned with WordPress’s FOSS philosophy. A promising development that may change that situation is the increasing availability of on-device models including browser built-in AI models, such as Chrome built-in AI (which is also supported by the AI Services plugin).
Until the time is right for built-in AI capabilities in WordPress Core, you can use a plugin like this one. While it is for now not a WordPress Core feature plugin, it is built to potentially become one and could be considered a canonical AI plugin for WordPress:
For regular support requests, please use the wordpress.org support forums. If you have a technical issue with the plugin where you already have more insight on how to fix it, you can also open an issue on GitHub instead.
If you have ideas to improve the plugin or to solve a bug, feel free to raise an issue or submit a pull request in the GitHub repository for the plugin. Please stick to the contributing guidelines.
You can also contribute to the plugin by translating it. Simply visit translate.wordpress.org to get started.
Bug Fixes:
Bug Fixes:
Enhancements:
Enhancements:
ais_load_services_capabilities action to ai_services_load_services_capabilities. (1557214)Bug Fixes:
Features:
ai_services_skip_api_request filter to effectively enable client-side only mode using the browser built-in models, e.g. for unauthenticated visitors. (2224db1)Enhancements:
ai_services_request_timeout filter to centrally customize AI API request timeout. Props EvanHerman. (7a9c302, #38)blueprint.json for plugin preview. Props fellyph. (#42)Abstract_AI_Service class and With_API_Client_Trait. (2678cfb)Generic_AI_API_Client class abstracting functionality commonly shared across different providers. (6930bc0)With_API_Client and corresponding trait in generative AI model classes. (a4b8fc6)Service_Metadata type to centralize handling of service metadata and simplify API. (6966934)Model_Metadata type to centralize handling of model metadata, using the object in the list_models() method. (7ed37e1)Service_Registration_Context class. (7401650)Modality enum in PHP and JavaScript. (51169f3)Generic_AI_API_Client implementation. (985781e)components package to become interface package. (5f796c8)settings-store package to settings. (a44320f)logError utility instead of console.error in ai store and settings store. (03bacf6)errorToString utility function to improve error handling through client-side UI. (ae5ad8b)Generation_Config class to become an interface and implement Abstract_Generation_Config base class to simplify implementation. (2410b7b)Anthropic_AI_Model, Google_AI_Model, and OpenAI_AI_Model classes in favor of their more specific implementations. (1d8b731)ais-ai-store asset alias. (c54e5d5)Bug Fixes:
Abstract_Generation_Config default handling. (1a71735)getApiKey selector return type and ApiKeyControl props. (29b416a)Text_Generation_Config parameter description. (52956e1)Documentation:
README.md. Props iftakharul-islam. (#43)Bug Fixes:
Bug Fixes:
getServices() selector due to browser built-in AI not being present. Props ocean90. (269bde4)getAdditionalCapabilities() selector output against available capabilities. (7acd7d0)Bug Fixes:
Enhancements:
gpt-image-1 model for image generation. (66afb78)Bug Fixes:
SettingsCards component with useSelect not returning consistent result. (24ab0cf)Bug Fixes:
gemini-2.0-flash-exp model is annotated with multimodal output. (8f2d7ea)Features:
Enhancements:
ApiKeyControl component in JavaScript and API_Key_Control class in PHP to allow easy rendering of API key controls in custom settings UI. (2d23b0a)__next40pxDefaultSize prop in compliance with WordPress 6.8 requirements. (28a1f60)aiServices.aiStore from AI package. (372d750)Bug Fixes:
Interface component with useSelect not returning consistent result. (cc31d7a)Parts component. (767fd5b)Documentation:
Features:
wp ai-services generate-image to generate images via the command line. (599ce48)generate-text command. (f56b54b)Enhancements:
With_Text_Generation interface in text generation model classes. (26985a3)Abstract_AI_Model class and use it as foundation for service-specific model classes. (3f998d9)AI_Model classes in favor of new AI_Text_Generation_Model classes. (2f474aa)Generation_Config class in favor of new Text_Generation_Config class. (d39c135)ai_services_model_params filter. Props mslinnea. (#23)gemini-2.0 models over older gemini-1.5 models. (b01dc0b)gpt-4o models over more expensive gpt-4 models and older gpt-3.5 models. (9b14367)claude-3.5 models over claude-3 models. (04f1896)--user argument for WP-CLI commands. Props swissspidy. (cd25081, #25)Flex component in AI Playground where applicable. (7c4f5d2)Content object from a prompt and media file, and to get the base64 data URL for a file. (e664197)Parts component publicly available via aiServices.components. (3994156)FUNCTION_CALLING and add support to applicable services and models. (4dc570a)Generative_AI_Service::list_models() method in PHP, for a consistent model data shape across PHP and JavaScript. (a9193f9)Bug Fixes:
@wordpress/interface package update. (88d2c13)Generative_AI_Service::list_models() implementations. (f50e46f)Service_Entity_Query::count() method. (08cb9ba)Documentation:
Features:
ai-services/ai store to provide general plugin data and user capabilities for JavaScript consumption. (83d770c)Enhancements:
Modal component. (5ee0e20)getServiceName and getServiceCredentialsUrl selectors in ai-services/ai store for parity with PHP API. (d9ca118)ai-services/ai-playground for new AI playground screen. (96f5b45)ai.languageModel property for Chrome built-in AI, continuing to support ai.assistant for backward compatibility. (0f52227)Bug Fixes:
Documentation:
Features:
Enhancements:
console.log call for chatbot. (7637632)CHAT_HISTORY capability to differentiate between whether text generation models support history. (4c2feb4)Bug Fixes:
CandidatesStreamProcessor in JS, leading to stream responses to not being aggregated correctly. (969b554)gpt-4o models for multimodal support. Props mslinnea. (#18)Documentation:
Features:
ai_services_model_params filter to centrally customize AI service model parameters. (f36f35d)ai-services namespace with commands list, get, list-models, and generate-text. (415edbc, #7)Generation_Config type class for safer and more consistent handling of model generation config data. (4e6925a)Enhancements:
With_API_Client interface and related method. (f3dc6b4)Felix_Arntz\AI_Services\Services\Types namespace to Felix_Arntz\AI_Services\Services\API\Types to indicate it is part of the public API. (5e34f7a)Service_Entity and Service_Entity_Query classes to their own namespace, since they are not only relevant for the REST API. (4ce7026)ai-store asset to ai and settings-store asset to settings and adjust JS globals accordingly, keeping old ai-store asset and JS global available for backward compatibility. (fbe4916)safetySettings model parameter, expecting an array of Safety_Setting instances. (a74e51c)Bug Fixes:
Documentation:
Bug Fixes:
| Version | Download | Type |
|---|---|---|
| 0.7.4 | Download | Stable |
| 0.7.3 | Download | Stable |
| 0.7.2 | Download | Stable |
| 0.7.1 | Download | Stable |
| 0.7.0 | Download | Stable |
| 0.6.5 | Download | Stable |
| 0.6.4 | Download | Stable |
| 0.6.3 | Download | Stable |
| 0.6.2 | Download | Stable |
| 0.6.1 | Download | Stable |
| 0.6.0 | Download | Stable |
| 0.5.0 | Download | Stable |
| 0.4.0 | Download | Stable |
| 0.3.0 | Download | Stable |
| 0.2.0 | Download | Stable |
| 0.1.1 | Download | Stable |
| 0.1.0 | Download | Stable |
| Development | Download | Trunk |