Skip to content

Register AI providers on init#59

Closed
dushakov92 wants to merge 1 commit intoWordPress:trunkfrom
dushakov92:fix/register-ai-providers-on-init
Closed

Register AI providers on init#59
dushakov92 wants to merge 1 commit intoWordPress:trunkfrom
dushakov92:fix/register-ai-providers-on-init

Conversation

@dushakov92
Copy link
Copy Markdown

@dushakov92 dushakov92 commented Feb 21, 2026

The provider implementations for OpenAI, Google, and Anthropic were moved to their own packages in php-ai-client v1.0:

wordpress/openai-ai-provider
wordpress/google-ai-provider
wordpress/anthropic-ai-provider
It looks like wp-ai-client needs a couple of updates to work with this new structure:

The three provider packages need to be listed in composer.json so they get pulled in automatically.
AI_Client::init() needs to register each provider with the ProviderRegistry so they're available to the credentials manager.
Without these, API_Credentials_Manager::collect_providers() returns an empty array and the settings page at /wp-admin/options-general.php?page=wp-ai-client doesn't show any provider fields.

What this PR does:

  1. Adds the three provider packages to require in composer.json
  2. Registers providers during init() via ProviderRegistry::registerProvider(), guarded by class_exists() checks

Tested locally — settings page renders correctly after these changes.

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @dushakov92.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: dushakov92.


To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dushakov92 dushakov92 changed the title fix: register ai providers on init Register AI providers on init Feb 21, 2026
@felixarntz
Copy link
Copy Markdown
Member

@dushakov92 Thank you for opening this PR.

Note that a few major changes are being implemented currently as part of the merge of WP AI Client into WordPress Core:

  • This package will no longer bundle the 3 providers.
  • The package will only load most of it features conditionally, given that WordPress 7.0 includes them (currently available in Beta).
  • Once WordPress 7.0 stable is out, this package will be deprecated. Any remaining features that are not part of the WordPress Core implementation at that point, but still continue to be valuable, will be migrated to become a part of the Gutenberg plugin, to continue iterating for a future WordPress Core merge.

Once you update to the next release of this package, please ensure to require the 3 providers directly in your plugin. At the same time, it's recommended you prepare your plugin for usage of WordPress 7.0 (e.g. use the wp_ai_client_prompt() function, which this package will polyfill starting in the next release, so you can already start relying on it unconditonally).

Given the above, I'm going to close this PR, as the change is not needed according to the plans above. Thanks again!

@felixarntz felixarntz closed this Feb 28, 2026
@dushakov92
Copy link
Copy Markdown
Author

@felixarntz
Thank you. Looking forward to 7.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants