killer30001000
d71d0f76e5
fix(usage): render OpenRouter PAYG credit pool with real denominator ( #12468 )
...
* fix(usage) handle OpenRouter PAYG credit percentage
OpenRouter PAYG accounts without a per-key limit previously rendered
the credits row as 'total: 0, remainingPercentage: 100, unlimited: true',
treating /credits balance as unlimited even when a real credit pool was
present. Route the credit pool through the credits renderer with the
real denominator: total = totalCredits when positive, used = total -
creditBalance, remaining = creditBalance, remainingPercentage =
round(balance / total * 100), isCredits: true, unlimited: false. Per-key
limit still wins. A non-positive pool surfaces the row but never invents
a 100% bar.
Tests cover: explicit key limit, PAYG account credits without key limit,
key limit taking priority over account credits, and a balance without a
positive denominator.
* fix(usage) render OpenRouter PAYG quota as a metered percentage bar
The frontend parser was routing every OpenRouter 'credits' quota through
buildCreditsQuota(), which sets isCredits: true. QuotaCardExpanded
short-circuits on that flag and shows only the USD balance as a bare
number, so a real PAYG payload (used: 7.33, total: 10, remaining: 2.67,
remainingPercentage: 27) was rendered as '$2.67' instead of the '27% left
/ 7.33 / 10' bar the backend already computed.
Drop isCredits: true for any payload whose total is a positive finite
number - the row then goes through the normal normalizeQuotaEntry() path
with currency preserved as an extra. The balance-only fallback (total 0
or non-finite denominator, used by legacy /credits responses) still uses
buildCreditsQuota() so the row stays renderable, and never invents a
100% percentage.
The frontend test now asserts:
- PAYG positive denominator -> total: 10, remainingPercentage: 27,
currency: 'USD', isCredits !== true.
- Balance-only payload -> isCredits === true, creditCount === 2.67,
total: 0, no fabricated 100%.
- NaN denominator -> balance-only fallback.
- Non-credits keys -> unchanged normalizeQuotaEntry() path.
- Mixed payload -> normal quota row + PAYG row, both kept.
* docs(changelog): add OpenRouter PAYG fix fragment
* docs(changelog): remove self credit
2026-09-18 12:21:17 -03:00
..
2026-09-10 09:20:18 -03:00
2026-09-18 11:28:20 -03:00
2026-09-16 13:36:08 -03:00
2026-09-17 13:22:09 -03:00
2026-09-03 07:49:42 -03:00
2026-09-10 08:15:57 -03:00
2026-09-18 11:57:40 -03:00
2026-09-18 11:56:32 -03:00
2026-07-21 21:42:36 -03:00
2026-09-16 21:02:04 -03:00
2026-09-15 13:08:21 -03:00
2026-08-28 06:52:46 -03:00
2026-09-17 16:27:01 -03:00
2026-09-18 12:21:17 -03:00
2026-09-18 11:28:20 -03:00
2026-03-05 08:41:44 -03:00
2026-09-17 10:56:01 -03:00
2026-09-16 15:18:36 -03:00
2026-08-28 09:30:57 -03:00
2026-08-28 09:30:57 -03:00
2026-09-11 22:05:11 -03:00
2026-08-28 22:07:40 -03:00
2026-08-28 09:30:57 -03:00
2026-08-28 09:30:57 -03:00
2026-08-28 09:30:57 -03:00
2026-08-09 00:21:52 -03:00
2026-08-03 17:22:08 +03:00
2026-08-28 09:30:57 -03:00
2026-08-28 09:30:57 -03:00
2026-08-09 17:54:23 -03:00
2026-08-28 09:30:57 -03:00
2026-08-09 17:02:47 -03:00
2026-09-17 02:32:10 -03:00
2026-08-28 09:30:57 -03:00
2026-08-09 17:02:47 -03:00
2026-07-18 03:17:09 -03:00
2026-07-18 21:18:34 -03:00
2026-08-18 19:23:46 -03:00
2026-08-11 04:25:23 -03:00
2026-08-11 04:25:23 -03:00
2026-08-11 04:25:23 -03:00
2026-08-11 04:25:23 -03:00
2026-08-11 04:25:23 -03:00
2026-08-11 04:25:23 -03:00
2026-08-06 06:05:58 -03:00
2026-07-22 20:41:19 -03:00
2026-07-22 20:41:19 -03:00
2026-09-03 12:40:21 -03:00
2026-08-30 09:09:51 -03:00
2026-06-29 08:40:06 -03:00
2026-09-14 23:56:35 -03:00
2026-08-26 09:21:41 -03:00
2026-08-24 19:57:12 -03:00
2026-08-24 19:57:12 -03:00
2026-09-18 11:33:05 -03:00
2026-07-22 20:41:19 -03:00
2026-08-26 09:21:52 -03:00
2026-08-20 23:07:25 -03:00
2026-09-11 17:42:16 -03:00
2026-07-13 09:12:40 -03:00
2026-09-16 06:10:43 -03:00
2026-05-26 23:51:47 -03:00
2026-08-13 00:02:25 -03:00
2026-09-03 07:49:42 -03:00
2026-09-03 08:29:14 -03:00
2026-09-03 23:43:38 -03:00
2026-07-20 15:56:40 -03:00
2026-07-06 02:25:17 -03:00
2026-08-11 09:53:39 -03:00
2026-08-09 09:51:56 -03:00
2026-04-13 14:43:32 -03:00
2026-09-18 11:31:43 -03:00
2026-06-16 01:00:40 -03:00
2026-06-27 09:07:12 -03:00
2026-09-17 16:26:25 -03:00
2026-04-19 19:50:30 -03:00
2026-04-12 22:41:12 -03:00
2026-08-06 05:24:13 -03:00
2026-08-25 19:25:18 -03:00
2026-06-25 13:17:40 -03:00
2026-09-02 10:41:00 -03:00
2026-09-02 10:41:00 -03:00
2026-06-25 13:17:40 -03:00
2026-05-15 12:51:07 -03:00
2026-07-21 12:19:01 -03:00
2026-05-02 00:48:54 -03:00
2026-08-23 01:07:32 -03:00
2026-05-23 01:46:59 -03:00
2026-08-20 06:28:45 -03:00
2026-09-10 10:47:11 -03:00
2026-07-04 13:00:30 -03:00
2026-09-18 11:31:52 -03:00
2026-08-11 04:35:20 -03:00
2026-09-07 09:05:29 -03:00
2026-08-30 11:44:18 -03:00
2026-06-23 03:08:29 -03:00
2026-08-11 09:08:23 -03:00
2026-08-11 09:08:23 -03:00
2026-08-23 18:13:11 -03:00
2026-08-11 09:08:23 -03:00
2026-08-11 09:08:23 -03:00
2026-09-17 16:26:25 -03:00
2026-09-16 12:59:45 -03:00
2026-09-17 16:24:21 -03:00
2026-09-03 13:00:44 -03:00
2026-05-24 18:05:58 -03:00
2026-07-13 09:12:40 -03:00
2026-08-21 08:02:16 -03:00
2026-08-07 11:23:27 -03:00
2026-09-15 15:07:42 -03:00
2026-08-11 04:25:23 -03:00
2026-07-13 09:12:40 -03:00
2026-08-21 08:25:14 -03:00
2026-07-04 13:00:30 -03:00
2026-06-13 17:27:40 -03:00
2026-09-18 11:35:50 -03:00
2026-05-26 23:51:47 -03:00
2026-08-09 15:21:37 -03:00
2026-07-18 03:17:09 -03:00
2026-06-29 08:40:06 -03:00
2026-08-18 11:31:46 -03:00
2026-07-23 05:17:35 -03:00
2026-05-29 13:21:36 -03:00
2026-09-15 13:08:21 -03:00
2026-09-03 08:29:14 -03:00
2026-09-03 23:39:43 -03:00
2026-09-17 16:27:19 -03:00
2026-07-23 01:33:32 -03:00
2026-07-20 15:57:29 -03:00
2026-07-20 15:57:29 -03:00
2026-07-26 12:11:02 -03:00
2026-09-07 08:58:12 -03:00
2026-09-07 08:58:12 -03:00
2026-09-02 10:41:00 -03:00
2026-07-04 13:00:30 -03:00
2026-07-19 02:31:26 -03:00
2026-07-26 03:53:06 -03:00
2026-09-11 17:41:33 -03:00
2026-08-28 14:07:39 -03:00
2026-05-23 01:46:59 -03:00
2026-09-14 23:55:21 -03:00
2026-08-30 02:31:09 -03:00
2026-07-13 09:12:40 -03:00
2026-08-05 21:42:52 -03:00
2026-07-13 09:12:40 -03:00
2026-08-23 22:17:12 -03:00
2026-07-27 11:30:33 -03:00
2026-09-18 11:58:05 -03:00
2026-09-02 10:41:00 -03:00
2026-09-10 09:20:18 -03:00
2026-09-02 01:55:42 -03:00
2026-06-19 06:49:01 -03:00
2026-09-16 06:15:00 -03:00
2026-04-12 10:34:10 -03:00
2026-09-11 19:28:10 -03:00
2026-09-18 11:32:01 -03:00
2026-09-03 07:50:41 -03:00
2026-08-26 09:25:25 -03:00
2026-05-29 12:44:29 -03:00
2026-04-22 01:39:49 -03:00
2026-09-07 08:57:02 -03:00
2026-08-06 10:40:20 -03:00
2026-07-23 12:17:58 -03:00
2026-07-27 17:25:43 -03:00
2026-09-02 10:41:00 -03:00
2026-07-22 06:59:24 -03:00
2026-08-18 12:27:46 -03:00
2026-07-20 15:57:15 -03:00
2026-08-11 09:51:35 -03:00
2026-09-03 08:24:32 -03:00
2026-09-11 22:06:29 -03:00
2026-08-30 11:11:46 -03:00
2026-09-02 00:12:13 -03:00
2026-09-18 11:32:10 -03:00
2026-09-18 11:32:10 -03:00
2026-08-30 02:31:09 -03:00
2026-09-02 10:41:00 -03:00
2026-08-06 00:08:52 -03:00
2026-08-23 18:13:11 -03:00
2026-08-04 10:06:31 -03:00
2026-09-18 11:59:15 -03:00
2026-09-15 12:52:41 -03:00
2026-09-01 01:57:17 -03:00
2026-09-10 09:20:18 -03:00
2026-09-10 10:49:34 -03:00
2026-05-10 00:55:06 -03:00
2026-06-07 07:20:02 -03:00
2026-07-27 19:08:12 -03:00
2026-07-27 19:08:12 -03:00
2026-07-04 13:00:30 -03:00
2026-08-06 10:40:20 -03:00
2026-09-07 08:59:39 -03:00
2026-08-24 19:57:12 -03:00
2026-08-30 19:39:36 -03:00
2026-09-18 11:58:05 -03:00
2026-09-10 10:47:11 -03:00
2026-04-13 13:11:30 -03:00
2026-08-14 15:40:33 -03:00
2026-09-15 13:08:21 -03:00
2026-09-16 21:01:48 -03:00
2026-09-18 11:59:06 -03:00
2026-08-31 14:10:26 -03:00
2026-09-16 13:38:23 -03:00
2026-09-17 16:27:01 -03:00
2026-09-17 18:52:59 -03:00
2026-09-17 16:26:08 -03:00
2026-07-13 09:12:40 -03:00
2026-09-18 11:57:08 -03:00
2026-08-22 14:39:47 -03:00
2026-08-28 11:14:24 -03:00
2026-08-26 17:41:28 -03:00
2026-08-06 10:41:04 -03:00
2026-07-13 09:12:40 -03:00
2026-09-18 11:59:15 -03:00
2026-05-29 13:21:36 -03:00
2026-09-18 11:59:15 -03:00
2026-06-04 20:05:38 -03:00
2026-05-29 13:21:36 -03:00
2026-08-06 10:41:04 -03:00
2026-05-10 00:55:06 -03:00
2026-05-10 00:55:06 -03:00
2026-08-05 22:31:10 -03:00
2026-08-28 04:45:17 -03:00
2026-09-15 16:19:10 -03:00
2026-09-18 11:31:27 -03:00
2026-08-17 07:04:48 -03:00
2026-09-17 02:31:19 -03:00
2026-09-01 15:36:39 -03:00
2026-08-24 19:57:12 -03:00
2026-09-16 12:59:45 -03:00
2026-08-10 18:16:13 -03:00
2026-09-03 21:30:32 -03:00
2026-09-03 21:30:32 -03:00
2026-09-10 09:20:18 -03:00
2026-05-10 00:55:06 -03:00
2026-09-02 10:41:00 -03:00
2026-06-13 17:27:40 -03:00
2026-08-28 16:41:42 -03:00
2026-08-30 02:31:09 -03:00
2026-08-30 11:10:44 -03:00
2026-06-04 20:05:38 -03:00
2026-07-06 02:25:17 -03:00
2026-08-13 07:52:41 -03:00
2026-09-17 10:43:54 -03:00
2026-09-18 11:58:05 -03:00
2026-07-18 03:17:09 -03:00
2026-08-18 10:50:31 -03:00
2026-08-24 23:46:45 -03:00
2026-08-30 02:31:09 -03:00
2026-08-03 18:22:14 -03:00
2026-07-27 23:57:23 -03:00
2026-09-16 13:29:05 -03:00
2026-06-22 03:17:02 -03:00
2026-06-08 00:48:01 -03:00
2026-04-17 23:21:02 -03:00
2026-04-03 00:15:35 -03:00
2026-08-18 10:52:52 -03:00
2026-07-26 12:11:02 -03:00
2026-08-12 15:58:40 -03:00