betahi-copilot-bridge 0.20.0 → 0.20.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  <h1 align="center">copilot-bridge</h1>
2
2
 
3
3
  <p align="center">
4
- <a href="https://www.npmjs.com/package/betahi-copilot-bridge"><img src="https://img.shields.io/npm/v/betahi-copilot-bridge.svg?v=0.20.0" alt="npm version"></a>
4
+ <a href="https://www.npmjs.com/package/betahi-copilot-bridge"><img src="https://img.shields.io/npm/v/betahi-copilot-bridge.svg?v=0.20.2" alt="npm version"></a>
5
5
  <a href="https://github.com/betahi/copilot-bridge/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/betahi-copilot-bridge.svg" alt="license"></a>
6
6
  </p>
7
7
 
@@ -113,7 +113,7 @@ manage `~/.codex/config.toml` yourself).
113
113
  This is a Codex client-side metadata warning, not a bridge routing failure.
114
114
  Requests can still complete through the bridge.
115
115
 
116
- For `claude-opus-4.6-1m`, upstream still enforces a 1,000,000-token prompt
116
+ For 1m model, upstream still enforces a 1,000,000-token prompt
117
117
  limit (about 900k succeeds; around 1,000,046 is rejected as too long).
118
118
 
119
119
  ## Configure Claude Code
@@ -139,6 +139,18 @@ Minimal recommended config is:
139
139
  }
140
140
  ```
141
141
 
142
+ For Claude Code 1M context, use the `-[1m]` display form in
143
+ `ANTHROPIC_MODEL`. Claude Code shows a 1M context window for this form, while
144
+ the bridge maps it to the real Copilot `-1m` model upstream:
145
+
146
+ ```json
147
+ {
148
+ "env": {
149
+ "ANTHROPIC_MODEL": "claude-opus-4.7-[1m]",
150
+ }
151
+ }
152
+ ```
153
+
142
154
  Optional slot-specific:
143
155
 
144
156
  ```json
@@ -208,6 +220,11 @@ For Claude Opus 4.7, both Codex CLI and Claude Code can use
208
220
  `claude-opus-4.7` with reasoning effort `high` or `xhigh`; the bridge routes the
209
221
  request to the matching upstream reasoning variant.
210
222
 
223
+ For Claude Code settings, prefer `claude-opus-4.7-[1m]` or
224
+ `claude-opus-4.6-[1m]` when you want the CLI `/context` UI and the upstream
225
+ model to both use 1M context. Direct API clients can use
226
+ `claude-opus-4.7-1m` or `claude-opus-4.6-1m`.
227
+
211
228
  ### Gemini family — translated to chat completions
212
229
 
213
230
  | Model | Aliases |
package/dist/main.js CHANGED
@@ -1576,7 +1576,17 @@ const createAnthropicToolNameMapper = (tools, options = {}) => {
1576
1576
  //#region src/bridges/claude/non-stream-translation.ts
1577
1577
  const normalizeClaudeModelAlias = (model) => {
1578
1578
  const trimmed = model.trim().toLowerCase();
1579
- if (trimmed === "opus[1m]") return "claude-opus-4.6-1m";
1579
+ if (trimmed === "opus[1m]") return "claude-opus-4.7-1m";
1580
+ const claudeOpusOneMillionMatch = trimmed.match(/^claude-opus-(\d)[.-](\d)(?:-\d{8})?-?\[1m\]$/);
1581
+ if (claudeOpusOneMillionMatch) {
1582
+ const [, major, minor] = claudeOpusOneMillionMatch;
1583
+ return `claude-opus-${major}.${minor}-1m`;
1584
+ }
1585
+ const claudeOpusOneMillionStrippedByClaudeCodeMatch = trimmed.match(/^claude-opus-(\d)[.-](\d)-$/);
1586
+ if (claudeOpusOneMillionStrippedByClaudeCodeMatch) {
1587
+ const [, major, minor] = claudeOpusOneMillionStrippedByClaudeCodeMatch;
1588
+ return `claude-opus-${major}.${minor}-1m`;
1589
+ }
1580
1590
  const normalized = trimmed.replace(/\[1m\]$/, "");
1581
1591
  const prefixed = normalized.startsWith("opus-") ? `claude-${normalized}` : normalized;
1582
1592
  if (prefixed === "opus") return "claude-opus";