mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 16:04:01 +00:00
Usage was only broken down by model and tier, so a gateway shared by several callers could not tell how much each server key consumed. authenticate now records the fingerprint of the key that matched, and the monitor keeps requests and tokens per key in usage.server_keys for both the lifetime and the last hour; the entries sum to the aggregate totals. /api/api-keys attaches each key's usage and the WebUI shows it in the key list. Playground traffic borrows the first enabled key, so it is counted under "playground" instead. Like the rest of the monitor, the figures survive hot reloads and reset on restart. Closes #58.