Repository navigation
fix(anthropic): give each Claude model its real 128K output maximum - #6316
vadymhimself wants to merge 3 commits into
Conversation
Both Anthropic registry entries declared only `defaultMaxOutputTokens` 64000 and no per-model map, so every Claude model resolved a 64000 output ceiling. Anthropic documents 128K synchronous max output for all of them except Haiku 4.5, so the figure was understating the real ceiling by half on nine models. That number is not display metadata. `resolveOutputCeiling` is what the adapter budgets against when a caller declares no `max_tokens`, so a 128K-capable model stopped at 64000 with `stop_reason: max_tokens` and the caller had no way to reach the rest. The same value feeds the combo admission reserve in `checkComboTargetInputAdmission`, where understating a target's output makes its headroom arithmetic wrong in the other direction. ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS carries the per-model maxima and both the OAuth and API-key entries consume it. Each value was read from that model's own overview page on platform.claude.com (/docs/en/models/<slug>/overview), which states it in the header line and again in the Capabilities table: Fable 5.1, Fable 5, Sonnet 5.5, Sonnet 5, Opus 5.5, Opus 5, Opus 4.8, Opus 4.7, Opus 4.6 and Sonnet 4.6 are all 128K. Deliberately not the 300K Message Batches extended-output beta, which needs `output-300k-2026-03-24` and does not apply to the synchronous route these providers use. Haiku 4.5 is genuinely 64K and is left out of the map on purpose so it keeps inheriting the default, and the default stays 64000 as the floor for any model id the map does not name. Verification: the new test asserts the map covers exactly the seeded models minus Haiku 4.5, and that both providers resolve 128000 per model (64000 for Haiku) through `resolveModelPolicy` and through `resolveOutputCeiling`, which is the resolver the admission path actually calls. It fails on both providers with the map defined but not wired into the entries, and passes once it is. `bun run typecheck` is clean. tests/providers, tests/routing and tests/server/input-admission.test.ts report the same 162 pre-existing failures with and without this change. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughAnthropic model metadata now defines a 64,000-token default and per-model 128,000-token ceilings, except for Haiku 4.5. Both Anthropic provider entries use this metadata, and tests verify the resolved ceilings. ChangesAnthropic output-token ceilings
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The new output ceilings are wired to both Anthropic providers and covered by resolution tests, while the test-layout entry matches its fixture. No concrete merge-blocking issue is evident. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 3 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
리뷰 · 우선순위 44 / 80이 PR은 Anthropic Claude 모델의 “한 번에 쓸 수 있는 최대 출력 토큰” 숫자를 고칩니다. 베이스는 예전에는 OAuth( 이 숫자는 화면용 장식이 아닙니다. 호출자가 고친 뒤에는 라인 - 메인테이너의 판단이 필요한 지점 adaptive thinking이 켜진 기본 경로에서 너의 추천 머지해도 좋습니다. 범위가 좁고(시드 맵 + 두 엔트리 배선 + 회귀 테스트), Haiku 제외·300K 제외 이유도 분명합니다. thinking 클램프와 Opper 숫자는 후속으로 이슈만 열어 두면 됩니다. exact-head 전체 테스트 스위트는 이 시점 체크에 안 보이니, CI 초록만 한 번 더 보면 됩니다. 이 댓글은 grok-bot이 작성했습니다 |
|
Maintainer integration into
Thanks @vadymhimself! |
|
Landed on through maintainer carry #6329 (with a Co-authored-by trailer for you), after the contributor readiness gate returned this PR to draft following a maintainer review commit. Thank you! |
Summary
Both Anthropic registry entries declared only
defaultMaxOutputTokens64000 and no per-model map, so every Claude model resolved a 64000 output ceiling. Anthropic documents 128K synchronous max output for all of them except Haiku 4.5, so the figure understated the real ceiling by half on nine models.That number is not display metadata:
resolveOutputCeilingis what the adapter budgets against when a caller declares nomax_tokens, so a 128K-capable model stopped at 64000 withstop_reason: max_tokensand the caller had no way to reach the rest.checkComboTargetInputAdmission, where understating a target's output makes its headroom arithmetic wrong in the other direction.ANTHROPIC_MODEL_MAX_OUTPUT_TOKENSnow carries the per-model maxima and both the OAuth and API-key entries consume it, matching the existingALIBABA_TOKEN_PLAN_MAX_OUTPUT_TOKENS/OPPER_MODEL_MAX_OUTPUT_TOKENSshape.Each value was read from that model's own overview page on platform.claude.com (
/docs/en/models/<slug>/overview), which states it in the header line and again in the Capabilities table:claude-fable-5-1/docs/en/models/fable-5-1/overviewclaude-fable-5/docs/en/models/fable-5/overviewclaude-sonnet-5-5/docs/en/models/sonnet-5-5/overviewclaude-sonnet-5/docs/en/models/sonnet-5/overviewclaude-opus-5-5/docs/en/models/opus-5-5/overviewclaude-opus-5/docs/en/models/opus-5/overviewclaude-opus-4-8/docs/en/models/opus-4-8/overviewclaude-opus-4-7/docs/en/models/opus-4-7/overviewclaude-opus-4-6/docs/en/models/opus-4-6/overviewclaude-sonnet-4-6/docs/en/models/sonnet-4-6/overviewclaude-haiku-4-5Deliberately not the 300K Message Batches extended-output figure on those same pages: it requires the
output-300k-2026-03-24beta header and does not apply to the synchronous route these providers use.Haiku 4.5 is genuinely 64K and is left out of the map on purpose so it keeps inheriting the default, and the default stays 64000 as the floor for any model id the map does not name. Raising the default instead would have been a wider change than the defect warrants, since
defaultMaxOutputTokensis also the fallback for unlisted ids.Verification
bun run typecheck— clean.bun test tests/adapters/anthropic/anthropic-output-maxima.test.ts— 3/3.bun test tests/providers tests/routing tests/server/input-admission.test.ts— 162 failures before and after this change, identical set. Those are pre-existing ondevat26acb4076and unrelated; they pass in isolation and appear to be shared-state contention under parallel execution.bun test tests/test-layout.test.ts tests/test-layout-tooling.test.ts— 18/18. The new file sits undertests/adapters/anthropic/, which the existing regex seed already resolves, solayout.jsonandtest-layout-expected.jsonare untouched.Full-suite validation was not run locally; the focused regression set above plus typecheck is what I exercised, and the change is a data-only addition to two registry entries. Remaining coverage is left to CI.
Checklist
🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit