Commit Graph

1 Commits

  • fix(ai): ensure maxTokens > thinkingBudget for Claude thinking models
    Claude requires max_tokens > thinking.budget_tokens. When caller specifies
    a small maxTokens (e.g. compaction with ~13k tokens) and reasoning is enabled
    with high budget (16k tokens), the constraint was violated.
    
    Fix: In mapOptionsForApi, add thinkingBudget on top of caller's maxTokens
    (capped at model.maxTokens). If still not enough room, reduce thinkingBudget
    to leave space for output.
    
    Applied to both anthropic-messages and google-gemini-cli APIs.
    
    Also adds test utilities for OAuth credential resolution and tests for
    compaction with thinking models.
    
    fixes #413