Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

github-router

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-router

A reverse proxy that exposes GitHub Copilot as OpenAI and Anthropic compatible API endpoints.

Source
npmnpm
Version
0.3.42
Version published
Weekly downloads
1.3K
-1.81%
Maintainers
1
Weekly downloads
 
Created
Source

github-router

CI npm License: MIT

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)
npx github-router@latest auth

# 2. Start the proxy
npx github-router@latest start

The server runs at http://localhost:8787. Now pick your tool below.

Use with Claude Code

Option A: One-shot subcommand (recommended)

npx github-router@latest claude

Boots the proxy on a random port and spawns Claude Code wired to it. Sets ANTHROPIC_MODEL=claude-opus-4-7 (Anthropic's dashed slug — Claude Code's /model UI displays this as menu entry "Opus 4.7 (1M context)"). The proxy translates to Copilot's claude-opus-4.7-1m-internal on enterprise tokens or claude-opus-4.7 on Pro+/Business/Max at request time. Major.minor fallback chain: claude-opus-4-6claude-opus-4-5. Override with -m:

npx github-router@latest claude -m claude-opus-4-7

The 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

npx github-router@latest start --claude-code

Select 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__gh-router-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.

SubagentModelEndpointEffort tiers (default)
codex-criticgpt-5.5/v1/responseslow | medium | high | xhigh (xhigh)
codex-reviewergpt-5.3-codex/v1/responseslow | medium | high | xhigh (xhigh)
opus-criticclaude-opus-4-7/v1/messageslow | medium | high | xhigh (xhigh)
gemini-criticgemini-3.1-pro-preview/v1/chat/completionslow | 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 four 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. All four tiers are accepted on every persona. 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 only registers when gemini-3.1-pro-preview is present in your Copilot model catalog. If absent, the persona is silently dropped from both the MCP tools/list and the subagent set, and peer-review-coordinator skips it in routing decisions.

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).

Alongside the peer reviewers, the same MCP surface exposes a code_search tool — fast structured code search over the workspace, ranked by BM25F (Robertson, Zaragoza, Taylor 2004) over four code-aware fields: matched line, surrounding context, file path tokens, and a symbol-definition heuristic. On top of that, the top hits get a tree-sitter pass that promotes true identifier-definition sites over incidental string matches; depth is controlled by the optional structural argument ("full" parses the top 50 hits, "topN" parses the top 10 for tighter latency on big repos). A single notice field surfaces in the response on the rare occasions an actionable degradation fires — the structural pass overran its 200ms wall-clock budget, or the response hit the 256KB size cap and was truncated; the message text tells the model what to retry. Defaults to a "ranked" mode with shoulder pruning so models get the few right answers, not a flood of substring matches. literal and regex modes are also available for exact searches; single-identifier queries in ranked/literal mode 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 — typically the project root or a sub-tree you're working in. The model picks it. There's no allow-set or secret-shape file denylist: the threat model is symmetric since Claude Code already has Read / Bash / Edit tools that reach the same paths, so gating one tool would have been inconsistency rather than defense. Paths in results are returned relative to the workspace, never 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:

npx github-router@latest codex

Defaults to gpt-5.5; falls back to gpt-5.4gpt-5.3-codexgpt-5.2-codex if your Copilot tier doesn't expose 5.5 yet. Override with -m:

npx github-router@latest codex -m gpt-5.3-codex

Or run the proxy and Codex CLI separately:

npx 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.5

Use 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

EndpointMethodFormat
/v1/chat/completionsPOSTOpenAI Chat Completions
/v1/responsesPOSTOpenAI Responses (Codex models)
/v1/messagesPOSTAnthropic Messages
/v1/messages/count_tokensPOSTAnthropic token counting
/v1/modelsGETOpenAI model list
/v1/embeddingsPOSTOpenAI embeddings
/v1/searchPOSTWeb search
/usageGETCopilot 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 / endpoint compatibility
Model/chat/completions/responses/v1/messages
gpt-4.1, gpt-4oYesYesNo
gpt-5.5, gpt-5.4NoYesNo
gpt-5.3-codex, gpt-5.2-codexNoYesNo
claude-opus-4.7-1m-internal (enterprise), claude-opus-4.7YesNoYes
claude-opus-4.6-1m, claude-opus-4.6, claude-sonnet-4.6YesNoYes
o3, o4-miniYesYesNo

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-router

Or build locally:

docker build -t github-router .
docker run -p 8787:8787 -e GH_TOKEN=your_token github-router
Docker Compose
services:
  github-router:
    build: .
    ports:
      - "8787:8787"
    environment:
      - GH_TOKEN=your_github_token_here
    restart: unless-stopped
Persistent token storage
mkdir -p ./github-router-data
docker run -p 8787:8787 -v $(pwd)/github-router-data:/root/.local/share/github-router github-router

CLI 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 info

The 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:

  • claudeclaude-opus-4-7 (Anthropic dashed slug for UI compatibility; the proxy translates to Copilot's claude-opus-4.7-1m-internal on enterprise or claude-opus-4.7 elsewhere). Major.minor fallback chain: claude-opus-4-6claude-opus-4-5.
  • codexgpt-5.5gpt-5.4gpt-5.3-codexgpt-5.2-codex

Fallback chains fire only on the implicit-default path; explicit -m/--model is always respected as-is.

FlagDescriptionDefault
--port, -pPort8787
--verbose, -vDebug loggingfalse
--account-type, -aindividual / business / enterpriseindividual
--rate-limit, -rMin seconds between requests-
--wait, -wQueue requests instead of rejecting on rate limitfalse
--manualApprove each request manuallyfalse
--github-token, -gPass token directly (skip auth flow)-
--claude-code, -cGenerate Claude Code launch commandfalse
--codexGenerate Codex CLI launch commandfalse
--show-tokenPrint tokens to consolefalse
--proxy-envUse HTTP_PROXY/HTTPS_PROXY env varsfalse

Additional flags accepted only by the claude subcommand:

FlagDescriptionDefault
--model, -mOverride the default Claude modelclaude-opus-4-7
--codex-mcp / --no-codex-mcpWire peer-MCP review subagents (codex-critic / opus-critic / gemini-critic / codex-reviewer / peer-review-coordinator) into the spawned sessiontrue
--codex-cliAdd a codex mcp-server stdio backend so codex-implementer can mutate files. Requires codex CLI 0.129+; falls back to HTTP-only if absentfalse
--codex-mcp-onlyPass --strict-mcp-config to Claude Code so only the proxy's MCP servers load (hides any user MCP servers in ~/.claude/mcp.json)false
--stealthOpt 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 Chatfalse
--auto-update / --no-auto-updateCheck for and install latest Claude Code on launch (throttled to once per hour). Falls back gracefully if npm/network unavailabletrue
--update-check / --no-update-checkCheck the npm registry for a newer Claude Code version on launch and warn if stale (~500ms cost). --no-update-check implies no auto-installtrue

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

License

MIT

Keywords

proxy

FAQs

Package last updated on 01 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts