Connectors: Verify AI provider API keys with php-ai-client - #13871
Closed
jorgefilipecosta wants to merge 4 commits into
Closed
jorgefilipecosta wants to merge 4 commits into
jorgefilipecosta wants to merge 4 commits into
Conversation
Only discard a submitted key when the provider rejects it. A network error, server error, or rate limit during validation no longer wipes the key, a cached model list no longer validates a different key, and a masked key submitted back to the settings endpoint keeps the stored key. See #65551.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The Connectors screen no longer submits a masked API key, as it shows a stored key read-only until it is removed, so the setting does not need to handle one: WordPress/gutenberg#83889 See #65551.
…rification. Stand-in for bundling a php-ai-client release that includes WordPress/php-ai-client#299. Generated with tools/php-ai-client/installer.sh from 1.3.1 plus that change.
Use `ProviderRegistry::verifyProviderCredentials()` to validate a submitted key instead of sending the list models request directly. It tells a rejected key apart from one that cannot be verified, so the workaround for `ListModelsApiBasedProviderAvailability::isConfigured()` is no longer needed. See #65551.
jorgefilipecosta
force-pushed
the
fix/connectors-api-key-verify-provider-credentials
branch
from
September 30, 2026 20:44
a351d34 to
48e6fe8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Alternative to #13870, to merge only after a php-ai-client release with WordPress/php-ai-client#299 is bundled. It shows how the fix looks when php-ai-client does the credentials check.
tools/php-ai-client/installer.sh, and gets replaced by the real bundle._wp_connectors_is_ai_api_key_valid()callsProviderRegistry::verifyProviderCredentials()instead of sending the list models request itself (1 line added, 31 removed): jorgefilipecosta@48e6fe8Testing
Verify unit tests are passing:
Issue found via AI-assisted code review; fix and tests drafted with AI assistance (Claude Code) and reviewed by me.
Trac ticket: https://core.trac.wordpress.org/ticket/65551