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-05-14 11:46:24 +08:00
2026-07-01 14:35:49 +08:00
2026-04-09 18:14:28 +08:00
2026-07-01 12:21:45 +08:00
2026-06-16 14:08:50 +08:00
2026-06-16 11:39:15 +08:00
2026-07-05 17:24:38 +08:00
2026-05-20 15:44:00 +08:00
2026-02-02 22:13:50 +08:00
2026-05-03 22:12:57 +08:00
2026-05-03 22:12:57 +08:00
2026-05-03 22:12:57 +08:00
2026-05-20 15:52:00 +08:00
2026-04-21 10:13:28 -07:00
2026-04-09 18:14:28 +08:00
2026-05-14 16:38:45 +08:00
2026-01-03 06:37:08 -08:00
2026-01-03 06:37:08 -08:00
2026-02-02 22:13:50 +08:00
2026-06-05 14:00:57 +08:00
2026-07-08 15:26:54 +08:00
2026-05-07 09:14:47 +08:00
2026-04-09 18:14:28 +08:00
2026-07-09 15:03:38 +08:00
2026-04-22 18:36:44 +08:00
2026-04-22 14:56:56 +08:00
2026-03-14 17:48:21 +08:00
2026-03-16 20:22:10 +08:00
2026-07-07 10:50:36 +08:00
2026-07-07 10:50:36 +08:00
2026-07-07 18:53:56 +08:00
2026-07-07 18:53:56 +08:00
2026-07-07 20:13:28 +08:00
2026-07-07 18:53:56 +08:00
2026-02-07 19:46:42 +08:00
2026-02-08 12:05:39 +08:00
2026-02-07 19:46:42 +08:00
2026-05-29 17:19:15 +08:00
2026-07-01 00:37:51 +08:00
2026-06-12 22:09:53 +08:00
2026-05-19 22:05:43 +08:00
2026-04-14 09:35:20 +08:00
2026-04-04 11:13:58 +08:00
2026-04-09 18:14:28 +08:00
2026-04-14 18:34:57 +08:00
2026-06-25 23:41:00 +08:00
2026-06-25 23:41:00 +08:00
2026-03-02 16:04:20 +08:00
2026-03-27 14:33:05 +08:00
2026-01-01 04:01:51 +08:00
2026-07-07 10:04:38 +08:00
2026-07-07 10:04:38 +08:00
2026-05-07 09:14:47 +08:00
2026-06-12 01:47:01 +08:00
2026-06-26 10:43:05 +08:00
2026-04-15 15:02:21 +08:00
2026-01-11 15:00:16 +08:00
2026-01-11 15:00:16 +08:00
2026-05-23 15:04:24 +08:00
2026-05-23 15:04:24 +08:00
2026-06-12 15:06:01 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2026-04-14 09:35:20 +08:00
2026-03-07 18:19:04 +08:00
2026-02-05 21:52:54 +08:00
2026-02-10 11:42:39 +08:00
2025-12-31 23:42:01 +08:00
2026-07-01 12:21:45 +08:00
2026-02-28 15:01:20 +08:00
2026-06-12 01:47:01 +08:00
2026-02-02 22:13:50 +08:00
2026-02-26 10:53:04 +08:00
2026-03-02 16:04:20 +08:00
2026-01-14 15:55:44 +08:00
2026-01-14 15:55:44 +08:00
2026-01-15 18:27:06 +08:00
2026-03-02 16:04:20 +08:00
2026-01-07 23:15:20 +08:00
2026-03-02 16:04:20 +08:00
2026-06-26 10:36:09 +08:00
2026-06-26 10:36:09 +08:00
2026-05-20 16:53:23 +08:00
2026-05-20 11:33:29 +08:00
2026-07-08 13:50:49 +08:00
2026-05-26 13:57:59 +08:00
2026-05-26 13:57:59 +08:00
2026-06-12 15:06:01 +08:00
2026-02-28 15:01:20 +08:00
2026-02-23 12:45:37 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2026-03-02 01:12:41 +08:00
2026-01-03 06:36:35 -08:00
2026-04-08 10:39:15 -07:00
2026-03-27 20:11:24 +08:00
2026-06-05 22:47:24 +08:00
2026-06-05 22:47:24 +08:00
2026-04-22 18:01:51 +08:00
2026-04-22 18:01:51 +08:00
2026-06-16 11:50:25 +08:00
2026-07-06 12:22:04 +08:00
2026-07-09 15:38:59 +08:00
2026-04-23 12:58:13 +08:00
2026-04-23 12:23:04 +08:00
2026-04-23 12:23:04 +08:00
2026-07-03 23:02:27 +08:00
2026-01-15 15:14:44 +08:00
2026-02-28 15:01:20 +08:00
2026-06-05 10:58:44 +08:00
2026-02-14 11:21:30 +08:00
2026-06-05 14:00:57 +08:00
2026-01-11 23:49:03 +08:00
2026-01-09 20:52:57 +08:00
2026-03-03 01:05:11 +08:00
2026-06-05 14:00:57 +08:00
2026-01-23 19:39:48 +08:00
2026-02-12 14:20:14 +08:00
2026-02-12 14:20:14 +08:00
2026-06-05 10:58:44 +08:00
2026-01-12 14:17:42 +08:00
2026-05-19 19:37:41 +08:00
2026-01-11 23:57:20 +08:00
2026-06-27 14:35:19 +08:00
2026-01-24 01:14:44 +08:00
2026-01-09 20:52:57 +08:00
2026-07-03 23:02:27 +08:00
2026-06-16 11:48:13 +08:00
2026-04-09 18:14:28 +08:00
2026-03-02 16:04:20 +08:00
2026-03-02 16:04:20 +08:00
2026-04-09 19:25:08 +08:00
2026-06-08 00:01:30 +08:00
2026-01-15 15:14:44 +08:00
2026-02-03 17:12:27 +08:00
2026-03-19 23:48:37 +08:00
2025-12-29 19:23:49 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2025-12-26 16:47:44 +08:00
2025-12-26 16:47:44 +08:00
2025-12-26 16:47:44 +08:00
2026-05-20 16:08:41 +08:00
2026-04-09 18:14:28 +08:00
2026-05-20 16:08:41 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-05 12:42:54 +08:00
2026-03-02 16:04:20 +08:00
2026-03-12 21:24:01 +08:00
2026-02-28 20:38:35 +08:00
2026-03-08 06:59:53 +08:00
2026-04-30 11:38:11 +08:00
2026-07-05 17:24:38 +08:00
2026-07-01 12:21:45 +08:00
2026-07-05 17:24:38 +08:00
2026-06-16 14:21:09 +08:00
2026-06-16 11:57:32 +08:00
2026-02-02 22:13:50 +08:00
2026-02-12 12:07:20 +08:00
2026-02-12 12:04:13 +08:00
2026-06-02 12:46:46 +08:00
2026-03-04 10:15:42 +08:00
2025-12-29 10:03:27 +08:00
2026-03-07 18:19:04 +08:00
2026-02-02 22:13:50 +08:00
2026-06-26 10:36:09 +08:00
2026-03-03 16:11:05 +08:00
2025-12-30 17:13:32 +08:00
2026-01-03 06:34:00 -08:00
2026-01-11 21:54:52 -08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-02-02 22:13:50 +08:00
2026-01-03 06:36:35 -08:00
2026-01-03 10:52:24 +08:00
2025-12-25 16:01:17 +08:00
2025-12-25 17:15:01 +08:00
2026-04-23 14:53:57 +08:00
2026-07-07 18:53:56 +08:00
2026-07-07 18:53:56 +08:00
2026-02-02 22:13:50 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-03-21 01:23:20 +08:00
2026-07-08 08:49:21 +08:00
2026-05-30 17:52:18 +08:00
2026-07-09 15:38:59 +08:00
2026-07-03 21:02:32 +08:00
2026-07-09 15:38:59 +08:00
2026-07-09 15:38:59 +08:00
2026-04-09 18:14:28 +08:00
2026-06-24 23:43:03 +08:00
2026-07-08 08:49:21 +08:00
2026-07-08 08:49:21 +08:00
2026-03-12 18:38:09 +08:00
2026-07-08 13:50:49 +08:00
2026-01-01 19:09:06 +08:00
2026-04-23 16:34:37 +08:00
2026-07-07 10:04:38 +08:00
2026-07-07 10:04:38 +08:00
2026-05-29 17:19:15 +08:00
2026-06-30 13:22:27 +08:00
2026-05-26 10:49:20 +08:00
2026-05-29 17:19:15 +08:00
2026-05-29 17:19:15 +08:00
2026-05-26 10:49:20 +08:00
2026-04-22 13:22:33 +08:00
2026-04-22 14:56:56 +08:00
2026-04-22 14:56:56 +08:00
2026-06-08 22:54:01 +08:00
2026-06-06 10:28:28 +08:00
2026-04-21 00:13:40 +08:00
2026-04-22 16:38:36 +08:00
2026-05-30 17:52:18 +08:00
2026-04-21 10:13:28 -07:00
2026-04-22 02:42:43 +08:00
2026-06-22 10:30:27 +08:00
2026-04-23 16:34:37 +08:00
2026-07-01 22:19:21 +08:00
2026-07-01 22:19:21 +08:00
2026-07-04 05:30:50 +08:00