JIA-ss
fa3ea5ee4d
feat(gateway): filter /v1/usage stats by API Key instead of UserID
...
Previously the /v1/usage endpoint aggregated usage stats (today/total
tokens, cost, RPM/TPM) across all API Keys belonging to the user.
This made it impossible to distinguish usage from different API Keys
(e.g. balance vs subscription keys).
Now the usage stats are filtered by the current request's API Key ID,
so each key only sees its own usage data. The balance/remaining fields
are unaffected and still reflect the user-level wallet balance.
Changes:
- Add GetAPIKeyDashboardStats to repository interface and implementation
- Add getPerformanceStatsByAPIKey helper (also fixes TPM to include
cache_creation_tokens and cache_read_tokens)
- Add GetAPIKeyDashboardStats to UsageService
- Update Usage handler to call GetAPIKeyDashboardStats(apiKey.ID)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-02-05 11:45:54 +08:00
..
2026-01-13 11:14:32 +08:00
2026-01-15 15:14:44 +08:00
2026-01-07 16:59:35 +08:00
2025-12-26 16:45:40 +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-05 11:45:54 +08:00
2026-02-02 22:13:50 +08:00
2026-01-15 15:14:44 +08:00
2026-01-01 18:59:38 +08:00
2026-02-03 20:37:30 +08:00
2026-02-03 16:48:52 +08:00
2026-02-03 19:29:39 +08:00
2026-01-11 10:55:25 +08:00
2026-02-03 21:43:41 +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-03 15:36:17 +08:00
2026-02-03 22:21:06 +08:00
2026-01-05 17:14:06 +08:00
2026-02-03 14:23:47 +08:00
2026-02-02 22:13:50 +08:00
2026-01-16 11:57:14 +08:00
2026-02-03 14:25:30 +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-03 21:43:41 +08:00
2026-01-11 10:55:25 +08:00
2026-02-03 21:43:41 +08:00
2026-02-03 20:00:43 +08:00
2026-02-03 20:00:43 +08:00
2026-02-03 20:49:58 +08:00
2026-02-03 19:49:31 +08:00
2026-01-11 10:55:26 +08:00
2026-02-03 13:38:44 +08:00
2026-02-03 15:36:17 +08:00
2025-12-25 17:15:01 +08:00
2025-12-31 08:50:12 +08:00
2026-01-04 22:10:32 +08:00
2026-01-05 17:07:29 +08:00
2026-02-02 21:47:02 +08:00
2026-01-08 23:07:00 +08:00
2026-01-16 17:35:17 +08:00
2026-02-02 22:13:50 +08:00
2026-01-03 06:32:51 -08:00
2026-01-05 14:41:08 +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
2025-12-28 09:49:54 +08:00
2026-02-03 15:36:17 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-01-29 02:36:28 +08:00
2026-02-02 22:13:50 +08:00
2026-01-29 01:49:51 +08:00
2026-01-29 02:03:54 +08:00
2026-01-05 00:56:48 +08:00
2026-01-04 18:26:39 -08:00
2026-01-31 02:01:51 +08:00
2025-12-31 08:50:12 +08:00
2026-02-05 09:53:20 +08:00
2026-02-03 06:01:29 +08:00
2026-02-03 15:36:17 +08:00
2026-02-02 22:13:50 +08:00
2026-02-03 21:34:55 +08:00
2026-01-08 23:47:29 +08:00
2026-01-08 23:47:29 +08:00
2025-12-26 00:11:03 -08:00
2026-01-04 15:36:00 +08:00
2026-01-14 15:55:44 +08:00
2026-02-02 22:13:50 +08:00
2025-12-31 16:25:45 +08:00
2025-12-26 00:11:03 -08:00
2026-02-02 21:47:47 +08:00
2026-01-05 17:07:29 +08:00
2026-02-02 22:20:08 +08:00
2026-02-02 22:13:50 +08:00
2026-02-03 16:15:37 +08:00
2026-01-16 13:03:04 +08:00
2026-02-02 22:13:50 +08:00
2026-02-03 21:22:33 +08:00
2026-02-03 21:22:33 +08:00
2026-02-02 22:13:50 +08:00
2026-01-15 23:52:50 +08:00
2026-02-04 15:56:01 +08:00
2026-02-02 22:13:50 +08:00
2026-01-16 17:35:17 +08:00
2026-02-02 22:13:50 +08:00
2026-01-13 16:47:35 +08:00
2026-01-13 16:47:35 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-03 14:25:30 +08:00
2026-01-10 01:38:47 +08:00
2026-01-15 21:31:55 +08:00
2026-01-11 20:55:44 +08:00
2026-01-15 21:31:55 +08:00
2026-01-15 15:14:44 +08:00
2026-01-15 15:14:44 +08:00
2026-01-15 21:31:55 +08:00
2026-01-09 20:53:44 +08:00
2026-01-10 01:38:47 +08:00
2026-01-10 01:38:47 +08:00
2026-01-09 20:53:44 +08:00
2026-01-15 15:14:44 +08:00
2026-01-15 23:02:15 +08:00
2026-01-09 20:53:44 +08:00
2026-02-03 16:55:13 +08:00
2026-01-15 15:14:44 +08:00
2026-02-03 17:03:54 +08:00
2026-01-09 20:53:44 +08:00
2026-02-03 14:25:30 +08:00
2026-01-12 14:17:42 +08:00
2026-01-12 14:17:42 +08:00
2026-01-09 20:53:44 +08:00
2026-01-11 23:57:20 +08:00
2026-01-28 00:01:03 +08:00
2026-01-15 21:31:55 +08:00
2026-01-15 15:14:44 +08:00
2026-02-02 22:13:50 +08:00
2026-01-15 15:14:44 +08:00
2026-01-23 19:39:48 +08:00
2026-01-12 00:02:19 +08:00
2026-01-15 15:14:44 +08:00
2026-01-09 20:53:44 +08:00
2026-02-02 22:13:50 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-11 10:55:25 +08:00
2026-01-15 15:15:20 +08:00
2026-01-15 15:14:44 +08:00
2026-01-15 15:15:20 +08:00
2026-01-03 06:29:02 -08:00
2026-01-15 15:06:34 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2025-12-26 16:45:40 +08:00
2026-02-03 20:37:30 +08:00
2026-01-12 14:19:06 +08:00
2026-01-12 14:19:06 +08:00
2026-01-12 14:19:06 +08:00
2026-01-12 14:19:06 +08:00
2026-02-02 22:13:50 +08:00
2026-02-03 17:03:54 +08:00
2025-12-26 16:45:40 +08:00
2026-02-03 13:38:44 +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-01-11 21:54:52 -08:00
2026-01-16 15:25:33 +08:00
2026-01-16 15:25:33 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-01-15 19:08:07 +08:00
2026-01-15 18:27:06 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-01-04 19:28:20 +08:00
2025-12-31 16:25:45 +08:00
2026-02-02 22:13:50 +08:00
2025-12-31 23:42:01 +08:00
2026-01-04 19:28:20 +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-03 14:36:29 +08:00
2026-02-05 11:45:54 +08:00
2026-01-03 06:37:08 -08:00
2026-01-01 18:58:34 +08:00
2026-02-02 22:20:08 +08:00
2026-02-02 22:13:50 +08:00
2025-12-26 16:45:40 +08:00
2026-02-02 22:20:08 +08:00
2026-01-16 15:25:33 +08:00
2026-02-02 22:13:50 +08:00