Repository navigation
Commit 85f2ef2
committed
fix(sdk): use max instead of sum for OpenRouter cost fields
usage.cost already includes upstream_inference_cost on non-BYOK
routes, so summing them double-counts the upstream component.
Use Math.max to pick the correct value for both BYOK (cost=0,
upstream>0) and normal (cost>upstream) routes.
Fixes #11641 parent bc4ed90 commit 85f2ef2
2 files changed
Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
397 | 399 | | |
398 | 400 | | |
399 | 401 | | |
| |||
732 | 734 | | |
733 | 735 | | |
734 | 736 | | |
735 | | - | |
736 | | - | |
737 | | - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
738 | 741 | | |
739 | 742 | | |
740 | 743 | | |
| |||
803 | 806 | | |
804 | 807 | | |
805 | 808 | | |
806 | | - | |
807 | | - | |
808 | | - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
809 | 813 | | |
810 | 814 | | |
811 | 815 | | |
| |||
0 commit comments