CKEditor AI integration breaks when no provider is installed; Free Tier of OpenAI adds button but it doesn't appear in editor
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3526382. -->
Reported by: [wfraga](https://www.drupal.org/user/904088)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When configuring the CKEditor integration in the AI module (example in /admin/config/content/formats/manage/full_html), the following browser console error appears if no provider is installed:</p>
<pre>The invalid form control with name='editor[settings][plugins][ai_ckeditor_ai][plugins][ai_ckeditor_spellfix][provider]' is not focusable.</pre><p>This error suggests that the form expects a provider configuration even if none has been installed yet. It breaks the form experience and may confuse users.</p>
<p>Additionally, when installing a provider such as the OpenAI Provider, the error disappears. However, using the Free Tier of OpenAI, the AI button is added to the CKEditor toolbar, but it does not appear when editing content. There is no feedback or warning about this limitation, which may lead users to believe that the integration is broken.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ol>
<li>Install the AI module (ai) on a Drupal 11.1.7 site with PHP 8.3.21.</li>
<li>Go to /admin/config/content/formats/manage/full_html.</li>
<li>Enable the CKEditor AI plugin under the "Editor" section.</li>
<li>Save the configuration.</li>
<li>Open the browser's developer console — the error appears if no provider is installed.</li>
<li>Install and configure the OpenAI Provider using Free Tier credentials.</li>
<li>Add the AI button to the CKEditor toolbar.</li>
<li>Create or edit a content item using the configured text format — the AI button does not appear.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Improve validation and conditionally display or hide fields when no provider is available.</p>
<p>Provide a clear warning message if no provider is configured, explaining the impact.</p>
<p>Detect Free Tier limitations and inform the user that the AI button might not work or be displayed properly under such constraints.</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>Error or warning message in the CKEditor configuration UI when no provider is available.</p>
<h3 id="summary-system-information">System information</h3>
<p>Drupal version: 11.1.7</p>
<p>AI module version: 1.0.5</p>
<p>AI provider module: Not installed initially; later tested with OpenAI Provider</p>
<p>OpenAI tier: Free Tier</p>
<p>PHP version: 8.3.21</p>
issue