github-router
v0.3.351
Published
A reverse proxy that exposes GitHub Copilot as OpenAI and Anthropic compatible API endpoints.
Maintainers
Readme
github-router
Use your GitHub Copilot subscription to power Claude Code, Codex CLI, or any OpenAI/Anthropic-compatible tool.
github-router is a local reverse proxy that translates standard API formats to GitHub Copilot's backend. One command to start, copy-paste configs for your tools.
[!WARNING] Unofficial. Not supported by GitHub. May break. Use responsibly. Review the GitHub Copilot Terms and Acceptable Use Policies.
Quick Start
# 1. Authenticate (one-time)
bunx github-router@latest auth
# 2. Start the proxy
bunx github-router@latest startThe server runs at http://localhost:8787. Now pick your tool below.
Bun is the default runtime for developing and running github-router (
bunx,bun install,bun test). Plain Node.js 24/26 + npm stay supported (see thenode-compatCI lane) — everybunxcommand below has annpxequivalent.
Use with Claude Code
Option A: One-shot subcommand (recommended)
bunx github-router@latest claudeBoots the proxy on a random port and spawns Claude Code wired to it. Sets ANTHROPIC_MODEL=claude-opus-4-8 (Anthropic's dashed slug — Claude Code's /model UI displays this as menu entry "Opus 4.8 (1M context)"). The proxy translates to Copilot's claude-opus-4.8 at request time (single base slug; the catalog entry's max_context_window_tokens already advertises 1M context — no -1m sibling needed for 4.8). Major.minor fallback chain: claude-opus-4-7 → claude-opus-4-6 → claude-opus-4-5. Override with -m:
bunx github-router@latest claude -m claude-opus-4-8The launcher sanitizes parent-env auth keys and sets CLAUDE_CONFIG_DIR=$HOME/.claude so the spawned claude ignores any persisted Console OAuth credential without requiring claude /logout. Settings, MCP servers, hooks, and CLAUDE.md auto-discovery still load from ~/.claude as normal.
Option B: Interactive launch-command generator
bunx github-router@latest start --claude-codeSelect your models, a launch command gets copied to your clipboard. Paste it in a new terminal.
Option C: Copy-paste config
Create .claude/settings.json in your project:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:8787",
"ANTHROPIC_API_KEY": "dummy",
"ANTHROPIC_AUTH_TOKEN": "dummy",
"ANTHROPIC_MODEL": "gpt-4.1",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-4.1",
"ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1-mini",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-4.1-mini",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"deny": ["WebSearch"]
}
}Then run claude as normal.
Peer-MCP review subagents
github-router claude auto-wires four peer-model adversarial reviewers plus a coordinator into the spawned Claude Code session. No setup, no prior MCP config, no .claude/agents/ files needed — they appear as Task subagent_type options the session can delegate to. Opt out with --no-codex-mcp.
Each persona is exposed both as a Claude Code subagent (callable via the Task tool) AND as an MCP tool at mcp__peers__<name>. Personas are stateless: each invocation runs a fresh request against its model with a baked persona prompt — they have no access to your scrollback or project memory, so the lead must paste the artifact into the brief.
| Subagent | Model | Endpoint | Effort tiers (default) |
|---|---|---|---|
| codex-critic | gpt-5.6-sol | /v1/responses | low | medium | high | xhigh (xhigh) |
| codex-reviewer | gpt-5.3-codex | /v1/responses | low | medium | high | xhigh (xhigh) |
| gemini-reviewer | gemini-3.1-pro-preview | /v1/chat/completions | low | medium | high (high) |
| opus-critic | claude-opus-4-6 | /v1/messages | low | medium | high (high) |
| gemini-critic | gemini-3.1-pro-preview | /v1/chat/completions | low | medium | high (high) |
| peer-review-coordinator | (meta) | — | — |
peer-review-coordinator is a subagent (not an MCP tool) that fans out to the right combination of the critics in parallel based on artifact type — plan, diff, single file, or long-context — and aggregates findings.
Effort tiers are exposed via the MCP tool's effort argument; subagents pass it through. xhigh routinely runs 60–90s; the proxy responds to tools/call requests with SSE-streamed responses (per MCP 2025-06-18 Streamable HTTP transport spec) so the connection stays open past the standard ~60s MCP per-tool-call ceiling and long calls complete transparently with no user setup.
gemini-critic and gemini-reviewer both register only when gemini-3.1-pro-preview (or another gemini-3.x-pro model) is present in your Copilot model catalog — gemini-critic is the architecture-level critic, gemini-reviewer the line-level second-lab code reviewer on the same model at its highest reasoning tier. If absent, both personas are silently dropped from the MCP tools/list and the subagent set, and peer-review-coordinator skips them in routing decisions.
Native subagents
The launcher also registers focused native subagents that run in their own contexts. implementer, reviewer, brainstorm, and scribe are always present. Each uses its preferred model when the live catalog provides one with tool calls, otherwise it inherits the lead model; scout, implementer-fast, reviewer-fast, and general-purpose-fast are present only when their cheap-tier model chains resolve, so the work they exist to make cheaper does not silently run at the lead's model rate.
| Subagent | Use for | Preferred model chain | Tools |
|---|---|---|---|
| implementer | Coding changes needing judgment or with ambiguous scope | gpt-5.6-sol → gpt-6-sol → gpt-5.5 | Full inherited toolset |
| implementer-fast | Well-specified, mechanical coding changes | gpt-5.6-terra → gemini-3.1-pro-preview | Full inherited toolset |
| reviewer | Assessing an existing diff, plan, document, or failure | gemini-3.1-pro-preview → gemini-3.8-flash → OpenAI frontier | Full inherited toolset |
| reviewer-fast | Lower-stakes assessment on a cheaper cross-lab model | gemini-3.8-flash | Full inherited toolset |
| brainstorm | Divergent approaches before selecting one | gemini-3.1-pro-preview → gemini-3.8-flash → OpenAI frontier | Read-only allowlist |
| scout | Low-cost repository exploration | gpt-6-luna → gemini-3.8-flash | Read-only allowlist |
| scribe | Documentation that trails the code | gpt-5.6-terra → OpenAI frontier | Full inherited toolset |
| general-purpose-fast | Work no specialist fits | gpt-6-luna | Full inherited toolset |
For codex-side write capability (a codex-implementer persona that can mutate files via Codex's tool-use sandbox), pass --codex-cli. Requires codex CLI 0.129+ on PATH; falls back to HTTP-only with a warning if codex is missing or older. Pass --codex-mcp-only to also pass --strict-mcp-config to Claude Code so only the proxy's MCP servers are loaded (hides any MCP servers in your existing ~/.claude/mcp.json).
Code search (mcp__search__code)
Alongside the peer reviewers, the same MCP surface exposes a code tool (under the search server — mcp__search__code) — fast structured code search over the workspace. Without a search flag it uses the local lexical engine. Pass --search for router-managed local ColBERT semantic search with transparent lexical fallback, or --bluebird to route semantic and lexical modes through the Bluebird Azure DevOps index. Bluebird failures remain visible and never silently fall back locally; exact, regex, and ast always stay local. The flags are independent, so --bluebird alone never provisions local ColBERT artifacts. See local semantic search and the Bluebird protocol and routing reference.
The local lexical engine ranks with BM25F (Robertson, Zaragoza, Taylor 2004) over matched lines, context, paths, and symbol definitions, then refines top hits with tree-sitter. Single-identifier queries auto-expand across camelCase / snake_case / kebab-case skeletons so getUserName also matches get_user_name. workspace is any absolute path the proxy process can read, and result paths are repository-relative rather than absolute.
Ripgrep is provided via the @vscode/ripgrep npm dependency (per-platform binary via optionalDependencies — no postinstall script needed). The proxy prefers system rg on PATH when available and falls back to the bundled binary otherwise. To opt into raw query/path logging for debugging, set GH_ROUTER_DEBUG_CODE_SEARCH=1 — by default the proxy logs only counts and timings.
Use with Codex CLI
The fastest path is the codex subcommand — it boots the proxy on a random port and spawns Codex CLI wired to it:
bunx github-router@latest codexDefaults to gpt-5.6-sol; falls back to gpt-6-sol → gpt-5.5 → gpt-5.4 → gpt-5.3-codex → gpt-5.2-codex if your Copilot tier doesn't expose 5.6-sol yet. Override with -m:
bunx github-router@latest codex -m gpt-5.3-codexOr run the proxy and Codex CLI separately:
bunx github-router@latest start --codex # interactive launch-command generator
# — or set env vars yourself —
export OPENAI_BASE_URL="http://localhost:8787/v1"
export OPENAI_API_KEY="dummy"
codex --full-auto -m gpt-5.6-solUse with any OpenAI-compatible tool
Point any tool at http://localhost:8787/v1:
curl http://localhost:8787/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4.1", "messages": [{"role": "user", "content": "Hello"}]}'API Endpoints
| Endpoint | Method | Format |
|---|---|---|
| /v1/chat/completions | POST | OpenAI Chat Completions |
| /v1/responses | POST | OpenAI Responses (Codex models) |
| /v1/messages | POST | Anthropic Messages |
| /v1/messages/count_tokens | POST | Anthropic token counting |
| /v1/models | GET | OpenAI model list |
| /v1/embeddings | POST | OpenAI embeddings |
| /v1/search | POST | Web search |
| /usage | GET | Copilot usage & quotas |
OpenAI-compatible endpoints are also available without the /v1 prefix (for example, /chat/completions).
Anthropic endpoints are only available under /v1/messages.
| Model | /chat/completions | /responses | /v1/messages | |---|---|---|---| | gpt-4.1, gpt-4o | Yes | Yes | No | | gpt-5.6-sol, gpt-6-sol, gpt-5.5, gpt-5.4 | No | Yes | No | | gpt-5.3-codex, gpt-5.2-codex | No | Yes | No | | claude-opus-4.8 (1M context as the single base slug) | Yes | No | Yes | | claude-opus-4.7-1m-internal (enterprise), claude-opus-4.7 | Yes | No | Yes | | claude-opus-4.6-1m, claude-opus-4.6, claude-sonnet-4.6 | Yes | No | Yes | | o3, o4-mini | Yes | Yes | No |
Docker
Pre-built images on GitHub Container Registry:
docker pull ghcr.io/animeshkundu/github-router:latest
docker run -p 8787:8787 -e GH_TOKEN=your_token ghcr.io/animeshkundu/github-routerOr build locally:
docker build -t github-router .
docker run -p 8787:8787 -e GH_TOKEN=your_token github-routerservices:
github-router:
build: .
ports:
- "8787:8787"
environment:
- GH_TOKEN=your_github_token_here
restart: unless-stoppedmkdir -p ./github-router-data
docker run -p 8787:8787 -v $(pwd)/github-router-data:/root/.local/share/github-router github-routerCLI Reference
github-router start [options] Start the proxy server
github-router claude [options] Start proxy + spawn Claude Code wired to it
github-router codex [options] Start proxy + spawn Codex CLI wired to it
github-router auth Authenticate with GitHub
github-router check-usage Show Copilot usage/quotas
github-router debug Print diagnostic infoThe claude and codex subcommands accept all the shared flags below plus -m/--model to override the default model. Default models live in src/lib/port.ts:
claude→claude-opus-4-8(Anthropic dashed slug for UI compatibility; the proxy translates to Copilot'sclaude-opus-4.8— the single base slug already advertises 1M context viamax_context_window_tokens, so no-1msibling exists). Major.minor fallback chain:claude-opus-4-7→claude-opus-4-6→claude-opus-4-5.codex→gpt-5.6-sol→gpt-6-sol→gpt-5.5→gpt-5.4→gpt-5.3-codex→gpt-5.2-codex
Fallback chains fire only on the implicit-default path; explicit -m/--model is always respected as-is.
| Flag | Description | Default |
|---|---|---|
| --port, -p | Port | 8787 |
| --verbose, -v | Debug logging | false |
| --account-type, -a | individual / business / enterprise | individual |
| --rate-limit, -r | Min seconds between requests | - |
| --wait, -w | Queue requests instead of rejecting on rate limit | false |
| --manual | Approve each request manually | false |
| --github-token, -g | Pass token directly (skip auth flow) | - |
| --claude-code, -c | Generate Claude Code launch command | false |
| --codex | Generate Codex CLI launch command | false |
| --show-token | Print tokens to console | false |
| --proxy-env | Use HTTP_PROXY/HTTPS_PROXY env vars | false |
| --search | Enable router-managed local ColBERT semantic search with lexical fallback | false |
| --bluebird | Route semantic and lexical code search through Bluebird; keep exact/regex/AST local | false |
Additional flags accepted only by the claude subcommand:
| Flag | Description | Default |
|---|---|---|
| --model, -m | Override the default Claude model | claude-opus-4-8 |
| --codex-mcp / --no-codex-mcp | Wire peer-MCP review subagents (codex-critic / opus-critic / gemini-critic / codex-reviewer / peer-review-coordinator) into the spawned session | true |
| --codex-cli | Add a codex mcp-server stdio backend so codex-implementer can mutate files. Requires codex CLI 0.129+; falls back to HTTP-only if absent | false |
| --codex-mcp-only | Pass --strict-mcp-config to Claude Code so only the proxy's MCP servers load (hides any user MCP servers in ~/.claude/mcp.json) | false |
| --stealth | Opt back into VS Code-only beta-header filtering. Loses leverage features (task budgets, token-efficient tools, prompt caching, etc.) but minimizes the wire-fingerprint diff from VS Code Copilot Chat | false |
| --auto-update / --no-auto-update | Check for and install latest Claude Code on launch (throttled to once per hour). Falls back gracefully if npm/network unavailable | true |
| --update-check / --no-update-check | Check the npm registry for a newer Claude Code version on launch and warn if stale (~500ms cost). --no-update-check implies no auto-install | true |
Development
bun install # Install deps
bun run dev # Dev server with hot reload
bun test # Run tests
bun run lint:all # Lint
bun run typecheck # Type check
bun run build # Build for distribution