[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73695":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},73695,"copilot-api","ericc-ch\u002Fcopilot-api","ericc-ch","Turn GitHub Copilot into OpenAI\u002FAnthropic API compatible server. Usable with Claude Code!","https:\u002F\u002Fericc-ch.github.io\u002Fcopilot-api\u002F?endpoint=http:\u002F\u002Flocalhost:4141\u002Fusage",null,"TypeScript",4028,639,17,91,0,5,29,110,15,94.92,"MIT License",false,"master",true,[27,28,29,30],"github-copilot","openai-api","openai-compatible-api","reverse-engineering","2026-06-12 04:01:10","# Copilot API Proxy\n\n> [!WARNING]\n> This is a reverse-engineered proxy of GitHub Copilot API. It is not supported by GitHub, and may break unexpectedly. Use at your own risk.\n\n> [!WARNING]\n> **GitHub Security Notice:**  \n> Excessive automated or scripted use of Copilot (including rapid or bulk requests, such as via automated tools) may trigger GitHub's abuse-detection systems.  \n> You may receive a warning from GitHub Security, and further anomalous activity could result in temporary suspension of your Copilot access.\n>\n> GitHub prohibits use of their servers for excessive automated bulk activity or any activity that places undue burden on their infrastructure.\n>\n> Please review:\n>\n> - [GitHub Acceptable Use Policies](https:\u002F\u002Fdocs.github.com\u002Fsite-policy\u002Facceptable-use-policies\u002Fgithub-acceptable-use-policies#4-spam-and-inauthentic-activity-on-github)\n> - [GitHub Copilot Terms](https:\u002F\u002Fdocs.github.com\u002Fsite-policy\u002Fgithub-terms\u002Fgithub-terms-for-additional-products-and-features#github-copilot)\n>\n> Use this proxy responsibly to avoid account restrictions.\n\n[![ko-fi](https:\u002F\u002Fko-fi.com\u002Fimg\u002Fgithubbutton_sm.svg)](https:\u002F\u002Fko-fi.com\u002FE1E519XS7W)\n\n---\n\n**Note:** If you are using [opencode](https:\u002F\u002Fgithub.com\u002Fsst\u002Fopencode), you do not need this project. Opencode supports GitHub Copilot provider out of the box.\n\n---\n\n## Project Overview\n\nA reverse-engineered proxy for the GitHub Copilot API that exposes it as an OpenAI and Anthropic compatible service. This allows you to use GitHub Copilot with any tool that supports the OpenAI Chat Completions API or the Anthropic Messages API, including to power [Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code\u002Foverview).\n\n## Features\n\n- **OpenAI & Anthropic Compatibility**: Exposes GitHub Copilot as an OpenAI-compatible (`\u002Fv1\u002Fchat\u002Fcompletions`, `\u002Fv1\u002Fmodels`, `\u002Fv1\u002Fembeddings`) and Anthropic-compatible (`\u002Fv1\u002Fmessages`) API.\n- **Claude Code Integration**: Easily configure and launch [Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code\u002Foverview) to use Copilot as its backend with a simple command-line flag (`--claude-code`).\n- **Usage Dashboard**: A web-based dashboard to monitor your Copilot API usage, view quotas, and see detailed statistics.\n- **Rate Limit Control**: Manage API usage with rate-limiting options (`--rate-limit`) and a waiting mechanism (`--wait`) to prevent errors from rapid requests.\n- **Manual Request Approval**: Manually approve or deny each API request for fine-grained control over usage (`--manual`).\n- **Token Visibility**: Option to display GitHub and Copilot tokens during authentication and refresh for debugging (`--show-token`).\n- **Flexible Authentication**: Authenticate interactively or provide a GitHub token directly, suitable for CI\u002FCD environments.\n- **Support for Different Account Types**: Works with individual, business, and enterprise GitHub Copilot plans.\n\n## Demo\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F7654b383-669d-4eb9-b23c-06d7aefee8c5\n\n## Prerequisites\n\n- Bun (>= 1.2.x)\n- GitHub account with Copilot subscription (individual, business, or enterprise)\n\n## Installation\n\nTo install dependencies, run:\n\n```sh\nbun install\n```\n\n## Using with Docker\n\nBuild image\n\n```sh\ndocker build -t copilot-api .\n```\n\nRun the container\n\n```sh\n# Create a directory on your host to persist the GitHub token and related data\nmkdir -p .\u002Fcopilot-data\n\n# Run the container with a bind mount to persist the token\n# This ensures your authentication survives container restarts\n\ndocker run -p 4141:4141 -v $(pwd)\u002Fcopilot-data:\u002Froot\u002F.local\u002Fshare\u002Fcopilot-api copilot-api\n```\n\n> **Note:**\n> The GitHub token and related data will be stored in `copilot-data` on your host. This is mapped to `\u002Froot\u002F.local\u002Fshare\u002Fcopilot-api` inside the container, ensuring persistence across restarts.\n\n### Docker with Environment Variables\n\nYou can pass the GitHub token directly to the container using environment variables:\n\n```sh\n# Build with GitHub token\ndocker build --build-arg GH_TOKEN=your_github_token_here -t copilot-api .\n\n# Run with GitHub token\ndocker run -p 4141:4141 -e GH_TOKEN=your_github_token_here copilot-api\n\n# Run with additional options\ndocker run -p 4141:4141 -e GH_TOKEN=your_token copilot-api start --verbose --port 4141\n```\n\n### Docker Compose Example\n\n```yaml\nversion: \"3.8\"\nservices:\n  copilot-api:\n    build: .\n    ports:\n      - \"4141:4141\"\n    environment:\n      - GH_TOKEN=your_github_token_here\n    restart: unless-stopped\n```\n\nThe Docker image includes:\n\n- Multi-stage build for optimized image size\n- Non-root user for enhanced security\n- Health check for container monitoring\n- Pinned base image version for reproducible builds\n\n## Using with npx\n\nYou can run the project directly using npx:\n\n```sh\nnpx copilot-api@latest start\n```\n\nWith options:\n\n```sh\nnpx copilot-api@latest start --port 8080\n```\n\nFor authentication only:\n\n```sh\nnpx copilot-api@latest auth\n```\n\n## Command Structure\n\nCopilot API now uses a subcommand structure with these main commands:\n\n- `start`: Start the Copilot API server. This command will also handle authentication if needed.\n- `auth`: Run GitHub authentication flow without starting the server. This is typically used if you need to generate a token for use with the `--github-token` option, especially in non-interactive environments.\n- `check-usage`: Show your current GitHub Copilot usage and quota information directly in the terminal (no server required).\n- `debug`: Display diagnostic information including version, runtime details, file paths, and authentication status. Useful for troubleshooting and support.\n\n## Command Line Options\n\n### Start Command Options\n\nThe following command line options are available for the `start` command:\n\n| Option         | Description                                                                   | Default    | Alias |\n| -------------- | ----------------------------------------------------------------------------- | ---------- | ----- |\n| --port         | Port to listen on                                                             | 4141       | -p    |\n| --verbose      | Enable verbose logging                                                        | false      | -v    |\n| --account-type | Account type to use (individual, business, enterprise)                        | individual | -a    |\n| --manual       | Enable manual request approval                                                | false      | none  |\n| --rate-limit   | Rate limit in seconds between requests                                        | none       | -r    |\n| --wait         | Wait instead of error when rate limit is hit                                  | false      | -w    |\n| --github-token | Provide GitHub token directly (must be generated using the `auth` subcommand) | none       | -g    |\n| --claude-code  | Generate a command to launch Claude Code with Copilot API config              | false      | -c    |\n| --show-token   | Show GitHub and Copilot tokens on fetch and refresh                           | false      | none  |\n| --proxy-env    | Initialize proxy from environment variables                                   | false      | none  |\n\n### Auth Command Options\n\n| Option       | Description               | Default | Alias |\n| ------------ | ------------------------- | ------- | ----- |\n| --verbose    | Enable verbose logging    | false   | -v    |\n| --show-token | Show GitHub token on auth | false   | none  |\n\n### Debug Command Options\n\n| Option | Description               | Default | Alias |\n| ------ | ------------------------- | ------- | ----- |\n| --json | Output debug info as JSON | false   | none  |\n\n## API Endpoints\n\nThe server exposes several endpoints to interact with the Copilot API. It provides OpenAI-compatible endpoints and now also includes support for Anthropic-compatible endpoints, allowing for greater flexibility with different tools and services.\n\n### OpenAI Compatible Endpoints\n\nThese endpoints mimic the OpenAI API structure.\n\n| Endpoint                    | Method | Description                                               |\n| --------------------------- | ------ | --------------------------------------------------------- |\n| `POST \u002Fv1\u002Fchat\u002Fcompletions` | `POST` | Creates a model response for the given chat conversation. |\n| `GET \u002Fv1\u002Fmodels`            | `GET`  | Lists the currently available models.                     |\n| `POST \u002Fv1\u002Fembeddings`       | `POST` | Creates an embedding vector representing the input text.  |\n\n### Anthropic Compatible Endpoints\n\nThese endpoints are designed to be compatible with the Anthropic Messages API.\n\n| Endpoint                         | Method | Description                                                  |\n| -------------------------------- | ------ | ------------------------------------------------------------ |\n| `POST \u002Fv1\u002Fmessages`              | `POST` | Creates a model response for a given conversation.           |\n| `POST \u002Fv1\u002Fmessages\u002Fcount_tokens` | `POST` | Calculates the number of tokens for a given set of messages. |\n\n### Usage Monitoring Endpoints\n\nNew endpoints for monitoring your Copilot usage and quotas.\n\n| Endpoint     | Method | Description                                                  |\n| ------------ | ------ | ------------------------------------------------------------ |\n| `GET \u002Fusage` | `GET`  | Get detailed Copilot usage statistics and quota information. |\n| `GET \u002Ftoken` | `GET`  | Get the current Copilot token being used by the API.         |\n\n## Example Usage\n\nUsing with npx:\n\n```sh\n# Basic usage with start command\nnpx copilot-api@latest start\n\n# Run on custom port with verbose logging\nnpx copilot-api@latest start --port 8080 --verbose\n\n# Use with a business plan GitHub account\nnpx copilot-api@latest start --account-type business\n\n# Use with an enterprise plan GitHub account\nnpx copilot-api@latest start --account-type enterprise\n\n# Enable manual approval for each request\nnpx copilot-api@latest start --manual\n\n# Set rate limit to 30 seconds between requests\nnpx copilot-api@latest start --rate-limit 30\n\n# Wait instead of error when rate limit is hit\nnpx copilot-api@latest start --rate-limit 30 --wait\n\n# Provide GitHub token directly\nnpx copilot-api@latest start --github-token ghp_YOUR_TOKEN_HERE\n\n# Run only the auth flow\nnpx copilot-api@latest auth\n\n# Run auth flow with verbose logging\nnpx copilot-api@latest auth --verbose\n\n# Show your Copilot usage\u002Fquota in the terminal (no server needed)\nnpx copilot-api@latest check-usage\n\n# Display debug information for troubleshooting\nnpx copilot-api@latest debug\n\n# Display debug information in JSON format\nnpx copilot-api@latest debug --json\n\n# Initialize proxy from environment variables (HTTP_PROXY, HTTPS_PROXY, etc.)\nnpx copilot-api@latest start --proxy-env\n```\n\n## Using the Usage Viewer\n\nAfter starting the server, a URL to the Copilot Usage Dashboard will be displayed in your console. This dashboard is a web interface for monitoring your API usage.\n\n1.  Start the server. For example, using npx:\n    ```sh\n    npx copilot-api@latest start\n    ```\n2.  The server will output a URL to the usage viewer. Copy and paste this URL into your browser. It will look something like this:\n    `https:\u002F\u002Fericc-ch.github.io\u002Fcopilot-api?endpoint=http:\u002F\u002Flocalhost:4141\u002Fusage`\n    - If you use the `start.bat` script on Windows, this page will open automatically.\n\nThe dashboard provides a user-friendly interface to view your Copilot usage data:\n\n- **API Endpoint URL**: The dashboard is pre-configured to fetch data from your local server endpoint via the URL query parameter. You can change this URL to point to any other compatible API endpoint.\n- **Fetch Data**: Click the \"Fetch\" button to load or refresh the usage data. The dashboard will automatically fetch data on load.\n- **Usage Quotas**: View a summary of your usage quotas for different services like Chat and Completions, displayed with progress bars for a quick overview.\n- **Detailed Information**: See the full JSON response from the API for a detailed breakdown of all available usage statistics.\n- **URL-based Configuration**: You can also specify the API endpoint directly in the URL using a query parameter. This is useful for bookmarks or sharing links. For example:\n  `https:\u002F\u002Fericc-ch.github.io\u002Fcopilot-api?endpoint=http:\u002F\u002Fyour-api-server\u002Fusage`\n\n## Using with Claude Code\n\nThis proxy can be used to power [Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fclaude-code), an experimental conversational AI assistant for developers from Anthropic.\n\nThere are two ways to configure Claude Code to use this proxy:\n\n### Interactive Setup with `--claude-code` flag\n\nTo get started, run the `start` command with the `--claude-code` flag:\n\n```sh\nnpx copilot-api@latest start --claude-code\n```\n\nYou will be prompted to select a primary model and a \"small, fast\" model for background tasks. After selecting the models, a command will be copied to your clipboard. This command sets the necessary environment variables for Claude Code to use the proxy.\n\nPaste and run this command in a new terminal to launch Claude Code.\n\n### Manual Configuration with `settings.json`\n\nAlternatively, you can configure Claude Code by creating a `.claude\u002Fsettings.json` file in your project's root directory. This file should contain the environment variables needed by Claude Code. This way you don't need to run the interactive setup every time.\n\nHere is an example `.claude\u002Fsettings.json` file:\n\n```json\n{\n  \"env\": {\n    \"ANTHROPIC_BASE_URL\": \"http:\u002F\u002Flocalhost:4141\",\n    \"ANTHROPIC_AUTH_TOKEN\": \"dummy\",\n    \"ANTHROPIC_MODEL\": \"gpt-4.1\",\n    \"ANTHROPIC_DEFAULT_SONNET_MODEL\": \"gpt-4.1\",\n    \"ANTHROPIC_SMALL_FAST_MODEL\": \"gpt-4.1\",\n    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\": \"gpt-4.1\",\n    \"DISABLE_NON_ESSENTIAL_MODEL_CALLS\": \"1\",\n    \"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC\": \"1\"\n  },\n  \"permissions\": {\n    \"deny\": [\n      \"WebSearch\"\n    ]\n  }\n}\n```\n\nYou can find more options here: [Claude Code settings](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code\u002Fsettings#environment-variables)\n\nYou can also read more about IDE integration here: [Add Claude Code to your IDE](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code\u002Fide-integrations)\n\n## Running from Source\n\nThe project can be run from source in several ways:\n\n### Development Mode\n\n```sh\nbun run dev\n```\n\n### Production Mode\n\n```sh\nbun run start\n```\n\n## Usage Tips\n\n- To avoid hitting GitHub Copilot's rate limits, you can use the following flags:\n  - `--manual`: Enables manual approval for each request, giving you full control over when requests are sent.\n  - `--rate-limit \u003Cseconds>`: Enforces a minimum time interval between requests. For example, `copilot-api start --rate-limit 30` will ensure there's at least a 30-second gap between requests.\n  - `--wait`: Use this with `--rate-limit`. It makes the server wait for the cooldown period to end instead of rejecting the request with an error. This is useful for clients that don't automatically retry on rate limit errors.\n- If you have a GitHub business or enterprise plan account with Copilot, use the `--account-type` flag (e.g., `--account-type business`). See the [official documentation](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fenterprise-cloud@latest\u002Fcopilot\u002Fmanaging-copilot\u002Fmanaging-github-copilot-in-your-organization\u002Fmanaging-access-to-github-copilot-in-your-organization\u002Fmanaging-github-copilot-access-to-your-organizations-network#configuring-copilot-subscription-based-network-routing-for-your-enterprise-or-organization) for more details.\n","该项目将GitHub Copilot转换为兼容OpenAI和Anthropic API的服务，使得Copilot可以与支持这些API的工具（如Claude Code）一起使用。其核心功能包括提供OpenAI和Anthropic API兼容接口、集成Claude Code、以及一个用于监控API使用情况的网页仪表板。此外，还支持手动请求审批、灵活的身份验证方式等特性，帮助用户更好地控制和管理API调用。适用于需要在非原生环境中利用GitHub Copilot代码生成能力的开发者或团队，特别是在已经使用了OpenAI或Anthropic服务但希望引入Copilot作为补充的情况下。注意，由于涉及逆向工程且可能违反GitHub使用条款，请谨慎使用。",2,"2026-06-11 03:46:59","high_star"]