Configure GitLab to access GitLab Duo Self-Hosted
- Tier: Premium, Ultimate
- Add-on: GitLab Duo Enterprise
- Offering: GitLab Self-Managed
Prerequisites:
- Upgrade GitLab to version 17.9 or later.
- You must be an administrator.
To configure your GitLab instance to access the available self-hosted models in your infrastructure:
- Confirm that a fully self-hosted configuration is appropriate for your use case.
- Configure your GitLab instance to access the AI Gateway.
- In GitLab 18.4 and later, configure your GitLab instance to access the GitLab Duo Agent Platform service.
- Configure the self-hosted model.
- Configure the GitLab Duo features to use your self-hosted model.
Configure access to the local AI Gateway
To configure access between your GitLab instance and your local AI Gateway:
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Change configuration.
- Under Local AI Gateway URL, enter your AI Gateway URL.
- Select Save changes.
If your AI Gateway URL points to a local network or private IP address (for example, 172.31.x.x or internal hostnames like ip-172-xx-xx-xx.region.compute.internal), GitLab might block the request for security reasons. To allow requests to this address, add the address to the IP allowlist.
Configure timeout for the AI Gateway
Prerequisites:
- You must be an administrator.
Configure the timeout for GitLab requests to the AI Gateway when using self-hosted models. You can use longer timeouts for models that need extended processing times for large context windows or complex queries.
You can configure a timeout between 60 and 600 seconds (10 minutes). If you don’t set the timeout, GitLab uses the default timeout of 60 seconds.
To configure the AI Gateway timeout:
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Change configuration.
- Under AI Gateway request timeout, enter the timeout value in seconds (between 60 and 600).
- Select Save changes.
Determine the timeout value
The timeout value depends on your specific deployment and use case.
To determine the timeout value:
- Start with the default timeout of 60 seconds and monitor for timeout errors.
- Monitor your logs for
A1000timeout errors in your logs. If these errors occur frequently, consider increasing the timeout. - Consider your use case. Larger prompts, complex code generation tasks, or processing large design documents might require longer timeouts.
- Consider your infrastructure. Model performance depends on available GPU resources, network latency between the AI Gateway and model endpoint, and the model’s processing capabilities.
- Increase incrementally. If you experience timeouts, increase the value gradually (for example, by 30-60 seconds) and monitor the results.
For more information on troubleshooting timeout errors, see Error A1000.
Configure access to the GitLab Duo Agent Platform
- Status: Beta
The availability of this feature is controlled by a feature flag. For more information, see the history.
Prerequisites:
- Self-hosted beta models and features are turned on.
To access the Agent Platform service from your GitLab instance:
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Change configuration.
- Under Local URL for the GitLab Duo Agent Platform service, enter the URL for the local Agent Platform service.
The URL prefix cannot start with
http://orhttps://.If the URL is not set up with TLS, you must set the
DUO_AGENT_PLATFORM_SERVICE_SECUREenvironment variable in your GitLab instance:- For Linux package installations, in
gitlab_rails['env'], set'DUO_AGENT_PLATFORM_SERVICE_SECURE' => false - For self-compiled installations, in
/etc/default/gitlabsetexport DUO_AGENT_PLATFORM_SERVICE_SECURE=false
- For Linux package installations, in
- Select Save changes.
Add a self-hosted model
You must add a self-hosted model to your GitLab instance to use it with GitLab Duo features.
To add a self-hosted model:
In the upper-right corner, select Admin.
Select GitLab Duo.
Select Configure GitLab Duo Self-Hosted.
- If Configure GitLab Duo Self-Hosted is not available, synchronize your
subscription after purchase:
- On the left sidebar, select Subscription.
- In Subscription details, to the right of Last sync, select synchronize subscription ( ).
- If Configure GitLab Duo Self-Hosted is not available, synchronize your
subscription after purchase:
Select Add self-hosted model.
Complete the fields:
- Deployment name: Enter a name to uniquely identify the model deployment, for example,
Mixtral-8x7B-it-v0.1 on GCP. - Model family: Select the model family the deployment belongs to. You can select either a supported or compatible model.
- Endpoint: Enter the URL where the model is hosted.
- API key: Optional. Add an API key if you need one to access the model.
- Model identifier: Enter the model identifier based on your deployment method. The model identifier should match the following format:
Deployment method Format Example vLLM custom_openai/<name of the model served through vLLM>custom_openai/Mixtral-8x7B-Instruct-v0.1Amazon Bedrock bedrock/<model ID of the model>bedrock/mistral.mixtral-8x7b-instruct-v0:1Azure OpenAI azure/<model ID of the model>azure/gpt-35-turbo
- Deployment name: Enter a name to uniquely identify the model deployment, for example,
Select Create self-hosted model.
Set the model identifier for Amazon Bedrock models
To set a model identifier for an Amazon Bedrock model:
Set your
AWS_REGION. Ensure you have access to models in that region in your AI gateway Docker configuration.Add the region prefix to the model’s inference profile ID for cross-region inferencing.
Use the
bedrock/prefix region as the prefix for the model identifier.For example, for the Anthropic Claude 3.5 v2 model in the Tokyo region:
- The
AWS_REGIONisap-northeast-1. - The cross-region inferencing prefix is
apac.. - The model identifier is
bedrock/apac.anthropic.claude-3-5-sonnet-20241022-v2:0.
- The
Some regions are not supported by cross-region inferencing. For these regions, do not specify a region prefix in the model identifier. For example:
- The
AWS_REGIONiseu-west-2. - The model identifier is
bedrock/anthropic.claude-3-7-sonnet-20250219-v1:0.
Turn on self-hosted beta models and features
Turning on beta self-hosted models and features also accepts the GitLab Testing Agreement.
To enable self-hosted beta models and features:
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Change configuration.
- Under Self-hosted beta models and features, select the Use beta models and features in GitLab Duo Self-Hosted checkbox.
- Select Save changes.
Configure GitLab Duo features to use self-hosted models
View configured features
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Configure GitLab Duo Self-Hosted.
- If Configure GitLab Duo Self-Hosted is not available, synchronize your
subscription after purchase:
- On the left sidebar, select Subscription.
- In Subscription details, to the right of Last sync, select synchronize subscription ( ).
- If Configure GitLab Duo Self-Hosted is not available, synchronize your
subscription after purchase:
- Select the AI-native features tab.
Configure a feature to use a self-hosted model
Configure a GitLab Duo feature and sub-feature to send queries to the self-hosted model:
In the upper-right corner, select Admin.
Select GitLab Duo.
Select Configure GitLab Duo Self-Hosted.
Select the AI-native features tab.
For the feature and sub-feature you want to configure, from the dropdown list, choose the self-hosted model you want to use.
For example, for the code generation, you can select Claude-3 on Bedrock deployment (Claude 3).
If you don’t specify a model for a GitLab Duo Chat sub-feature, it automatically uses the model configured for General Chat. This ensures all Chat functionality works without requiring individual model configuration for each sub-feature.
Configure a feature to use a GitLab AI vendor model
- Status: Beta
The availability of this feature is controlled by a feature flag. For more information, see the history.
You can configure a GitLab Duo feature to use the GitLab AI vendor model, even if you use a self-hosted AI gateway and models.
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Configure GitLab Duo Self-Hosted.
- Select the AI-native features tab.
- For the feature and sub-feature you want to configure, from the dropdown list, select GitLab AI vendor model.
Disable GitLab Duo features
GitLab Duo features remain turned on even if you have not chosen a model for a sub-feature.
To disable a GitLab Duo feature or sub-feature:
- In the upper-right corner, select Admin.
- Select GitLab Duo.
- Select Configure GitLab Duo Self-Hosted.
- Select the AI-native features tab.
- For the feature or sub-feature you want to disable, from the dropdown list, select Disabled.
Self-host the GitLab documentation
If your GitLab Duo Self-Hosted setup prevents you from accessing the GitLab documentation at
docs.gitlab.com, you can self-host the documentation.
For more information, see Host the GitLab product documentation.


