Commit d02ef01
Jongho Kim
fix: guard Anthropic thinking budgetTokens for unknown output limits
Custom providers without an explicit output limit get limit.output = 0
(sentinel value). The budgetTokens calculation Math.floor(output / 2 - 1)
becomes negative, causing "maxOutputTokens must be >= 1" from the API.
Extract highBudget() to centralize the formula and its validation
(result >= 1024, Anthropic's minimum). Both variants() and the kimi-k2.5
path share this helper, so the guard lives in one place.
Fixes #222531 parent c98f616 commit d02ef01
2 files changed
Lines changed: 48 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
368 | 376 | | |
369 | 377 | | |
370 | 378 | | |
| |||
570 | 578 | | |
571 | 579 | | |
572 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
573 | 584 | | |
574 | 585 | | |
575 | 586 | | |
576 | 587 | | |
577 | | - | |
| 588 | + | |
578 | 589 | | |
579 | 590 | | |
580 | 591 | | |
| |||
809 | 820 | | |
810 | 821 | | |
811 | 822 | | |
812 | | - | |
813 | | - | |
814 | | - | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
815 | 829 | | |
816 | 830 | | |
817 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2577 | 2577 | | |
2578 | 2578 | | |
2579 | 2579 | | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
2580 | 2610 | | |
2581 | 2611 | | |
2582 | 2612 | | |
| |||
0 commit comments