Repository navigation
Conversation
The route planner applied the card's output_tokens only as a cap on a requested max_tokens. A request without one sent no limit on OpenAI-family drivers and the fixed 2000 driver default on Claude and Bedrock, regardless of the card. The planner now treats an unset max_tokens as a request for the card limit; the driver default applies only when the card declares no limit.
wolfy-j
marked this pull request as draft
November 16, 2026 00:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
route.plan_outputapplies the model card'soutput_tokensonly as a cap on a requestedmax_tokens. A request without one ignores the card: OpenAI-family drivers send no limit, so the server's remaining context window is the only bound, and Claude/Bedrock send their fixeddefault_max_tokens(2000) even when the card allows far more.Fix
An unset
max_tokensis planned as a request for the card'soutput_tokens. The driver default applies only when the card declares no limit. A requested value is unchanged: min(requested, card). Budget-thinking planning runs on the same effective value, so an unset request on a 64000 card with effort 100 sends 64000 with a 24000 budget.Admission reserves the planned output, so an unset request now reserves the card's
output_tokensinstead of 0 (OpenAI-family) or 2000 (Claude/Bedrock). That matches what is sent on the wire.Tests
route_test: unset + card limit sends the card limit (with and without budget thinking); requested below the card stays; requested above is lowered; unset with no card limit keeps the driver behavior (nil / 2000 / budget raise).replay_safety_test(effective output): OpenAI unset + card sendsmax_output_tokens = 65536; requested 4096 stays; requested 100000 is lowered and reported inmetadata.adjusted; Claude without a card limit still sends 2000. The Bedrock case that asserted the 2000 default under a 64000 card now asserts 64000.llm_test(context admission): the case asserting an unset request stays unbounded under a card ceiling now asserts the card limit is sent and reserved.Red on master: the three "unset + card limit" cases fail (expected 64000/65536, got 2000/nil). Green: full llm suite 2922 tests, 9 existing skips, 0 failures;
wippy lint --level errorclean.kicksideai/providers#117 (llm-ocr stops hard-coding
max_tokens) depends on this.