Commit bf92403
fix(claude): only enable 1M context beta when model has [1m] suffix (xvirobotics#273)
Both executors unconditionally set:
queryOptions.betas = ['context-1m-2025-08-07'];
The comment acknowledged this was a no-op on OAuth / Pro-Max (where
betas are ignored and the `[1m]` suffix is the actual lever), but on
API-key auth the SDK honors the beta header — so every API-key user
got 1M context for *every* model, including plain `opus-4-7`.
Visible symptom: `/model claude-opus-4-7` showed a 1000k context
window in the card footer (and billed at 2× the rate) instead of the
expected 200k. The user only intended 1M on the explicit
`claude-opus-4-7[1m]` form.
Fix: only emit the beta flag when the model name contains `[1m]`.
That makes the suffix the single canonical signal for both auth
paths — SDK parses it directly, and we re-send the matching beta as
belt-and-braces for any auth mode that needs the explicit header.
Both `executor.ts` and `persistent-executor.ts` had the same
unconditional line; both fixed. Comment notes they must stay in
sync.
No new tests — the SDK's beta dispatch is mocked away in vitest, and
the change is one conditional. All 291 existing tests still pass.
Co-authored-by: Flood Sung <floodsung@xvirobotics.ai>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 30e4983 commit bf92403
2 files changed
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
369 | | - | |
370 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
371 | 382 | | |
372 | 383 | | |
373 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
369 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
370 | 383 | | |
371 | 384 | | |
372 | 385 | | |
| |||
0 commit comments