omp-github-copilot-legacy
v0.1.0
Published
omp extension: github-copilot-legacy provider via OAuth device flow + Copilot REST API (no Copilot CLI/SDK)
Readme
omp-github-copilot-legacy
An omp extension that registers a github-copilot-legacy
provider. It talks to GitHub Copilot through the classic editor REST flow —
OAuth device flow plus copilot_internal/v2/token exchange — with no
Copilot CLI / SDK involved.
How it differs from the built-in github-copilot provider
| | built-in github-copilot | github-copilot-legacy (this extension) |
| ------------------- | -------------------------------------- | --------------------------------------------- |
| OAuth app | Copilot CLI app (Ov23ct…) | Legacy editor app (Iv1.b507a08c87ecfe98) |
| API credential | GitHub OAuth token used directly | Short-lived Copilot token from GET api.github.com/copilot_internal/v2/token, auto-refreshed |
| Token lifetime | ~10 years (far-future expiry) | ~30 min (expires_at/refresh_in), minus 2 min safety margin |
| Request identity | Copilot-Integration-Id: copilot-developer-cli, Copilot-Harness-Id: copilot-sdk | Copilot-Integration-Id: vscode-chat, GitHubCopilotChat UA, no SDK headers |
| Transport | Per-model routes (completions / responses / Anthropic) | openai-completions (<api>/chat/completions) for every model |
| Model catalog | Bundled + live discovery | 3 static fallbacks + live /models discovery |
Install
Use it once:
omp -e /path/to/omp-github-copilot-legacy/src/index.tsOr link it persistently as a plugin:
omp plugin link /path/to/omp-github-copilot-legacyLogin
In omp, run /login and pick GitHub Copilot (Legacy REST). A device
code is shown; approve it at https://github.com/login/device. Login
exchanges the GitHub token for a short-lived Copilot token and stores:
refresh: long-lived GitHub OAuth token (ghu_/gho_)access: short-lived Copilot bearer (drives omp auto-refresh viaexpires)apiEndpoint: plan-specific host (api.githubcopilot.comorapi.business.githubcopilot.com, drives per-request routing)
Then select a model, e.g.:
omp --model github-copilot-legacy/gpt-4oEnvironment
GITHUB_COPILOT_LEGACY_CLIENT_ID— override the legacy OAuth app id (defaultIv1.b507a08c87ecfe98).GITHUB_COPILOT_LEGACY_BASE_URL— redirect the transport (forward proxy or local test server). Normal use never sets this.
Limitations
- Personal
github.comOAuth only; no Enterprise-host prompt in v1 (business-plan accounts still work — the token exchange advertises theapi.business.githubcopilot.comendpoint automatically). - No thinking-effort dial: models register with
reasoning: false, so the effort selector is hidden. Models themselves work normally. - Usage is billed against your Copilot subscription; recorded cost is 0.
Development
bun install
bun test # 24 unit tests, mocked fetch, no network
bunx tsc --noEmitsrc/copilot-legacy.ts holds all protocol logic behind an injectable
fetch; src/index.ts is the thin pi.registerProvider wiring.
End-to-end wire verification is done against a local capture server
(GITHUB_COPILOT_LEGACY_BASE_URL=http://127.0.0.1:PORT + --api-key),
asserting the request line, Bearer auth, legacy headers, and SSE parsing.
