copilot-api
GitHub Copilot, OpenAI Codex, OpenCode Go, and third-party AI provider gateway with OpenAI and Anthropic API compatibility.
copilot-api is a universal AI gateway that provides OpenAI and Anthropic API-compatible endpoints for connecting AI coding assistants to GitHub Copilot, OpenAI Codex, and third-party AI providers. It translates between different AI protocols (Chat Completions, Responses API, Messages API) so tools like Claude Code, OpenCode, and Codex can access multiple AI backends through a single local endpoint. The gateway handles authentication, protocol conversion, token usage tracking, and advanced features like context management, prompt caching, and web search, making it especially useful for developers who want to use GitHub Copilot with Claude Code or route multiple AI clients through one unified interface.
Key Features
Use Cases
- 01Running Claude Code with GitHub Copilot models instead of Anthropic's native API
- 02Connecting Codex to third-party AI providers like DeepSeek or DashScope alongside GitHub Copilot
- 03Routing multiple AI coding assistants (Claude Code, OpenCode, Codex) through a single local gateway
- 04Tracking token usage and costs across different AI models and providers in one dashboard
- 05Using GitHub Copilot's Messages API with tools that only support OpenAI Chat Completions
- 06Managing multiple Codex accounts and switching between them for different projects
Related Agents
View morehermes-agent
The agent that grows with you
agency-agents
A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.
openinterpreter
A coding agent for open models like Kimi K3
cline
Autonomous coding agent as an SDK, IDE extension, or CLI assistant.
copilot-api — FAQ
What is copilot-api?+
copilot-api is a local AI gateway that provides OpenAI and Anthropic compatible APIs for connecting AI coding assistants to GitHub Copilot, Codex, and third-party AI providers. It translates between different AI protocols so tools like Claude Code, OpenCode, and Codex can access multiple backends through one endpoint.
How do I install and start copilot-api?+
Run 'npx @jeffreycao/copilot-api@latest start' to start the gateway on http://localhost:4141. Optionally authenticate with 'npx @jeffreycao/copilot-api@latest auth login' to enable GitHub Copilot, or configure a third-party provider with 'npx @jeffreycao/copilot-api@latest auth login --provider deepseek' (or dashscope, kimi, openrouter, custom).
Which AI clients work with copilot-api?+
copilot-api works with Claude Code, OpenCode, Codex, and any OpenAI or Anthropic API-compatible client. Each client connects to the same local endpoint (http://localhost:4141) and the gateway handles protocol translation automatically.
Do I need a GitHub Copilot subscription?+
GitHub Copilot is optional. You can run copilot-api with only third-party providers (DeepSeek, DashScope, Kimi, OpenRouter, OpenCode Go) by configuring at least one provider with an API key. For GitHub Copilot access, you need an active Copilot subscription and GitHub account.
What are the prerequisites?+
Node.js >= 22.13.0 or Bun >= 1.2.x for running the CLI. Token usage storage requires Node.js >= 22.13.0 (where node:sqlite works without flags) or Bun. You'll need API keys for any third-party providers you want to use, and a GitHub Copilot subscription if accessing Copilot models.
Is copilot-api free and open source?+
Yes, copilot-api is open source under the MIT license. The gateway itself is free, but you'll need paid subscriptions or API keys for the AI providers you want to access (GitHub Copilot, DeepSeek, DashScope, etc.).
How do I install copilot-api?+
Open the source repository on GitHub and follow its README. copilot-api is a agent — MCP Agents Market links you directly to the official repo.
Is copilot-api free?+
copilot-api is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.