copilot-api  by caozhiyuan

GitHub Copilot API as OpenAI/Anthropic compatible server

Created 7 months ago
465 stars

Top 65.2% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a reverse-engineered proxy for the GitHub Copilot API, transforming it into a server compatible with OpenAI and Anthropic APIs. It enables developers to integrate GitHub Copilot's code generation capabilities into tools and applications that natively support these popular API standards, such as Claude Code, Codex, or Opencode, offering enhanced flexibility and optimized request handling.

How It Works

The core of the project is a proxy that intercepts requests and forwards them to the GitHub Copilot API, exposing endpoints that mimic OpenAI's /v1/responses, /v1/chat/completions, and Anthropic's /v1/messages APIs. It intelligently routes requests, prioritizing Copilot's native Anthropic-style Messages API for Claude models to preserve tool-use semantics and reduce unnecessary premium request consumption. It also supports phase-aware commentary for specific models, making complex operations more transparent.

Quick Start & Requirements

  • Primary Install/Run:
    • Using npx: npx @jeffreycao/copilot-api@latest start
    • Using Docker: Build image (docker build -t copilot-api .) and run container (docker run -p 4141:4141 -v $(pwd)/copilot-data:/root/.local/share/copilot-api copilot-api).
  • Prerequisites: Bun (>= 1.2.x), a GitHub account with an active Copilot subscription (individual, business, or enterprise).
  • Links: Demo asset: https://github.com/user-attachments/assets/7654b383-669d-4eb9-b23c-06d7aefee8c5

Highlighted Details

  • Full OpenAI and Anthropic API compatibility across multiple endpoints.
  • Anthropic-First Routing for Claude models, preserving native behavior and optimizing premium usage.
  • Phase-aware commentary for gpt-5.4 and gpt-5.3-codex models.
  • Support for Claude native beta features like interleaved-thinking and advanced tool-use.
  • Subagent Marker Integration for seamless use with Claude Code and Opencode.
  • Web-based Usage Dashboard for monitoring API activity and quotas.
  • Rate limit control, manual request approval, and token visibility options.
  • Accurate Claude token counting via an optional Anthropic API key.

Maintenance & Community

This project is a detached fork of an older, unmaintained repository. While the README does not detail specific contributors, sponsorships, or community channels (like Discord/Slack), the active development implied by the fork suggests ongoing maintenance.

Licensing & Compatibility

The project's license is not explicitly stated in the README. This lack of clear licensing information poses a significant adoption blocker for commercial or sensitive use cases. It is designed for compatibility with tools supporting OpenAI and Anthropic APIs and works with various GitHub Copilot account types, including enterprise.

Limitations & Caveats

This is a reverse-engineered proxy and is not officially supported by GitHub; it may break unexpectedly. Excessive automated use can trigger GitHub's abuse-detection systems, potentially leading to account suspension. Using certain models with Claude Code requires careful configuration to avoid exceeding context window limits and risking bans. The README advises disabling multi-agent features when using Codex via GitHub Copilot due to potential billing logic issues. Native web search is not supported via the Copilot API.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
19
Issues (30d)
31
Star History
276 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.