Integrations / Sourcegraph Cody
S

Sourcegraph Cody

Sourcegraph · Verified setup guide

Sourcegraph's coding assistant. A custom OpenAI-compatible endpoint is a self-hosted Enterprise setting.

Setup steps

  1. 1
    You need EnterpriseA self-hosted Sourcegraph Enterprise instance (this is not a per-user option).
  2. 2
    Open advanced configSite admin → Advanced configuration → modelConfiguration.
  3. 3
    Add the providerA providerOverrides entry of type openaicompatible with the base URL and key, plus a modelOverrides entry for your model id.
  4. 4
    Make it defaultPoint defaultModels.chat at it.

Configuration example

json
// Sourcegraph Enterprise → Site admin → Advanced configuration
"modelConfiguration": {
  "providerOverrides": [{
    "id": "luxechain", "displayName": "LuxeChain",
    "serverSideConfig": {
      "type": "openaicompatible",
      "endpoints": [{ "url": "https://api.luxechain.si/v1", "accessToken": "lxc_live_YOUR_KEY" }]
    }
  }],
  "modelOverrides": [{
    "modelRef": "luxechain::v1::YOUR_MODEL_ID",
    "modelName": "YOUR_MODEL_ID", "displayName": "LuxeChain model",
    "capabilities": ["chat", "autocomplete"], "category": "balanced",
    "serverSideConfig": { "type": "openaicompatible", "apiModel": "YOUR_MODEL_ID" },
    "clientSideConfig": { "openaicompatible": {} }
  }],
  "defaultModels": { "chat": "luxechain::v1::YOUR_MODEL_ID" }
}

Replace YOUR_MODEL_ID with any model from the catalogue. Never paste a real API key into a shared document.

Troubleshooting

Only a SELF-HOSTED Sourcegraph Enterprise instance can point Cody at your gateway, and it is an instance-wide, site-admin setting. The Cody Free/Pro extension has no custom base URL.

If the tool rejects the endpoint, confirm the base URL exactly matches the value on the right, and that the key is active in your account.