@dianshuv/copilot-api 0.11.4 → 0.13.0

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.
Files changed (3) hide show
  1. package/README.md +9 -49
  2. package/dist/main.mjs +1724 -2383
  3. package/package.json +1 -2
package/README.md CHANGED
@@ -46,11 +46,9 @@ make down
46
46
  | Command | Description |
47
47
  |---------|-------------|
48
48
  | `start` | Start the API server (handles auth if needed) |
49
- | `auth` | Run GitHub authentication flow only |
49
+ | `login` | Run GitHub authentication flow only |
50
50
  | `logout` | Remove stored GitHub token |
51
- | `check-usage` | Show Copilot usage and quota |
52
51
  | `debug` | Display diagnostic information |
53
- | `patch-claude` | Patch Claude Code's context window limit |
54
52
 
55
53
  ### Start Command Options
56
54
 
@@ -60,45 +58,25 @@ make down
60
58
  | `--host`, `-H` | Host/interface to bind to (`0.0.0.0` = all interfaces) | `127.0.0.1` |
61
59
  | `--verbose`, `-v` | Enable verbose logging | false |
62
60
  | `--account-type`, `-a` | Account type (individual, business, enterprise) | individual |
63
- | `--manual` | Manual request approval mode | false |
64
61
  | `--no-rate-limit` | Disable adaptive rate limiting | false |
65
- | `--retry-interval` | Seconds to wait before retrying after rate limit | 10 |
66
- | `--request-interval` | Seconds between requests in rate-limited mode | 10 |
67
- | `--recovery-timeout` | Minutes before attempting recovery | 10 |
68
- | `--consecutive-successes` | Successes needed to exit rate-limited mode | 5 |
69
- | `--github-token`, `-g` | Provide GitHub token directly | none |
70
- | `--claude-code`, `-c` | Generate Claude Code launch command | false |
71
- | `--show-token` | Show tokens on fetch/refresh | false |
72
- | `--show-all-models` | Show all upstream models including the hardcoded blacklist (see "Hidden Models" below) | false |
73
- | `--proxy-env` | Use proxy from environment | false |
74
- | `--no-history` | Disable request history UI at `/history` | false |
75
- | `--history-limit` | Max history entries in memory | 1000 |
76
- | `--no-auto-truncate` | Disable auto-truncate when exceeding token limits | false |
77
- | `--compress-tool-results` | Compress old tool results before truncating | false |
78
- | `--redirect-anthropic` | Force Anthropic through OpenAI translation | false |
79
- | `--strip-server-tools` | Strip server-side tools from Anthropic requests | false |
80
- | `--context-editing` | Context editing mode: off, clear-thinking, clear-tooluse, clear-both | off |
81
- | `--timezone-offset` | Timezone offset in hours from UTC for log timestamps (e.g., +8, -5, 0) | +8 |
62
+ | `--github-token`, `-g` | Provide GitHub token directly (or `GH_TOKEN` env) | none |
82
63
  | `--posthog-key` | PostHog API key for token usage analytics (opt-in) | none |
83
64
  | `--api-key` | Proxy API key for inbound authentication (see [Authentication](#authentication)). Empty = disabled | none |
84
65
 
85
66
  ### Hidden Models
86
67
 
87
68
  By default the proxy hides 30 stale / duplicate / unused upstream model ids from
88
- its **listing surfaces** (`/v1/models`, the startup banner, and the
89
- `--claude-code` interactive prompts). Pass `--show-all-models` to see the full
90
- upstream catalogue.
69
+ its **listing surfaces** (`/v1/models` and the startup banner).
91
70
 
92
71
  **Important**: this is a *display* filter only. The remaining POST endpoints
93
72
  (`/v1/chat/completions`, `/v1/messages`, `/v1/responses`) do **not** reject
94
73
  hidden ids — an explicit `POST` with a hidden id is still forwarded to
95
- upstream verbatim, even without `--show-all-models`. (The embedding and
96
- Gemini ids in the list have no callable endpoint in this proxy at all;
97
- they're hidden purely to denoise the `/v1/models` listing — the upstream
98
- `/models` catalogue still returns them.)
74
+ upstream verbatim. (The embedding and Gemini ids in the list have no callable
75
+ endpoint in this proxy at all; they're hidden purely to denoise the
76
+ `/v1/models` listing — the upstream `/models` catalogue still returns them.)
99
77
 
100
- To change the blacklist, edit `src/lib/hidden-models.ts` and re-publish (this
101
- fork uses `/publish`).
78
+ To see the full catalogue or change the blacklist, edit
79
+ `src/lib/hidden-models.ts` and re-publish (this fork uses `/publish`).
102
80
 
103
81
  Currently hidden (grouped):
104
82
 
@@ -111,15 +89,6 @@ Currently hidden (grouped):
111
89
  - **Older / variant Claude** — `claude-opus-4.5`, `claude-opus-4.6`, `claude-opus-4.7-high`, `claude-opus-4.7-xhigh`, `claude-sonnet-4.5`
112
90
  - **Special-purpose** — `mai-code-1-flash-internal`, `trajectory-compaction`
113
91
 
114
- ### Patch-Claude Command Options
115
-
116
- | Option | Description | Default |
117
- |--------|-------------|---------|
118
- | `--limit`, `-l` | Context window limit in tokens | 128000 |
119
- | `--restore`, `-r` | Restore original 200k limit | false |
120
- | `--path`, `-p` | Path to Claude Code cli.js | auto-detect |
121
- | `--status`, `-s` | Show current patch status | false |
122
-
123
92
  ## API Endpoints
124
93
 
125
94
  ### OpenAI Compatible
@@ -155,7 +124,6 @@ When enabled (default), auto-truncate automatically compacts conversation histor
155
124
 
156
125
  - **Token-based truncation**: Uses the model's `max_context_window_tokens` from the Copilot API to determine when truncation is needed. A 2% safety margin is applied.
157
126
  - **No preset byte limit**: There is no hardcoded request body size limit. If the Copilot API returns a 413 (Request Entity Too Large), the proxy dynamically learns the byte limit and applies it to subsequent requests.
158
- - **Smart compression**: With `--compress-tool-results`, old tool results are compressed before removing messages, preserving more conversation context.
159
127
  - **Orphan filtering**: After truncation, orphaned tool results (without matching tool calls) are automatically removed.
160
128
 
161
129
  ## Authentication
@@ -244,9 +212,7 @@ Per client:
244
212
  - **Claude Code** (`.claude/settings.json`, see [below](#using-with-claude-code)):
245
213
  change `ANTHROPIC_AUTH_TOKEN` from `"dummy"` to your real key. Claude Code
246
214
  talks to the proxy's `/v1/messages` (Anthropic) surface; the auth gate accepts
247
- the token from either header. `--claude-code` keeps emitting the `"dummy"`
248
- placeholder on purpose (so the secret never lands in your clipboard / shell
249
- history) and prints a reminder to replace it when auth is on.
215
+ the token from either header.
250
216
  - **Raw OpenAI SDK** → `Authorization: Bearer <key>`; **raw Anthropic SDK** →
251
217
  `x-api-key: <key>`.
252
218
 
@@ -308,12 +274,6 @@ Create `.claude/settings.json` in your project:
308
274
  }
309
275
  ```
310
276
 
311
- Or use the interactive setup:
312
-
313
- ```sh
314
- bun run start --claude-code
315
- ```
316
-
317
277
  ## Upstream Project
318
278
 
319
279
  For the original project documentation, features, and updates, see: [ericc-ch/copilot-api](https://github.com/ericc-ch/copilot-api)