Allow GitHub CoPilot authentication over GHE
It would be nice if I could use ECA also with my GitHub Enterprise account (subdomain.ghe.com).
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
@ericdallo, yeah. I tried api.mysbdmn.ghe.com and also mysbdmn.ghe.com
I would assume that GITHUB_COPILOT_API_URL does not affect the initial authentication. The handshake with device-code-login seems to be hardwired with github.com.
Ah yes, the auth flow is hardcoded, we could check the url as well if they are equal, if we have the details I can do the change
I would assume that should be configurable. As far as I know, every enterprise has its own subdomain in GHE.
@mgmart do you know if clientId changes by subdomain? I believe not, but I think it's not the same for GHE
@mgmart just added providers github-copilot auth url and providers github-copilot auth clientId configs, being clientId optional if the default not works, can you try later?
@ericdallo, that was fast. Thank you. I'm using eca from homebrew at the moment. I think I will have time at the weekend to compile it from source.
I just did a release 0.124.3 which includes that!
I made a quick try. Auth has worked. When trying to chat I get OpenAI errors. Not quite sure why this happens. I will give it a try the next days. It's too late to make a focussed trial and error session 😫 Anyway. I think the authentication was the main hurdle. Thanks again!
@ericdallo, I get:
LLM response status: 401 body: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}
could that be the clientID? I haven't configured any, would not know where to get the vaue from.
Here is the full output, slightly redacted. There was nothing in stderr.
For other providers, configure manually in your ECA config.
> github-copilot
First, make sure you have Copilot enabled in your Github account: https://xxx.ghe.com/settings/copilot/features
Then, open your browser at:
https://xxx.ghe.com/login/device
Authenticate using the code: `xxxx-xxxx`
Then type anything in the chat and send it to continue the authentication.
> Hello
Login successful! You can now use the 'github-copilot' models.
Make sure to enable the model you want to use at: https://xxx.ghe.com/settings/copilot/features
> Hello
LLM response status: 401 body: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}
@mgmart it should be fixed on 0.124.4! The auth flow returns the proper url to do the requests, I updated to use that, LMK if works
only 0.124.3 @ homebrew at the moment (16:58:56 CEST)
@ericdallo, I downloaded it from the release-page. It works!
But™️
[MODELS] Provider 'github-copilot': /models endpoint returned status 401
@mgmart there was a missing place for models fetch, fixed in 0.124.5!
eca-emacs: 20260404.1817 | server: eca 0.124.5 | emacs: GNU Emacs 30.2 (build 1, aarch64-apple-darwin23.2.0, NS appkit-2487.30 Version 14.2 (Build 23C64)) of 2025-12-06
on load
[MODELS] Provider 'github-copilot': /models endpoint returned status 401
when using select model
[MODELS] Provider 'github-copilot': /models endpoint returned status 400
you can configure any model you want like this:
{
"providers": {
"github-copilot": {
"models": {
"gpt-5.4": {}
}
}
}
}
But the auto fetch models is suppose to work, probably we are missing something yet for GHE 🤔 @zikajk any clues? @mgmart feel free to open a new issue about this specific issue, to help track/fix it
@ericdallo Before the change I had got 400, now I have 401. I think I know what is the problem. I have fixed it in one of my unfinished branch (where I'd want to add model variants for Copilot and also dynamically determine the required API type). I almost forgot about that, I'll try to finish it up sometime soon.
@mgmart But it is functional for you at the moment, correct? Since your models are sourced from models.dev, you don't have an acute need for this?
@zikajk, no need for the moment because I can use the configuration option, @ericdallo provided yesterday.
But from what I see, models.dev is not used for github-copilot, only for anthropic, openai and google.
[MODELS] Provider 'google': /models endpoint returned status 400
[MODELS] Provider 'google': Using models.dev provider-id fallback (url 'https://generativelanguage.googleapis.com/v1beta/openai' not matched)
[MODELS] Provider 'google': Loaded 37 models from models.dev
[MODELS] Provider 'anthropic': /models endpoint returned status 401
[MODELS] Provider 'anthropic': Using models.dev provider-id fallback (url 'https://api.anthropic.com' not matched)
[MODELS] Provider 'anthropic': Loaded 22 models from models.dev
[MODELS] Provider 'openai': /models endpoint returned status 401
[MODELS] Provider 'openai': Using models.dev provider-id fallback (url 'https://api.openai.com' not matched)
[MODELS] Provider 'openai': Loaded 51 models from models.dev
[MODELS] Provider 'github-copilot': /models endpoint returned status 401
[MODELS] Fetched model catalogs from 3 providers in 271.1ms
[LLM-API] Default LLM model 'github-copilot/gpt-5.4' decision ':config-default-model'
@mgmart we use models.dev for any configured provider to auto fetch models, unless fetchModels config is false