# Cody for Enterprise

<p className="subtitle">
	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.
</p>

<LinkCards>
	<LinkCard
		href="https://sourcegraph.com/contact/request-info"
		imgSrc="https://storage.googleapis.com/sourcegraph-assets/Docs/sg-new-logo.svg"
		imgAlt="Cody Enterprise"
		title="Cody Enterprise"
		description="Get in touch with our team to try Cody for Sourcegraph Enterprise."
	/>
</LinkCards>

## Setting up Cody Enterprise

You can set up Cody for your Enterprise instance by two methods:

1. Sourcegraph Cloud
2. Self-hosted Sourcegraph

## Cody on Sourcegraph Cloud

With [Sourcegraph Cloud](/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

-   A Sourcegraph Enterprise subscription with [Sourcegraph Model Provider (Cody Gateway)](/model-provider) or an account with a third-party LLM provider

### Enable Cody on your Sourcegraph instance

Site admins can enable Cody on the Sourcegraph instance. To do so,

-   First, configure your desired LLM provider either by [using Sourcegraph Model Provider (Cody Gateway)](/model-provider) 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

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
}
```

<Callout type="info">
	Ensure `cody.restrictUsersFeatureFlag` is **not** in your site
	configuration. If it is, remove it.
</Callout>

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)

## 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:

<QuickLinks>

<QuickLink
	title="Completions"
	icon="lightbulb"
	href="/cody/enterprise/completions-configuration"
	description="How to configure Cody using the completions."
/>

<QuickLink
	title="Model Configuration"
	icon="installation"
	href="/cody/enterprise/model-configuration"
	description="How to configure Cody using the model configuration."
/>

</QuickLinks>
