0xPlaygrounds / 0xPlaygrounds/rig
default_max_tokens_for_model caps Claude Sonnet 4.6 at 64k, should be 128k
- Dominant language
- Rust
- Stars
- 8.7k
- Forks
- 971
- Avg merge
- 4h 14m
- Merged PRs (30d)
- 115
Description
In `crates/rig-core/src/providers/anthropic/completion.rs`, `default_max_tokens_for_model` matches `claude-sonnet-4-6` against the generic `claude-sonnet-4` arm and returns 64,000.
Anthropic lists Sonnet 4.6 max output as 128K tokens on the synchronous Messages API:
https://platform.claude.com/docs/en/models/sonnet-4-6/overview
So anyone who doesn't set `max_tokens` themselves gets half the ceiling, with no error to tell them. Opus 4.6, 4.7 and 4.8 each get the 128,000 arm above it, so Sonnet 4.6 looks like it was just missed when that arm went in.
Sonnet 4.5 and Sonnet 4 are correct at 64,000, so it needs a `claude-sonnet-4-6` check before the generic one.
I can send a PR if that helps.
Contributor guide
Research direction
Start in crates/rig-core/src/providers/anthropic/completion.rs and inspect default_max_tokens_for_model, especially the model-matching order around the Claude Sonnet and Opus arms. Verify that claude-sonnet-4-6 receives the 128,000-token limit while Sonnet 4.5 and Sonnet 4 remain at 64,000; that is the completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai, api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 92/100