@impazhani/copilot-api 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Copilot API Proxy
|
|
2
2
|
|
|
3
|
+
> Originally created by [Erick Christian](https://github.com/ericc-ch) — forked and maintained by [@pazhanir](https://github.com/pazhanir)
|
|
4
|
+
|
|
3
5
|
> [!WARNING]
|
|
4
6
|
> 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.
|
|
5
7
|
|
|
@@ -27,11 +29,12 @@
|
|
|
27
29
|
|
|
28
30
|
## Project Overview
|
|
29
31
|
|
|
30
|
-
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, including to power [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview).
|
|
32
|
+
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, the OpenAI Responses API, or the Anthropic Messages API, including to power [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview), [Claude Desktop](https://claude.ai/download), [Codex CLI](https://github.com/openai/codex), and Codex Desktop.
|
|
31
33
|
|
|
32
34
|
## Features
|
|
33
35
|
|
|
34
|
-
- **OpenAI & Anthropic Compatibility**: Exposes GitHub Copilot as an OpenAI-compatible (`/v1/chat/completions`, `/v1/models`, `/v1/embeddings`) and Anthropic-compatible (`/v1/messages`) API.
|
|
36
|
+
- **OpenAI & Anthropic Compatibility**: Exposes GitHub Copilot as an OpenAI-compatible (`/v1/chat/completions`, `/v1/responses`, `/v1/models`, `/v1/embeddings`) and Anthropic-compatible (`/v1/messages`) API.
|
|
37
|
+
- **OpenAI Responses API**: Native `/v1/responses` endpoint support for Codex CLI and Codex Desktop (supports `gpt-5.5` and other responses-only models).
|
|
35
38
|
- **Claude Code Integration**: Easily configure and launch [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) to use Copilot as its backend with a simple command-line flag (`--claude-code`).
|
|
36
39
|
- **Usage Dashboard**: A web-based dashboard to monitor your Copilot API usage, view quotas, and see detailed statistics.
|
|
37
40
|
- **Rate Limit Control**: Manage API usage with rate-limiting options (`--rate-limit`) and a waiting mechanism (`--wait`) to prevent errors from rapid requests.
|
|
@@ -121,19 +124,19 @@ The Docker image includes:
|
|
|
121
124
|
You can run the project directly using npx:
|
|
122
125
|
|
|
123
126
|
```sh
|
|
124
|
-
npx copilot-api@latest start
|
|
127
|
+
npx @impazhani/copilot-api@latest start
|
|
125
128
|
```
|
|
126
129
|
|
|
127
130
|
With options:
|
|
128
131
|
|
|
129
132
|
```sh
|
|
130
|
-
npx copilot-api@latest start --port 8080
|
|
133
|
+
npx @impazhani/copilot-api@latest start --port 8080
|
|
131
134
|
```
|
|
132
135
|
|
|
133
136
|
For authentication only:
|
|
134
137
|
|
|
135
138
|
```sh
|
|
136
|
-
npx copilot-api@latest auth
|
|
139
|
+
npx @impazhani/copilot-api@latest auth
|
|
137
140
|
```
|
|
138
141
|
|
|
139
142
|
## Command Structure
|
|
@@ -185,11 +188,12 @@ The server exposes several endpoints to interact with the Copilot API. It provid
|
|
|
185
188
|
|
|
186
189
|
These endpoints mimic the OpenAI API structure.
|
|
187
190
|
|
|
188
|
-
| Endpoint | Method | Description
|
|
189
|
-
| --------------------------- | ------ |
|
|
190
|
-
| `POST /v1/chat/completions` | `POST` | Creates a model response for the given chat conversation.
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
191
|
+
| Endpoint | Method | Description |
|
|
192
|
+
| --------------------------- | ------ | ---------------------------------------------------------------------------- |
|
|
193
|
+
| `POST /v1/chat/completions` | `POST` | Creates a model response for the given chat conversation. |
|
|
194
|
+
| `POST /v1/responses` | `POST` | OpenAI Responses API (used by Codex CLI/Desktop, supports gpt-5.5 models). |
|
|
195
|
+
| `GET /v1/models` | `GET` | Lists the currently available models. |
|
|
196
|
+
| `POST /v1/embeddings` | `POST` | Creates an embedding vector representing the input text. |
|
|
193
197
|
|
|
194
198
|
### Anthropic Compatible Endpoints
|
|
195
199
|
|
|
@@ -215,46 +219,46 @@ Using with npx:
|
|
|
215
219
|
|
|
216
220
|
```sh
|
|
217
221
|
# Basic usage with start command
|
|
218
|
-
npx copilot-api@latest start
|
|
222
|
+
npx @impazhani/copilot-api@latest start
|
|
219
223
|
|
|
220
224
|
# Run on custom port with verbose logging
|
|
221
|
-
npx copilot-api@latest start --port 8080 --verbose
|
|
225
|
+
npx @impazhani/copilot-api@latest start --port 8080 --verbose
|
|
222
226
|
|
|
223
227
|
# Use with a business plan GitHub account
|
|
224
|
-
npx copilot-api@latest start --account-type business
|
|
228
|
+
npx @impazhani/copilot-api@latest start --account-type business
|
|
225
229
|
|
|
226
230
|
# Use with an enterprise plan GitHub account
|
|
227
|
-
npx copilot-api@latest start --account-type enterprise
|
|
231
|
+
npx @impazhani/copilot-api@latest start --account-type enterprise
|
|
228
232
|
|
|
229
233
|
# Enable manual approval for each request
|
|
230
|
-
npx copilot-api@latest start --manual
|
|
234
|
+
npx @impazhani/copilot-api@latest start --manual
|
|
231
235
|
|
|
232
236
|
# Set rate limit to 30 seconds between requests
|
|
233
|
-
npx copilot-api@latest start --rate-limit 30
|
|
237
|
+
npx @impazhani/copilot-api@latest start --rate-limit 30
|
|
234
238
|
|
|
235
239
|
# Wait instead of error when rate limit is hit
|
|
236
|
-
npx copilot-api@latest start --rate-limit 30 --wait
|
|
240
|
+
npx @impazhani/copilot-api@latest start --rate-limit 30 --wait
|
|
237
241
|
|
|
238
242
|
# Provide GitHub token directly
|
|
239
|
-
npx copilot-api@latest start --github-token ghp_YOUR_TOKEN_HERE
|
|
243
|
+
npx @impazhani/copilot-api@latest start --github-token ghp_YOUR_TOKEN_HERE
|
|
240
244
|
|
|
241
245
|
# Run only the auth flow
|
|
242
|
-
npx copilot-api@latest auth
|
|
246
|
+
npx @impazhani/copilot-api@latest auth
|
|
243
247
|
|
|
244
248
|
# Run auth flow with verbose logging
|
|
245
|
-
npx copilot-api@latest auth --verbose
|
|
249
|
+
npx @impazhani/copilot-api@latest auth --verbose
|
|
246
250
|
|
|
247
251
|
# Show your Copilot usage/quota in the terminal (no server needed)
|
|
248
|
-
npx copilot-api@latest check-usage
|
|
252
|
+
npx @impazhani/copilot-api@latest check-usage
|
|
249
253
|
|
|
250
254
|
# Display debug information for troubleshooting
|
|
251
|
-
npx copilot-api@latest debug
|
|
255
|
+
npx @impazhani/copilot-api@latest debug
|
|
252
256
|
|
|
253
257
|
# Display debug information in JSON format
|
|
254
|
-
npx copilot-api@latest debug --json
|
|
258
|
+
npx @impazhani/copilot-api@latest debug --json
|
|
255
259
|
|
|
256
260
|
# Initialize proxy from environment variables (HTTP_PROXY, HTTPS_PROXY, etc.)
|
|
257
|
-
npx copilot-api@latest start --proxy-env
|
|
261
|
+
npx @impazhani/copilot-api@latest start --proxy-env
|
|
258
262
|
```
|
|
259
263
|
|
|
260
264
|
## Using the Usage Viewer
|
|
@@ -263,7 +267,7 @@ After starting the server, a URL to the Copilot Usage Dashboard will be displaye
|
|
|
263
267
|
|
|
264
268
|
1. Start the server. For example, using npx:
|
|
265
269
|
```sh
|
|
266
|
-
npx copilot-api@latest start
|
|
270
|
+
npx @impazhani/copilot-api@latest start
|
|
267
271
|
```
|
|
268
272
|
2. The server will output a URL to the usage viewer. Copy and paste this URL into your browser. It will look something like this:
|
|
269
273
|
`https://ericc-ch.github.io/copilot-api?endpoint=http://localhost:4141/usage`
|
|
@@ -289,7 +293,7 @@ There are two ways to configure Claude Code to use this proxy:
|
|
|
289
293
|
To get started, run the `start` command with the `--claude-code` flag:
|
|
290
294
|
|
|
291
295
|
```sh
|
|
292
|
-
npx copilot-api@latest start --claude-code
|
|
296
|
+
npx @impazhani/copilot-api@latest start --claude-code
|
|
293
297
|
```
|
|
294
298
|
|
|
295
299
|
You 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.
|
|
@@ -326,6 +330,39 @@ You can find more options here: [Claude Code settings](https://docs.anthropic.co
|
|
|
326
330
|
|
|
327
331
|
You can also read more about IDE integration here: [Add Claude Code to your IDE](https://docs.anthropic.com/en/docs/claude-code/ide-integrations)
|
|
328
332
|
|
|
333
|
+
## Using with Codex
|
|
334
|
+
|
|
335
|
+
This proxy supports the OpenAI Responses API (`/v1/responses`), which is required by [Codex CLI](https://github.com/openai/codex) and Codex Desktop. Models like `gpt-5.5` that only work via the Responses API are fully supported.
|
|
336
|
+
|
|
337
|
+
### Setup
|
|
338
|
+
|
|
339
|
+
1. Start the proxy server:
|
|
340
|
+
|
|
341
|
+
```sh
|
|
342
|
+
npx @impazhani/copilot-api@latest start
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
2. Update your Codex configuration file (`~/.codex/config.toml`):
|
|
346
|
+
|
|
347
|
+
```toml
|
|
348
|
+
model = "gpt-5.5"
|
|
349
|
+
model_provider = "local_provider"
|
|
350
|
+
|
|
351
|
+
[model_providers.local_provider]
|
|
352
|
+
name = "Local GPT-5.5"
|
|
353
|
+
base_url = "http://localhost:4141/v1"
|
|
354
|
+
env_key = "LOCAL_API_KEY"
|
|
355
|
+
wire_api = "responses"
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
3. Set the environment variable (any dummy value works):
|
|
359
|
+
|
|
360
|
+
```sh
|
|
361
|
+
export LOCAL_API_KEY="123"
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Add it to your shell profile (`~/.bashrc`, `~/.zshrc`) to persist across sessions.
|
|
365
|
+
|
|
329
366
|
## Running from Source
|
|
330
367
|
|
|
331
368
|
The project can be run from source in several ways:
|