Sourcegraph Cody Gateway
Learn how Cody Gateway powers the default Sourcegraph provider for completions and embeddings to facilitate Cody features.
Sourcegraph Cody Gateway powers the default "provider": "sourcegraph"
, Cody completions and embeddings for Sourcegraph Enterprise users. It supports a variety of upstream LLM providers, such as Anthropic and OpenAI, with rate limits, quotas, and model availability tied to your Sourcegraph Enterprise subscription.
Code snippets are sent to these third-party LLM providers when you use the Cody extension or enable embeddings. Make sure you review the Cody usage and privacy notice.
Using Cody Gateway in Sourcegraph Enterprise
To enable completions and embeddings provided by Cody Gateway on your Sourcegraph Enterprise instance, make sure your license key is set, and Cody is enabled in your site configuration:
{ "licenseKey": "<...>", "cody.enabled": true, }
After adding the license key, the default configuration and authentication will be automatically applied.
For more details about configuring Cody, read the following resources:
Cody Gateway is hosted at cody-gateway.sourcegraph.com
. To use Cody Gateway, your Sourcegraph instance must be connected to the service in this domain.
Configuring custom models
To configure custom models for various Cody configurations (for example, "completions"
and "embeddings"
), specify the desired model with the upstream provider as a prefix to the name of the model. For example, to use the claude-2
model from Anthropic, you would configure:
{ "completions": { "chatModel": "anthropic/claude-2" }, }
The currently supported upstream providers for models are:
For Sourcegraph Enterprise customers, model availability depends on your Sourcegraph Enterprise subscription.
Rate limits and quotas
Rate limits, quotas, and model availability are tied to one of the following:
- your Sourcegraph Enterprise product subscription for Sourcegraph Enterprise instances
- your Sourcegraph.com account, for Cody Free and Pro
All successful requests to Cody Gateway will count toward your rate limits. Unsuccessful requests are not counted as usage.
Rate limits, quotas, and model availability are also configured per Cody feature - for example, you will have separate rate limits for Cody chat, Cody completions, and Cody embeddings.
In addition to the above, we may throttle concurrent requests to Cody Gateway per Sourcegraph Enterprise instance or Cody Free/Pro user to prevent excessive burst consumption.
Privacy and security
Sourcegraph Cody Gateway does not retain sensitive data (prompt test and source code included in requests, etc.) from any traffic received. Only rate limit consumption per Sourcegraph Enterprise subscription and some high-level diagnostic data (error codes from upstream, numeric/enum request parameters, etc) are tracked.
The code that powers Cody Gateway is also source-available for audit.
For more details about Cody Gateway security practices, please reach out to your account manager. You can also refer to the Cody usage and privacy notice for more privacy details about Cody in general.