bayma888
6146be1474
feat(api-key): add independent quota and expiration support
...
This feature allows API Keys to have their own quota limits and expiration
times, independent of the user's balance.
Backend:
- Add quota, quota_used, expires_at fields to api_key schema
- Implement IsExpired() and IsQuotaExhausted() checks in middleware
- Add ResetQuota and ClearExpiration API endpoints
- Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini)
- Include quota/expiration fields in auth cache for performance
- Expiration check returns 403, quota exhausted returns 429
Frontend:
- Add quota and expiration inputs to key create/edit dialog
- Add quick-select buttons for expiration (+7, +30, +90 days)
- Add reset quota confirmation dialog
- Add expires_at column to keys list
- Add i18n translations for new features (en/zh)
Migration:
- Add 045_add_api_key_quota.sql for new columns
2026-02-03 19:49:31 +08:00
..
2026-01-20 11:40:55 +08:00
2026-02-03 14:25:30 +08:00
2026-01-26 09:19:53 +08:00
2026-01-04 19:28:20 +08:00
2026-01-30 17:28:53 +08:00
2026-01-30 17:28:53 +08:00
2026-01-03 06:37:08 -08:00
2026-01-03 06:37:08 -08:00
2026-01-18 22:13:47 +08:00
2026-01-04 19:28:20 +08:00
2026-02-03 19:49:31 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2025-12-26 16:47:44 +08:00
2026-01-19 16:40:06 +08:00
2026-01-23 16:30:12 +08:00
2026-01-04 21:06:12 +08:00
2026-01-19 17:06:16 +08:00
2026-01-01 04:01:51 +08:00
2026-01-03 06:32:51 -08:00
2026-01-09 20:52:57 +08:00
2026-01-18 10:52:18 +08:00
2026-01-11 15:00:16 +08:00
2026-01-11 15:00:16 +08:00
2025-12-31 23:42:01 +08:00
2025-12-31 23:42:01 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2026-01-24 22:55:28 +08:00
2026-01-17 01:53:51 +08:00
2025-12-31 23:42:01 +08:00
2026-01-04 19:28:20 +08:00
2026-01-20 11:40:55 +08:00
2026-01-20 11:40:55 +08:00
2026-01-20 11:40:55 +08:00
2026-01-08 23:47:29 +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
2025-12-31 08:50:12 +08:00
2026-01-07 23:15:20 +08:00
2026-01-07 23:15:20 +08:00
2026-01-10 09:39:02 +08:00
2026-02-02 22:06:37 +08:00
2026-01-04 11:43:58 +08:00
2026-01-04 21:06:12 +08:00
2026-01-19 10:22:13 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2026-01-19 10:22:13 +08:00
2026-01-03 06:36:35 -08:00
2025-12-31 23:42:01 +08:00
2026-01-12 14:19:06 +08:00
2026-01-05 14:07:33 +08:00
2026-01-19 19:50:57 +08:00
2026-01-27 19:13:01 +08:00
2026-01-15 15:14:44 +08:00
2026-01-12 17:06:12 +08:00
2026-01-11 23:49:03 +08:00
2026-01-09 20:52:57 +08:00
2026-01-11 23:57:20 +08:00
2026-01-15 21:31:55 +08:00
2026-01-13 22:49:26 -08:00
2026-01-12 14:17:42 +08:00
2026-01-11 23:57:20 +08:00
2026-01-12 17:06:12 +08:00
2026-01-09 20:52:57 +08:00
2026-01-17 17:57:40 +08:00
2025-12-26 16:45:40 +08:00
2026-01-07 23:15:20 +08:00
2026-01-07 23:15:20 +08:00
2026-01-10 13:14:35 +08:00
2026-01-15 15:14:44 +08:00
2026-01-15 15:15:20 +08:00
2026-01-15 15:15:20 +08:00
2025-12-29 19:23:49 +08:00
2026-01-15 15:14:44 +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
2025-12-29 19:23:49 +08:00
2025-12-31 14:11:57 +08:00
2026-01-31 03:58:01 +08:00
2026-01-31 19:06:19 +08:00
2026-01-27 19:22:45 +08:00
2026-01-19 19:50:57 +08:00
2026-01-28 17:26:32 +08:00
2026-01-12 15:46:55 +08:00
2026-01-20 11:40:55 +08:00
2026-01-19 11:45:04 +08:00
2025-12-31 15:52:02 +08:00
2025-12-29 10:03:27 +08:00
2026-01-17 01:53:51 +08:00
2026-01-17 01:53:51 +08:00
2026-01-04 19:28:20 +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-01-26 09:19:53 +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-01-18 14:18:28 +08:00
2026-01-18 14:18:28 +08:00
2026-01-19 19:50:57 +08:00
2026-01-18 10:52:18 +08:00
2026-02-03 14:36:29 +08:00
2026-01-01 19:09:06 +08:00
2026-01-05 19:03:54 +08:00
2026-02-02 17:41:27 +08:00
2026-01-24 21:10:02 +08:00
2026-01-24 20:26:01 +08:00
2026-01-30 16:45:04 +08:00