-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Bug Report
Current Behavior
When using Claude with thinking enabled (any level except Off), the API returns an error:
Invalid request: max_tokens must be greater than thinking.budget_tokens
Expected Behavior
rstructor should automatically ensure max_tokens is set high enough when thinking_level is enabled, or provide a way to configure max_tokens.
Reproduction
let client = AnthropicClient::from_env()?
.model("claude-sonnet-4-5-20250929")
.thinking_level(ThinkingLevel::Low);
// This fails with the above error
client.materialize::<MyStruct>(prompt).await?;Workaround
Currently using ThinkingLevel::Off as a workaround:
.thinking_level(ThinkingLevel::Off)Suggested Fix
When thinking is enabled, automatically set max_tokens to be greater than the thinking budget, e.g.:
ThinkingLevel::Minimal→max_tokens = budget + 4096ThinkingLevel::Low→max_tokens = budget + 8192ThinkingLevel::High→max_tokens = budget + 16384
Or expose a .max_tokens() builder method.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels