zed icon indicating copy to clipboard operation
zed copied to clipboard

Support alternate GitHub Copilot Chat endpoints

Open isometry opened this issue 11 months ago • 1 comments

Summary: Support enterprise GitHub Copilot Chat endpoints

Zed currently hard-codes the non-business Copilot Chat API endpoint as https://api.githubcopilot.com/chat/completions (ref. https://github.com/zed-industries/zed/blob/main/crates/copilot/src/copilot_chat.rs#L16).

In corporate environments in which access to non-Business Copilot tiers has been blocked, GitHub's guidance is to block access to api.githubcopilot.com, api.individual.githubcopilot.com and copilot-proxy.githubusercontent.com; leaving access only to api.business.githubcopilot.com.

To support the correct endpoints for both Individual and Business Copilot tiers, the existing COPILOT_CHAT_COMPLETION_URL variable should be updated to support override via settings.json.

Zed Version and System Specs

Zed: v0.168.2 (Zed) OS: macOS 15.2.0 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help present your vision of the feature

config-mockup

or

{
  "language_models": {
    "github-copilot": {
      "api_url": "https://api.business.githubcopilot.com"
    }
  }
}

isometry avatar Jan 09 '25 15:01 isometry

See also:

  • https://github.com/zed-industries/zed/issues/22577

notpeter avatar Feb 26 '25 08:02 notpeter

To whom can we send cookies or Benjamins to get this prioritized? It is really bumming me out that I cannot use much of the AI tooling in a work context. I'm more bummed that my work requires Github Copilot via our Enterprise setup, but... I don't control that, and I'm guessing there are a ton of us in this boat. It means there is some swath of enterprise users that aren't growing with your brand.

theherk avatar Jun 05 '25 10:06 theherk

Hey @theherk the problem is currently there is no way to know which tier user you are and which type of user you are. Given that we are using the Github copilot-lsp for token. So we are kind of stuck till vscode copilot chat extension goes open source and unveils what's happening under the hood. I tried making this work quite long ago but almost hit the dead end. hopefully once https://github.com/microsoft/vscode/issues/249031 open source we will get quite a lot of answer on how copilot works under the hood and probably has nes(suggestions) etc sorted out.

P.S: Not from zed team. Just a user who was trying to solve for his own pain. I tried to figure it out how can we use our token to get this info it was almost impossible to reliably do this at this point.

imumesh18 avatar Jun 05 '25 20:06 imumesh18

I guess I just don't really understand. It seems like we just need to be able to provide an alternate with URL during the authentication. For instance, how jacobdot/copilot.nvim does this.

theherk avatar Jun 05 '25 20:06 theherk

Yeah, it should be just that @theherk (+ building the UI for configuration view of Copilot, but that's no biggie).

osiewicz avatar Jun 05 '25 20:06 osiewicz

This is improved in #32296, and it works great. Would be awesome to get that merged.

theherk avatar Jun 17 '25 09:06 theherk

Hey, can we get some documentation in Zed on how to set up Github Enterprise Copilot?

This PR says it has been implemented, but there is nothing to document how to do it, so I am stuck.

Thanks!

NathanBrodin avatar Jul 04 '25 07:07 NathanBrodin

@NathanBrodin all you really need is something like:

  "edit_predictions": {
    "copilot": {
      "enterprise_uri": "https://foo.ghe.com"
    }
  },
  "features": {
    "edit_prediction_provider": "copilot"
  },

That's it. The api endpoints are derived. Then just click the Copilot icon in the bottom right and sign in.

theherk avatar Jul 04 '25 07:07 theherk

Thanks @theherk . I made this PR adding documentation for setting up GHE-

It worked for me due to your comment, so hopefully this can be added in the docs so that others know how to do it as well.

NathanBrodin avatar Jul 04 '25 09:07 NathanBrodin