Commit eb4e1cd
committed
fix(billing): bill fast/priority by client intent, not upstream-reported tier
resolveBillingServiceTier previously let any concrete upstream tier override
the client's intent, so when a Codex backend downgraded a fast request to
service_tier="default" the usage log was billed at base rate — defeating the
2x multiplier added in fb0a97a.
Now: if the client explicitly requested fast/priority, billing is locked to
priority regardless of what upstream reports. Only when the client did NOT
request a priority tier do we fall back to the upstream's actual tier.
Root cause of #158: reproduced locally by sending matching default/fast
gpt-5.4-mini requests and observing identical account_billed in usage_logs
despite rate_multiplier=2.1 parent fb0a97a commit eb4e1cd
2 files changed
Lines changed: 16 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1815 | 1815 | | |
1816 | 1816 | | |
1817 | 1817 | | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
1822 | 1822 | | |
1823 | | - | |
1824 | | - | |
1825 | | - | |
1826 | | - | |
1827 | | - | |
1828 | | - | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
1829 | 1826 | | |
1830 | 1827 | | |
1831 | | - | |
1832 | | - | |
1833 | | - | |
| 1828 | + | |
| 1829 | + | |
1834 | 1830 | | |
1835 | | - | |
1836 | | - | |
1837 | 1831 | | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
1838 | 1836 | | |
1839 | 1837 | | |
1840 | 1838 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
0 commit comments