You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-26Lines changed: 39 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Copilot API
1
+
# Copilot API Proxy
2
2
3
3
> [!WARNING]
4
4
> 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.
@@ -7,7 +7,7 @@
7
7
8
8
## Project Overview
9
9
10
-
A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools like AI assistants, local interfaces, and development utilities.
10
+
A 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.
- GitHub account with Copilot subscription (Individual or Business)
19
+
- GitHub account with Copilot subscription (individual, business, or enterprise)
20
20
21
21
## Installation
22
22
@@ -64,7 +64,7 @@ npx copilot-api@latest auth
64
64
65
65
Copilot API now uses a subcommand structure with two main commands:
66
66
67
-
-`start`: Start the Copilot API server (default command). This command will also handle authentication if needed.
67
+
-`start`: Start the Copilot API server. This command will also handle authentication if needed.
68
68
-`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.
69
69
70
70
## Command Line Options
@@ -73,22 +73,45 @@ Copilot API now uses a subcommand structure with two main commands:
73
73
74
74
The following command line options are available for the `start` command:
The 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.
|`POST /v1/messages`|`POST`| Creates a model response for a given conversation. |
113
+
|`POST /v1/messages/count_tokens`|`POST`| Calculates the number of tokens for a given set of messages. |
114
+
92
115
## Example Usage
93
116
94
117
Using with npx:
@@ -143,18 +166,8 @@ bun run start
143
166
144
167
## Usage Tips
145
168
146
-
-Consider using free models (e.g., Gemini, Mistral, Openrouter) as the `weak-model`
147
-
- Use architect mode sparingly
148
-
- Disable `yes-always` in your aider configuration
149
-
- Enable the `--manual` flag to review and approve each request before processing
169
+
-To avoid hitting GitHub Copilot's rate limits, you can use the following flags:
170
+
-`--manual`: Enables manual approval for each request, giving you full control over when requests are sent.
171
+
-`--rate-limit <seconds>`: 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.
172
+
-`--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.
150
173
- 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://docs.github.com/en/enterprise-cloud@latest/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-access-to-github-copilot-in-your-organization/managing-github-copilot-access-to-your-organizations-network#configuring-copilot-subscription-based-network-routing-for-your-enterprise-or-organization) for more details.
151
-
152
-
### Manual Request Approval
153
-
154
-
When using the `--manual` flag, the server will prompt you to approve each incoming request:
155
-
156
-
```
157
-
? Accept incoming request? > (y/N)
158
-
```
159
-
160
-
This helps you control usage and monitor requests in real-time.
0 commit comments