copilot-api-node20 0.44.0-preview.9 → 0.44.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 +26 -11
- package/dist/main.mjs +1 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
A proxy server that turns a GitHub Copilot subscription into fully compatible OpenAI and Anthropic API endpoints. Use Claude Code, Claude Cowork, Codex CLI, and any tool that speaks the API -- all through the Copilot plan you already pay for, no separate API keys required.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Want Claude Code on GPT and other non-Claude models? Pick one from your Copilot plan, or serve your own **Microsoft Foundry / Azure OpenAI** deployments with `--provider foundry`, signing in with an API key or Entra ID. Add `--fallback copilot` and Copilot answers whenever Foundry throttles, fails or times out. See [Microsoft Foundry](#microsoft-foundry--azure-openai).
|
|
13
13
|
|
|
14
14
|
```
|
|
15
15
|
Clients Proxy Backends
|
|
@@ -59,7 +59,9 @@ Your organisation runs its models in **Microsoft Foundry / Azure OpenAI** instea
|
|
|
59
59
|
| **Full Claude Code support** | All Claude models, streaming, extended thinking, and the complete **1M token context window** |
|
|
60
60
|
| **Claude Cowork support** | Run Claude's desktop app through Copilot — **one-command setup** via [Tailscale](https://tailscale.com) for zero-trust-hassle HTTPS |
|
|
61
61
|
| **Full Codex CLI support** | Complete **OpenAI Responses API** implementation purpose-built for Codex CLI |
|
|
62
|
-
| **
|
|
62
|
+
| **Claude Code on non-Claude models** | GPT and other models from Copilot or Foundry, translated to the Anthropic API, with tools, streaming and keepalive pings while the model thinks |
|
|
63
|
+
| **Microsoft Foundry / Azure OpenAI** | Your own Azure deployments with `--provider foundry`: API key or Entra ID (`az login`, managed identity, service principal), no GitHub account needed |
|
|
64
|
+
| **Copilot fallback** | `--fallback copilot`: Copilot answers when Foundry rate-limits, errors or times out, and finishes a Claude Code turn on an OpenAI deployment whose stream fails before any output; then traffic moves back to Foundry |
|
|
63
65
|
| **Web search** | Optional web search for Claude Code and Codex sessions, via **Tavily and/or Exa** with automatic failover |
|
|
64
66
|
| **Dual API compatibility** | OpenAI Chat Completions, Anthropic Messages, and OpenAI Responses APIs side by side |
|
|
65
67
|
| **HTTPS with auto-generated certs** | Self-signed TLS certs with configurable SANs -- works across VMs, containers, and LAN |
|
|
@@ -99,13 +101,13 @@ npx copilot-api-node20@latest start \
|
|
|
99
101
|
Start the proxy with Codex mode:
|
|
100
102
|
|
|
101
103
|
```bash
|
|
102
|
-
npx copilot-api-node20@latest start --codex --model gpt-5.
|
|
104
|
+
npx copilot-api-node20@latest start --codex --model gpt-5.6-sol
|
|
103
105
|
```
|
|
104
106
|
|
|
105
107
|
Configure `~/.codex/config.toml`:
|
|
106
108
|
|
|
107
109
|
```toml
|
|
108
|
-
model = "gpt-5.
|
|
110
|
+
model = "gpt-5.6-sol"
|
|
109
111
|
model_provider = "local"
|
|
110
112
|
|
|
111
113
|
[model_providers.local]
|
|
@@ -186,7 +188,7 @@ Point the proxy at your own Azure resource instead of GitHub Copilot. No GitHub
|
|
|
186
188
|
|
|
187
189
|
```bash
|
|
188
190
|
export FOUNDRY_ENDPOINT=https://<resource>.openai.azure.com
|
|
189
|
-
export FOUNDRY_API_KEY=<key>
|
|
191
|
+
export FOUNDRY_API_KEY=<key> # or omit it and `az login` for Entra ID
|
|
190
192
|
npx copilot-api-node20@latest start --provider foundry
|
|
191
193
|
```
|
|
192
194
|
|
|
@@ -206,7 +208,9 @@ The model you ask for is the model you get: the proxy never renames or substitut
|
|
|
206
208
|
| OpenAI (`gpt-*`, `o*`, codex) | `/openai/v1/responses` (translated for Claude Code) |
|
|
207
209
|
| Others (DeepSeek, Grok, …) | `/openai/v1/chat/completions` |
|
|
208
210
|
|
|
209
|
-
|
|
211
|
+
**Sign-in:** by default, with `FOUNDRY_API_KEY` set the proxy uses the key. Without it, it uses Entra ID through the Azure SDK, so `az login`, a managed identity or a service principal all work (`FOUNDRY_AUTH=key|entra` picks one explicitly). The identity needs **Cognitive Services OpenAI User** (GPT) or **Azure AI User** (Claude) on the resource. See [Authentication](./docs/foundry.md#authentication).
|
|
212
|
+
|
|
213
|
+
**Have a Copilot subscription too?** Add `--fallback copilot`. When Foundry rate-limits (429), fails (408, 500, 502, 503 or 504), times out or drops the connection, Copilot answers the same request. For Claude Code on an OpenAI deployment, a Foundry stream that fails before any text or tool call reaches it is finished by Copilot as well. The model stays on Copilot for Foundry's `retry-after` (initially 10 seconds without one), then goes back. See [Copilot fallback](./docs/foundry.md#copilot-fallback).
|
|
210
214
|
|
|
211
215
|
Codex works with the usual `config.toml` (see [Codex CLI](#codex-cli)) with `model` set to a deployment name. See **[docs/foundry.md](./docs/foundry.md)** for configuration, routing details, reasoning effort, and troubleshooting (including `NODE_EXTRA_CA_CERTS` behind TLS-inspecting corporate proxies).
|
|
212
216
|
|
|
@@ -250,15 +254,22 @@ curl http://localhost:4141/v1/chat/completions \
|
|
|
250
254
|
|
|
251
255
|
All endpoints are served at `http://localhost:4141` by default (`https://` when `--https` or `--claude-cowork` is used). The server binds to `127.0.0.1` (localhost only) by default. To expose to LAN/network/Docker, pass `--hostname 0.0.0.0`.
|
|
252
256
|
|
|
253
|
-
| Method | Path |
|
|
257
|
+
| Method | Path | Purpose |
|
|
254
258
|
|:--|:--|:--|
|
|
259
|
+
| `GET` | `/` | Basic server-running response |
|
|
260
|
+
| `GET` | `/health` | Proxy, token, and upstream health status |
|
|
255
261
|
| `POST` | `/v1/chat/completions` | OpenAI Chat Completions |
|
|
262
|
+
| `POST` | `/chat/completions` | OpenAI Chat Completions without the `/v1` prefix |
|
|
256
263
|
| `POST` | `/v1/responses` | OpenAI Responses API |
|
|
264
|
+
| `POST` | `/responses` | OpenAI Responses API without the `/v1` prefix |
|
|
257
265
|
| `POST` | `/v1/messages` | Anthropic Messages |
|
|
258
266
|
| `POST` | `/v1/messages/count_tokens` | Anthropic Token Counting |
|
|
259
267
|
| `POST` | `/v1/embeddings` | OpenAI Embeddings |
|
|
268
|
+
| `POST` | `/embeddings` | OpenAI Embeddings without the `/v1` prefix |
|
|
260
269
|
| `GET` | `/v1/models` | OpenAI Models |
|
|
261
|
-
|
|
270
|
+
| `GET` | `/models` | OpenAI Models without the `/v1` prefix |
|
|
271
|
+
| `GET` | `/usage` | GitHub Copilot usage and quota information |
|
|
272
|
+
| `GET` | `/token` | Copilot token debug endpoint; disabled unless started with `--show-token` |
|
|
262
273
|
|
|
263
274
|
---
|
|
264
275
|
|
|
@@ -287,19 +298,23 @@ All OpenAI-compatible routes are also available without the `/v1/` prefix.
|
|
|
287
298
|
|
|
288
299
|
| Flag | Alias | Default | Description |
|
|
289
300
|
|:--|:--|:--|:--|
|
|
290
|
-
| `--provider` | | `copilot` | Upstream: `copilot`, or `foundry` for Microsoft Foundry / Azure OpenAI (reads `FOUNDRY_ENDPOINT
|
|
291
|
-
| `--fallback` | | | With `--provider foundry`: `copilot`
|
|
301
|
+
| `--provider` | | `copilot` | Upstream: `copilot`, or `foundry` for Microsoft Foundry / Azure OpenAI (reads `FOUNDRY_ENDPOINT`, plus `FOUNDRY_API_KEY` or an Entra ID login; see [docs/foundry.md](./docs/foundry.md)). Also `COPILOT_API_PROVIDER` |
|
|
302
|
+
| `--fallback` | | | With `--provider foundry`: `copilot` answers from GitHub Copilot when Foundry rate-limits, fails or times out (and, for Claude Code on an OpenAI deployment, when a Foundry stream fails before any output), and keeps that model there for Foundry's `retry-after`, or initially 10 s without one (see [docs/foundry.md](./docs/foundry.md#copilot-fallback)). Also `COPILOT_API_FALLBACK` |
|
|
292
303
|
| `--port` | `-p` | `4141` | Port to listen on |
|
|
293
304
|
| `--hostname` | `-H` | `127.0.0.1` | Hostname/IP to bind to. Use `0.0.0.0` for LAN/Docker exposure |
|
|
294
305
|
| `--claude-code` | `-c` | | Enable Claude Code compatibility mode |
|
|
295
306
|
| `--codex` | | | Enable Codex CLI compatibility mode |
|
|
296
307
|
| `--model` | `-m` | | Primary model to use |
|
|
297
308
|
| `--small-model` | `-s` | | Lightweight model for fast tasks (Claude Code) |
|
|
309
|
+
| `--manual` | | `false` | Require manual approval before forwarding requests |
|
|
298
310
|
| `--rate-limit` | `-r` | | Minimum seconds between requests |
|
|
299
|
-
| `--
|
|
311
|
+
| `--wait` | `-w` | `false` | Wait instead of returning an error when the configured rate limit is hit |
|
|
312
|
+
| `--timeout` | `-t` | `600000` | Request timeout in ms (default 10 min). A streamed Claude Code turn on a non-Claude model waits at most 4 min for the upstream to start answering |
|
|
313
|
+
| `--connect-timeout` | | `15000` | Connectivity probe timeout in ms; overrides `COPILOT_CONNECT_TIMEOUT_MS` |
|
|
300
314
|
| `--account-type` | `-a` | `individual` | `individual`, `business`, or `enterprise` |
|
|
301
315
|
| `--github-token` | `-g` | | Provide a GitHub token directly (skips OAuth) |
|
|
302
316
|
| `--show-token` | | | Display tokens on fetch and refresh, and enable the local `/token` debug endpoint |
|
|
317
|
+
| `--error-reporting` | | `true` | Send sanitized server-error reports. Disable with `--no-error-reporting` or `COPILOT_API_ERROR_REPORTING=0` |
|
|
303
318
|
| `--smoke-test` | | `true` | Run one self-test generation after startup and print PASS/FAIL. Disable with `--no-smoke-test` or `COPILOT_API_NO_SMOKE_TEST=1` |
|
|
304
319
|
| `--tavily-api-key` | | | **Deprecated** — prefer `TAVILY_API_KEY` env var. Tavily API key for web search |
|
|
305
320
|
| `--web-search-provider` | | | Web search providers in primary→fallback order, e.g. `exa,tavily` (keys via `TAVILY_API_KEY` / `EXA_API_KEY`) |
|