A lightweight and secure API proxy deployed on serverless platforms that exposes your GitHub Copilot subscription as standard Anthropic Messages API and OpenAI Responses API endpoints — letting you use Claude Code, Codex CLI, and other coding agents through Copilot.
Copilot Gateway translates between API formats on the fly:
- Claude Code talks Anthropic Messages API → Gateway translates to whatever Copilot supports for that model
- Codex CLI talks OpenAI Responses API → Gateway translates or passes through accordingly
- Any OpenAI-compatible client can use the Chat Completions endpoint — Gateway translates to Messages or Responses API as needed
The gateway auto-detects each model's supported endpoints (native Messages, Responses, or Chat Completions) and picks the best translation path. When endpoint metadata says a request can use more than one upstream API, planning chooses among those native endpoints directly. Request-shape validation is left to the selected upstream endpoint unless a documented workaround needs to patch the request or response at that boundary.
Tip: This project ships with a detailed
AGENTS.mdthat describes the full architecture, API routes, translation layer, and workarounds. Point your coding agent at it (Claude Code and Codex CLI will read it automatically) and ask it to explore.
- A GitHub account with an active Copilot subscription
- Deno (>= 2.4) or Node.js (for Cloudflare Workers via wrangler)
# Clone and enter the project
git clone https://github.com/user/copilot-gateway.git
cd copilot-gateway
# Set the admin key (used to log in to the dashboard)
# On Deno Deploy, set this as an environment variable in the dashboard
export ADMIN_KEY=your-secret-admin-key
# Local development
deno task dev
# Deploy to production (requires Deno >= 2.4)
deno deploy --prod# Install dependencies (needed for wrangler and type stubs)
pnpm install
# Create the D1 database
wrangler d1 create copilot-db
# Update wrangler.jsonc with your account_id and database_id, then apply migrations
wrangler d1 migrations apply copilot-db
# Set the admin key as a secret
wrangler secret put ADMIN_KEY
# Local development
wrangler dev
# Deploy to production
wrangler deploy- Open the deployed URL in a browser, log in with your
ADMIN_KEY - Go to the Upstream tab and connect your GitHub account (the one with a Copilot subscription) via the device OAuth flow
- Go to the API Keys tab and create an API key for your client
- The API Keys tab shows ready-to-copy configuration snippets for both Claude Code and Codex CLI
Anthropic-native-looking web search is available only on /v1/messages and
/messages when the request stays on the native Messages target.
Configure it in the dashboard under Upstream -> Search.
Provider choices:
disabledtavilymicrosoft-grounding
The gateway stores this search config in its control-plane data, not env vars, and includes it in export/import.
Claude Code / Codex CLI / any client
│
▼
Copilot Gateway (Hono)
├── POST /v1/messages ← Anthropic Messages API
├── POST /v1/responses ← OpenAI Responses API
├── POST /v1/chat/completions ← OpenAI Chat Completions
├── POST /v1/embeddings ← Embeddings passthrough
└── GET /v1/models ← Model listing
│
▼ (auto-selects translation path per model)
GitHub Copilot API
95% of the code is platform-agnostic (Hono + Web APIs). Platform-specific storage is abstracted behind a repository layer —
DenoKvRepofor Deno Deploy,D1Repofor Cloudflare Workers.
MIT