Repository navigation
Commit 403fd74
feat: auto-append [1m] to models with a 1M context window, v1.19.0
Claude Code clamps third-party models to ~200k behind a custom base URL and
only opens the full window when the model name ends in [1m]. Users had to
retype `deepseek-flash[1m]` on every launch and after every /model switch.
The suffix is a client-side marker, never an upstream id: native Claude Code
strips it before calling the API, and Kimi answers `k3[1m]` with 401 "model
id does not exist". So it is generated at the two Claude-Code-facing exits
and stripped at the entrance:
- the four model slots injected by `ccmr claude` (ANTHROPIC_MODEL plus the
SONNET/OPUS/HAIKU defaults) -- fixes "200k on launch"
- the ids served by GET /v1/models -- fixes "200k again after /model"
- ConfigManager.resolveModelName strips [1m] before alias resolution, so
both `deepseek-flash` and `deepseek-flash[1m]` route, existing configs
and scripts are unaffected, and upstream always receives the bare id
Threshold is context_window >= 1000000 (vendors report 1M as either 1000000
or 1048576), which covers 27 of 42 variants. Models at 256k and below stay
bare on purpose: a false [1m] would make Claude Code overrun the real window,
which is worse than the original bug.
Verified on a scratch gateway: 27 ids suffixed, 15 bare, and a POST with a
suffixed name reaches upstream as the bare model id.
Also adds the diagnosis note for the related report where WebSearch/WebFetch
kept hitting an exhausted Kimi plan: those tools run on the haiku slot, which
`/model` cannot retarget, so they stayed on the launch default.1 parent cc0592e commit 403fd74
22 files changed
Lines changed: 258 additions & 22 deletions
File tree
- dist
- learnings
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | | - | |
| 175 | + | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
546 | 554 | | |
547 | 555 | | |
548 | 556 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments