Skip to content

fix(models): auto-adjust max_tokens when thinking.budget_tokens exceeds it#41

Merged
mirrorange merged 1 commit intomirrorange:mainfrom
soxfmr:fix/max-tokens-auto-adjust
Feb 8, 2026
Merged

fix(models): auto-adjust max_tokens when thinking.budget_tokens exceeds it#41
mirrorange merged 1 commit intomirrorange:mainfrom
soxfmr:fix/max-tokens-auto-adjust

Conversation

@soxfmr
Copy link
Contributor

@soxfmr soxfmr commented Jan 29, 2026

Add model_validator to MessagesAPIRequest to ensure the Anthropic APIconstraint max_tokens > thinking.budget_tokens is satisfied. When extended thinking is enabled and budget_tokens >= max_tokens, thevalidator automatically sets max_tokens = budget_tokens + 1.

This commit fix the issue #39.

…ds it

Add model_validator to MessagesAPIRequest to ensure the Anthropic API
constraint `max_tokens > thinking.budget_tokens` is satisfied. When
extended thinking is enabled and budget_tokens >= max_tokens, the
validator automatically sets max_tokens = budget_tokens + 1.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mirrorange mirrorange merged commit c5357dc into mirrorange:main Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants