shaw
d4952154ff
fix: bill Grok video per second and harden video usage logging
...
Follow-up fixes for the #3775 audit findings:
- Bill Grok video generation per second of output, matching the xAI rate
card: parse the request duration (1-15s, upstream default 8s) and compute
cost as per-second price x duration x count. The built-in rate card values
were already xAI per-second prices but were previously charged per video,
undercharging up to 15x with a user-controlled duration.
- Group video_price_* fields are now documented and surfaced as per-second
rates (USD/s); admin UI labels, placeholders and hints updated accordingly.
- Persist video_count/video_resolution/video_duration_seconds on usage_logs
(migration 172) so video billing is auditable, and exempt any row with
video_count > 0 from the image_size check constraint: a video billed via a
token-mode channel price produces billing_mode='token' with image_count=1
and no image_size, which the previous constraint rejected, dropping the
whole billing transaction.
- Only refetch the group in apiKeyWithFreshGroupMediaPricing when the group
object actually looks like it is missing media pricing fields (both media
multipliers zero and all prices nil, impossible for a normally loaded
group), removing a per-usage DB query for groups without overrides.
- Frontend: drop the unused admin.groups.mediaPricing locale block, map
cleared price inputs to null (create) / -1 (update, cleared via backend
normalizePrice) instead of sending "" that failed *float64 unmarshalling,
and align video price placeholders with the text-to-video default model
(grok-imagine-video 0.05/0.07, 1080p only on 1.5 at 0.25).
2026-07-09 15:38:59 +08:00
..
2026-07-01 12:21:45 +08:00
2025-12-29 10:03:27 +08:00
2026-03-07 15:06:13 +08:00
2026-02-02 22:13:50 +08:00
2026-03-03 15:01:10 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-06 12:22:04 +08:00
2026-06-12 22:09:53 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-05-19 22:05:43 +08:00
2025-12-29 10:03:27 +08:00
2026-02-10 11:42:39 +08:00
2026-07-08 13:50:49 +08:00
2026-07-04 05:30:50 +08:00
2026-02-28 15:01:20 +08:00
2026-04-20 17:39:57 +08:00
2026-07-04 05:30:50 +08:00
2026-07-09 15:38:59 +08:00
2026-04-11 13:16:35 +08:00
2026-04-21 12:41:27 +08:00
2026-04-14 16:26:46 +08:00
2026-04-20 17:39:57 +08:00
2026-07-04 05:30:50 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-06-08 00:01:30 +08:00
2026-05-19 15:53:28 +08:00
2026-07-09 15:38:59 +08:00
2026-07-09 15:38:59 +08:00
2026-02-12 11:41:20 +08:00
2025-12-31 15:31:26 +08:00
2026-04-11 13:16:35 +08:00
2026-03-27 14:33:05 +08:00
2026-02-02 22:13:50 +08:00
2026-07-09 15:38:59 +08:00
2026-07-06 12:22:04 +08:00
2025-12-29 10:03:27 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-05-26 10:49:20 +08:00
2025-12-31 14:11:57 +08:00
2026-07-01 12:21:45 +08:00
2025-12-29 10:03:27 +08:00
2026-07-01 12:21:45 +08:00
2026-07-01 12:21:45 +08:00
2026-07-01 12:21:45 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-03-07 15:06:13 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-03-07 15:06:13 +08:00
2026-03-07 15:06:13 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-03-03 15:01:10 +08:00
2026-01-04 19:28:20 +08:00
2026-01-10 13:14:35 +08:00
2026-03-03 15:01:10 +08:00
2026-03-03 15:01:10 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-06 12:22:04 +08:00
2026-07-04 05:30:50 +08:00
2026-07-04 05:30:50 +08:00
2026-07-06 12:22:04 +08:00
2026-07-06 12:22:04 +08:00
2026-06-12 22:09:53 +08:00
2026-04-20 20:21:02 +08:00
2026-04-21 14:14:49 +08:00
2026-06-12 22:09:53 +08:00
2026-06-12 22:09:53 +08:00
2026-04-23 17:31:15 +08:00
2026-04-21 10:10:56 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-20 20:21:02 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-05-19 22:05:43 +08:00
2026-04-21 14:14:49 +08:00
2026-04-21 14:14:49 +08:00
2026-05-19 22:05:43 +08:00
2026-05-19 22:05:43 +08:00
2026-07-04 05:30:50 +08:00
2026-01-03 06:37:08 -08:00
2026-07-04 05:30:50 +08:00
2026-02-10 11:42:39 +08:00
2026-02-05 21:52:54 +08:00
2026-02-05 21:52:54 +08:00
2026-02-10 11:42:39 +08:00
2026-02-10 11:42:39 +08:00
2026-01-10 13:14:35 +08:00
2026-07-08 13:50:49 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2026-07-08 13:50:49 +08:00
2026-07-08 13:50:49 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-07-09 15:38:59 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-21 12:41:27 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-21 12:41:27 +08:00
2026-04-21 12:41:27 +08:00
2026-04-14 16:26:46 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-14 16:26:46 +08:00
2026-04-14 16:26:46 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-06-08 00:01:30 +08:00
2025-12-29 10:03:27 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2026-05-19 15:53:28 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2026-05-19 15:53:28 +08:00
2026-05-19 15:53:28 +08:00
2025-12-29 10:03:27 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2025-12-31 15:31:26 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-31 15:31:26 +08:00
2025-12-29 10:03:27 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-06-30 13:22:27 +08:00
2026-07-04 05:30:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-07-09 15:38:59 +08:00
2025-12-31 14:11:57 +08:00
2026-01-10 13:14:35 +08:00
2026-07-09 15:38:59 +08:00
2026-07-09 15:38:59 +08:00
2026-07-06 12:22:04 +08:00
2025-12-29 10:03:27 +08:00
2026-05-26 10:49:20 +08:00
2026-07-06 12:22:04 +08:00
2026-07-06 12:22:04 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-10 13:14:35 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-10 13:14:35 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2025-12-31 14:11:57 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-31 14:11:57 +08:00
2025-12-31 14:11:57 +08:00