# Enable AI CodeFix

*AI CodeFix is only available in SonarQube Server* [*Enterprise and Data Center editions*](https://www.sonarsource.com/plans-and-pricing/sonarqube/) to provide AI-generated fixes for your issues.

Sonar AI CodeFix uses a large language model (LLM) to automatically generate AI-driven code fixes for the issues discovered by SonarQube Server. The process is simple. When you request a fix, the affected code and issue description are sent to an LLM. AI CodeFix then proposes an edit that resolves the problem without changing the code’s functionality.

AI CodeFix currently uses <code class="expression">space.vars.SQS\_20251\_Supported\_LLM\_version</code> to suggest fixes for a select set of rules in Java, JavaScript, TypeScript, Python, HTML, CSS, C#, and C++. To learn more about which rules are eligible for AI CodeFix, please see the list of [Rules for AI CodeFix](/sonarqube-server/2025.1/user-guide/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 available in SonarQube Server, [Enterprise and Data Center editions](https://www.sonarsource.com/plans-and-pricing/sonarqube/) and uses <code class="expression">space.vars.SQS\_20251\_Supported\_LLM\_version</code> to suggest fixes for your issues.

AI-generated fix suggestions are available for a select set of rules in Java, JavaScript, TypeScript, Python, HTML, CSS, C#, and C++. To learn more about which rules are eligible for AI CodeFix, please see the list of [Rules for AI CodeFix](/sonarqube-server/2025.1/user-guide/rules/rules-for-ai-codefix.md#ai-codefix-rules).

As an Instance Admin, you can enable or disable AI CodeFix at the instance or project level.

To enable AI-CodeFix, go to **Administration** > **Configuration** > **General Settings** > **AI CodeFix** > **Enable AI-generated fix suggestions** and select **Enable AI CodeFix**. Once AI CodeFix is enabled, select either **All projects** or choose projects individually from the list to activate the feature.

Note that if you choose **Enable AI CodeFix on selected projects only**, new projects will not be automatically enabled.

{% hint style="info" %}
You’ll need a connection to the internet to access SonarQube Server’s AI CodeFix service.

The service is provided via api.sonarqube.io and has these static IP addresses:

* 99.83.135.55 (CIDR: 99.83.135.55/32)
* 15.197.164.24 (CIDR: 15.197.164.24/32)
  {% endhint %}

Once enabled, developers can get AI-generated fix suggestions from the **Issues** page in their projects. See the [Fixing issues](/sonarqube-server/2025.1/user-guide/issues/fixing.md) page for more details.

### Disabling AI CodeFix <a href="#disabling-ai-codefix" id="disabling-ai-codefix"></a>

To disable AI CodeFix completely in SonarQube Server and hide the feature from all users, including Instance Admins, set `sonar.ai.codefix.hidden=true` in your sonar.properties file.

## 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 [Connected mode](/sonarqube-server/2025.1/user-guide/connected-mode.md).

For complete details about using AI CodeFix to fix your issues in SonarQube Server, see the article on [Fixing issues](/sonarqube-server/2025.1/user-guide/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 [AI Code Assurance](/sonarqube-server/2025.1/ai-capabilities/ai-standards.md) page.

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

* [Overview](/sonarqube-server/2025.1/ai-capabilities/overview.md) of AI capabilities
* [Autodetect AI code](/sonarqube-server/2025.1/ai-capabilities/autodetect-ai-code.md)
* Learn about [AI Code Assurance](/sonarqube-server/2025.1/ai-capabilities/ai-standards.md)
* See also[Enable AI CodeFix](/sonarqube-server/2025.1/instance-administration/ai-features/enable-ai-codefix.md) to get AI-generated fix suggestions


---

# 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-server/2025.1/instance-administration/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.
