GitHub Copilot, OpenAI Codex, OpenCode Go, and third-party AI provider gateway with OpenAI and Anthropic API compatibility.
See the code
Universal AI Gateway
One Gateway. Any Client. Multiple AI Providers.
Chat Completions · OpenAI Responses · Anthropic Messages
English | 简体中文
Copilot API is a local AI gateway that connects Claude Code, OpenCode, Codex, and other clients to GitHub Copilot, the built-in Codex and xAI providers, and third-party model providers through a unified API.
/v1/chat/completions), the OpenAI Responses API (/v1/responses), and Anthropic-compatible Messages (/v1/messages) from one local endpoint.codex and xai providers, and third-party providers (Kimi, DeepSeek, DashScope, OpenRouter, OpenCode Go, or a custom provider from models.dev) behind the same gateway. GitHub Copilot is optional — with at least one enabled provider, the server starts in provider-only mode without a GitHub token.codex provider uses WebSocket by default and uses HTTP when useResponsesApiWebSocket is disabled.Requires Node.js >= 22.13.0 (npx) or Bun >= 1.2.x. A Copilot subscription is needed only for the GitHub Copilot provider; other configured providers can run independently.
npx @jeffreycao/copilot-api@latest start
The server listens on http://localhost:4141 by default. Optionally authenticate with GitHub Copilot or configure a third-party provider first:
npx @jeffreycao/copilot-api@latest auth login
Verify the gateway is up:
curl http://localhost:4141/v1/models
[!NOTE] Token usage storage requires Node.js >= 22.13.0 or Bun. See Using with npx for details.
From here, jump to the guide for your client: Claude Code, OpenCode, Codex, or run it with Docker.
Every client talks to the same local endpoint. The gateway routes each request to GitHub Copilot, the built-in codex or xai provider, or a configured third-party provider, translating between protocols when the provider speaks a different one.
Client / Protocol Matrix
| Client | Chat Completions | Responses | Anthropic Messages | Recommended |
|---|---|---|---|---|
| Claude Code | — | — | ✅ Native / Adapter | Anthropic Messages |
| OpenCode | ✅ Native | ✅ Native / Adapter | ✅ Native / Adapter via @ai-sdk/anthropic | Anthropic Messages |
| Codex | — | ✅ Native / Adapter | — | Responses |
| OpenAI-compatible clients | ✅ Native | ✅ Native / Adapter | — | Chat Completions |
| Anthropic-compatible clients | — | — | ✅ Native / Adapter | Anthropic Messages |
Providers and protocols. Protocol support is model-specific. Chat Completions requires a native endpoint, while Responses and Messages can use supported adapters. The built-in codex provider uses Responses natively; third-party providers can use anthropic, openai-compatible, or openai-responses, with per-model overrides.
Prefer a GUI? The Electron desktop app in desktop/ covers GitHub Copilot sign-in, OpenAI Codex and xAI OAuth, and API-key configuration for Kimi, DeepSeek, DashScope, OpenRouter, or a custom provider from models.dev — with one-click start/stop of the local server, and the local endpoint, auth header, available models, usage, and logs in one window.
Windows x64 (.exe), macOS Apple Silicon (.dmg), and Linux x64 (.AppImage) packages are published in GitHub Releases. See Electron Desktop App for full setup and advanced configuration.
| Guide | Contents |
|---|---|
| Installation and Startup | Prerequisites, project overview, npx and source runs, provider-only mode without Copilot, and gateway API key setup |
| Claude Code | settings.json, gateway model discovery, model mappings, auto-compact window, and WebSearch behavior |
| OpenCode | OpenCode OAuth login, the @ai-sdk/anthropic provider in opencode.json, baseURL conventions, model context limits, and thinking options |
| Codex | A full config.toml provider block, GITHUB_COPILOT_API_KEY environment variable setup, auto-review model mapping, generating model_catalog.json, and the merged model picker catalog with protocol adapters |
| Docker | Docker Compose quick start, the /data persistent mount and its ownership repair, supported environment variables, and host interface binding |
| Desktop App | Copilot sign-in, Codex OAuth account switching, API-key providers, one-click start / stop, shared model mappings, advanced settings, and per-platform installers |
| Plugins and Tool Search | The Responses tool_search MCP bridge (not needed on opencode v2, which already defers tools through Code Mode), Claude Code agent-inject and tool-search marketplace plugins, and the opencode subagent marker plugin |
| Usage Monitoring | The usage viewer URL and query parameters, period selectors, Copilot quota progress, token and cost metric cards, trend charts, and paginated request events |
| CLI Reference | Command structure, global options, and the full option sets for the start, auth, and debug subcommands with example usage |
| Configuration Reference | Every config.json field: gateway and admin API keys, provider definitions, model mappings, WebSocket and HTTP transport, timeouts, and context management |
| API and Authentication | Allowed auth headers and CORS rules, OpenAI, Codex backend, and Anthropic endpoints, usage monitoring routes, and admin configuration endpoints |
| Troubleshooting | Fixes for Copilot encrypted output failures and missing Claude models |
Before using GitHub Copilot, read the GitHub Copilot Security Notice.
400 followers · starred Jun 2026
155 followers · starred Aug 2026
321 followers · starred Sep 2026
375 followers · starred Mar 2026
GitHub Copilot, OpenAI Codex, OpenCode Go, and third-party AI provider gateway with OpenAI and Anthropic API compatibility.
See the code
Universal AI Gateway
One Gateway. Any Client. Multiple AI Providers.
Chat Completions · OpenAI Responses · Anthropic Messages
English | 简体中文
Copilot API is a local AI gateway that connects Claude Code, OpenCode, Codex, and other clients to GitHub Copilot, the built-in Codex and xAI providers, and third-party model providers through a unified API.
/v1/chat/completions), the OpenAI Responses API (/v1/responses), and Anthropic-compatible Messages (/v1/messages) from one local endpoint.codex and xai providers, and third-party providers (Kimi, DeepSeek, DashScope, OpenRouter, OpenCode Go, or a custom provider from models.dev) behind the same gateway. GitHub Copilot is optional — with at least one enabled provider, the server starts in provider-only mode without a GitHub token.codex provider uses WebSocket by default and uses HTTP when useResponsesApiWebSocket is disabled.Requires Node.js >= 22.13.0 (npx) or Bun >= 1.2.x. A Copilot subscription is needed only for the GitHub Copilot provider; other configured providers can run independently.
npx @jeffreycao/copilot-api@latest start
The server listens on http://localhost:4141 by default. Optionally authenticate with GitHub Copilot or configure a third-party provider first:
npx @jeffreycao/copilot-api@latest auth login
Verify the gateway is up:
curl http://localhost:4141/v1/models
[!NOTE] Token usage storage requires Node.js >= 22.13.0 or Bun. See Using with npx for details.
From here, jump to the guide for your client: Claude Code, OpenCode, Codex, or run it with Docker.
Every client talks to the same local endpoint. The gateway routes each request to GitHub Copilot, the built-in codex or xai provider, or a configured third-party provider, translating between protocols when the provider speaks a different one.
Client / Protocol Matrix
| Client | Chat Completions | Responses | Anthropic Messages | Recommended |
|---|---|---|---|---|
| Claude Code | — | — | ✅ Native / Adapter | Anthropic Messages |
| OpenCode | ✅ Native | ✅ Native / Adapter | ✅ Native / Adapter via @ai-sdk/anthropic | Anthropic Messages |
| Codex | — | ✅ Native / Adapter | — | Responses |
| OpenAI-compatible clients | ✅ Native | ✅ Native / Adapter | — | Chat Completions |
| Anthropic-compatible clients | — | — | ✅ Native / Adapter | Anthropic Messages |
Providers and protocols. Protocol support is model-specific. Chat Completions requires a native endpoint, while Responses and Messages can use supported adapters. The built-in codex provider uses Responses natively; third-party providers can use anthropic, openai-compatible, or openai-responses, with per-model overrides.
Prefer a GUI? The Electron desktop app in desktop/ covers GitHub Copilot sign-in, OpenAI Codex and xAI OAuth, and API-key configuration for Kimi, DeepSeek, DashScope, OpenRouter, or a custom provider from models.dev — with one-click start/stop of the local server, and the local endpoint, auth header, available models, usage, and logs in one window.
Windows x64 (.exe), macOS Apple Silicon (.dmg), and Linux x64 (.AppImage) packages are published in GitHub Releases. See Electron Desktop App for full setup and advanced configuration.
| Guide | Contents |
|---|---|
| Installation and Startup | Prerequisites, project overview, npx and source runs, provider-only mode without Copilot, and gateway API key setup |
| Claude Code | settings.json, gateway model discovery, model mappings, auto-compact window, and WebSearch behavior |
| OpenCode | OpenCode OAuth login, the @ai-sdk/anthropic provider in opencode.json, baseURL conventions, model context limits, and thinking options |
| Codex | A full config.toml provider block, GITHUB_COPILOT_API_KEY environment variable setup, auto-review model mapping, generating model_catalog.json, and the merged model picker catalog with protocol adapters |
| Docker | Docker Compose quick start, the /data persistent mount and its ownership repair, supported environment variables, and host interface binding |
| Desktop App | Copilot sign-in, Codex OAuth account switching, API-key providers, one-click start / stop, shared model mappings, advanced settings, and per-platform installers |
| Plugins and Tool Search | The Responses tool_search MCP bridge (not needed on opencode v2, which already defers tools through Code Mode), Claude Code agent-inject and tool-search marketplace plugins, and the opencode subagent marker plugin |
| Usage Monitoring | The usage viewer URL and query parameters, period selectors, Copilot quota progress, token and cost metric cards, trend charts, and paginated request events |
| CLI Reference | Command structure, global options, and the full option sets for the start, auth, and debug subcommands with example usage |
| Configuration Reference | Every config.json field: gateway and admin API keys, provider definitions, model mappings, WebSocket and HTTP transport, timeouts, and context management |
| API and Authentication | Allowed auth headers and CORS rules, OpenAI, Codex backend, and Anthropic endpoints, usage monitoring routes, and admin configuration endpoints |
| Troubleshooting | Fixes for Copilot encrypted output failures and missing Claude models |
Before using GitHub Copilot, read the GitHub Copilot Security Notice.
400 followers · starred Jun 2026
155 followers · starred Aug 2026
321 followers · starred Sep 2026
375 followers · starred Mar 2026