Cody for Enterprise
Cody enhances your coding experience by providing intelligent code suggestions, context-aware completions, and advanced code analysis. These docs will help you use Cody on your Sourcegraph Enterprise instance.
Setting up Cody Enterprise
You can set up Cody for your Enterprise instance by two methods:
- Sourcegraph Cloud
- Self-hosted Sourcegraph
Cody on Sourcegraph Cloud
With Sourcegraph Cloud, you get Cody as a managed service, and you do not need to enable Cody as is required for self-hosted setup. However, by contacting your account manager, Cody can still be enabled or disabled on-demand on your Sourcegraph instance.
Self-hosted Sourcegraph Enterprise
Prerequisites
- You have Sourcegraph version
5.1.0
or more - A Sourcegraph Enterprise subscription with Cody Gateway or an account with a third-party LLM provider
Enable Cody on your Sourcegraph instance
Site admins can only enable Cody on the Sourcegraph instance. To do so,
- First, configure your desired LLM provider either by using Sourcegraph Cody Gateway or by directly using a third-party LLM provider
- Next, go to Site admin > Site configuration (
/site-admin/configuration
) on your instance and set:
JSON{ // [...] "cody.enabled": true, "completions": { "provider": "sourcegraph" } }
- Cody is enabled on your self-hosted Sourcegraph enterprise instance
Disable Cody
To turn Cody off:
- Go to Site admin > Site configuration (
/site-admin/configuration
) on your instance and set:
JSON{ // [...] "cody.enabled": false }
Enable Cody only for some users
How to enable Cody only for some users depends on what version of Sourcegraph you are running.
Sourcegraph v5.3+
In Sourcegraph v5.3+, access to Cody is managed via user roles. By default, all users have access.
First, ensure Cody is enabled in your site configuration. Go to Site admin > Site configuration (/site-admin/configuration
) on your instance and set:
JSON{ // [...] "cody.enabled": true, // Make sure cody.restrictUsersFeatureFlag is not in your configuration! If it is, remove it. }
cody.restrictUsersFeatureFlag
is not in your site configuration. If it is, remove it or else the old feature-flag approach from Sourcegraph 5.2 and earlier will be used.Next, go to Site admin > Users & Auth > Roles (/site-admin/roles
) on your instance. On that page, you can:
- Control whether users by default have access to Cody (expand
User [System]
and toggle Cody > Access as desired) - Control whether groups of users have access to Cody (
+Create role
and enable the Cody > Access toggle as desired)
Sourcegraph v5.2 and earlier
In Sourcegraph v5.2 and earlier, you should use the feature flag cody
to turn Cody on selectively for some users. To do so:
- Go to Site admin > Site configuration (
/site-admin/configuration
) on your instance and set:
JSON{ // [...] "cody.enabled": true, "cody.restrictUsersFeatureFlag": true }
- Next, go to Site admin > Feature flags (
/site-admin/feature-flags
) - Add a feature flag called
cody
- Select the
boolean
type and set it tofalse
- Once added, click on the feature flag and use add overrides to pick users that will have access to Cody
Configure Cody for LLM providers
Cody supports several LLM providers and models. You can access these models via the Cody Gateway, directly using your own model provider account or infrastructure.
There are two ways of configuring Cody for LLM providers:
Completions
How to configure Cody using the completions.
Model Configuration
How to configure Cody using the model configuration.