# Enable AI CodeFix

*AI features are only available in SonarQube Cloud Team and Enterprise plans*. See the [Subscription plans](/sonarqube-cloud/administering-sonarcloud/managing-subscription/subscription-plans.md) page for more detail&#x73;*.*

SonarQube Cloud’s AI CodeFix is a feature that uses <code class="expression">space.vars.SQC\_Supported\_LLM\_version</code> to suggest fixes for a select set of rules in Java, JavaScript, TypeScript, Python, HTML, CSS, C#, and C++. See the [Sonar AI CodeFix terms](https://www.sonarsource.com/legal/ai-codefix-terms/) for details about the terms of access.

To learn more about which rules are eligible for AI CodeFix, please see the list of [Rules for AI CodeFix](/sonarqube-cloud/standards/managing-rules/rules-for-ai-codefix.md#ai-codefix-rules).

## Sharing your code with Sonar <a href="#sharing-your-code-with-sonar" id="sharing-your-code-with-sonar"></a>

If you use Sonar’s AI CodeFix LLM, the affected code snippet will be sent by the AI CodeFix service to the selected LLM. Service agreements with Sonar’s LLMs prevent your code from being used to train those models.

For details about terms and conditions, please refer to the [AI CodeFix terms](https://www.sonarsource.com/legal/ai-codefix-terms/) in our [Legal Documentation](https://www.sonarsource.com/legal/).

## Enabling AI-generated fix suggestions <a href="#enabling-ai-generated-fix-suggestions" id="enabling-ai-generated-fix-suggestions"></a>

*AI CodeFix is a feature that generates AI-generated fix suggestions in SonarQube Cloud Team and Enterprise plans. It must be activated by an Organization Admin.*

As an Organization Admin, you can activate or deactivate AI-generated fix suggestions in your organization. This allows developers to get AI-based fix suggestions for the issues detected in their projects. To enable AI CodeFix:

1. Go to *Your Organization* > **Administration** > **AI capabilities** > **AI CodeFix** tab and select **Enable AI CodeFix**.
2. Select your provider:
   * <code class="expression">space.vars.SQC\_Supported\_LLM\_version</code>
3. Once AI CodeFix is enabled, select either **All projects** or **Only selected projects** to activate the feature.

Note that if you choose **Only selected projects**, new projects will not be automatically enabled.

{% hint style="warning" %}
Sonar recommends choosing Claude Sonnet 4 as your provider because it produces the best results. Using other models may produce unexpected fix suggestions that have undesirable effects.
{% endhint %}

## Getting AI-generated fix suggestions <a href="#getting-ai-generated-fix-suggestions" id="getting-ai-generated-fix-suggestions"></a>

Once AI CodeFix is enabled, users will be able to select **Generate AI Fix** on eligible issues and copy/paste the fix into their IDE with the **Open in IDE** feature when using [SonarQube for IDE](/sonarqube-cloud/analyzing-source-code/connected-mode.md).

The easiest way to use AI CodeFix is by using AI CodeFix in your IDE. When SonarQube for [VS Code](https://docs.sonarsource.com/sonarqube-for-vs-code/) or SonarQube for [IntelliJ](https://docs.sonarsource.com/sonarqube-for-intellij/) is set up in connected mode with with SonarQube Cloud, select an issue marked with the ![$ai-icon-sparkle](/files/vJccYvxqQLNCXGm6uWpl) icon, open the **Rule description** > ![$ai-icon-sparkle](/files/vJccYvxqQLNCXGm6uWpl)**AI CodeFix** tab, and select ![$ai-icon-sparkle](/files/vJccYvxqQLNCXGm6uWpl)**Generate Fix**. A fix will be generated in the code editor and you’ll have a chance to **Apply** or **Decline** the suggestion.

See the [SonarQube for IDE](/sonarqube-cloud/analyzing-source-code/connected-mode.md) page for information about connected mode.

* See the IntelliJ page for [AI CodeFix](/sonarqube-for-intellij/ai-capabilities/ai-codefix.md#ai-codefix)
* See the VS Code page for [AI CodeFix](/sonarqube-for-vs-code/ai-capabilities/ai-codefix.md#ai-codefix)

For complete details about using AI CodeFix to fix your issues in SonarQube Cloud, see the article on [Fixing issues](/sonarqube-cloud/managing-your-projects/issues/fixing.md#getting-ai-generated-fix-suggestions).

## Usage limits <a href="#limits" id="limits"></a>

Limits are placed on the AI CodeFix feature to manage abuse. Developers will be notified directly when the monthly allocation is reached for your organization. If the instance is blocked due to reaching the allowance, users attempting to generate a fix will see an error message. Usage quotas are reset on the first day of each month.

## Marking a project as containing AI-generated code <a href="#marking-a-project-as-containing-ai-generated-code" id="marking-a-project-as-containing-ai-generated-code"></a>

Sonar recognizes that AI-generated code should be monitored with additional quality standards and offers administrators a series of project labels and custom quality gate certifications described on the [Set your AI standards](/sonarqube-cloud/standards/ai-code-assurance/overview.md) page.

## Related pages <a href="#related-pages" id="related-pages"></a>

* SonarQube Cloud's [AI capabilities](/sonarqube-cloud/ai-capabilities.md)
* [Rules for AI CodeFix](/sonarqube-cloud/standards/managing-rules/rules-for-ai-codefix.md#ai-codefix-rules)
* To learn about AI Code Assurance:
  * [Set your AI standards](/sonarqube-cloud/standards/ai-code-assurance/overview.md)
  * [AI Code Assurance](/sonarqube-cloud/ai-capabilities/ai-code-assurance.md#marking-a-project-as-containing-ai-generated-code)
  * and use [Quality gates for AI code](/sonarqube-cloud/standards/ai-code-assurance/quality-gates-for-ai-code.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/ai-features/enable-ai-codefix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
