Problem or Use Case
Summary
The current Copilot provider only works with github.com. It does not support GitHub Enterprise Server (GHE) instances where the Copilot token endpoint and proxy
are hosted on a custom domain.
Current Behavior
When selecting "GitHub Copilot" via hermes model, the OAuth device code flow always redirects to https://github.com/login/device. The Copilot token endpoint is
hardcoded to https://api.github.com/copilot_internal/v2/token.
For GHE Server users, this results in:
- OAuth login pointing to the wrong host
- Token exchange returning
401 Bad credentials (because the GHE token is not valid on api.github.com)
Proposed Solution
Add a config option copilot.github_host (default: github.com).
Example config (~/.hermes/config.yaml):
copilot:
github_host: "ghe.example.com"
Or via env var: COPILOT_GITHUB_HOST=ghe.example.com
Changes needed:
- Auto-detect from
~/.config/github-copilot/apps.json — if a GHE host entry exists, offer it during hermes model setup
- OAuth device flow should target
https://{github_host}/login/device instead of hardcoded https://github.com/login/device
- Token endpoint should use
https://{github_host}/api/v3/copilot_internal/v2/token instead of https://api.github.com/copilot_internal/v2/token
- Use the
endpoints object from the token response dynamically (it returns endpoints.proxy, endpoints.api) instead of hardcoding github.com URLs
Alternatives Considered
Tried using "Enter a token manually" with the GHE OAuth token, but Hermes still calls api.github.com for token exchange,
which rejects the GHE token with 401.
Feature Type
Configuration option
Scope
Small (single file, < 50 lines)
Contribution
Debug Report (optional)
Problem or Use Case
Summary
The current Copilot provider only works with
github.com. It does not support GitHub Enterprise Server (GHE) instances where the Copilot token endpoint and proxyare hosted on a custom domain.
Current Behavior
When selecting "GitHub Copilot" via
hermes model, the OAuth device code flow always redirects tohttps://github.com/login/device. The Copilot token endpoint ishardcoded to
https://api.github.com/copilot_internal/v2/token.For GHE Server users, this results in:
401 Bad credentials(because the GHE token is not valid onapi.github.com)Proposed Solution
Add a config option
copilot.github_host(default:github.com).Example config (
~/.hermes/config.yaml):Or via env var:
COPILOT_GITHUB_HOST=ghe.example.comChanges needed:
~/.config/github-copilot/apps.json— if a GHE host entry exists, offer it duringhermes modelsetuphttps://{github_host}/login/deviceinstead of hardcodedhttps://github.com/login/devicehttps://{github_host}/api/v3/copilot_internal/v2/tokeninstead ofhttps://api.github.com/copilot_internal/v2/tokenendpointsobject from the token response dynamically (it returnsendpoints.proxy,endpoints.api) instead of hardcoding github.com URLsAlternatives Considered
Tried using "Enter a token manually" with the GHE OAuth token, but Hermes still calls api.github.com for token exchange,
which rejects the GHE token with 401.
Feature Type
Configuration option
Scope
Small (single file, < 50 lines)
Contribution
Debug Report (optional)