fix: use token suffix for usage cache key (prefix is identical)

All OAuth tokens start with "sk-ant-oat01-" so slice(0,12) produced
the same cache key for every token. Use slice(-8) instead.
This commit is contained in:
Eyejoker
2026-03-24 15:45:58 +09:00
parent 6fc1c77418
commit 77b4ab1c83

View File

@@ -72,7 +72,8 @@ function saveUsageDiskCache(): void {
}
function cacheKey(token: string): string {
return token.slice(0, 12);
// Use last 8 chars — prefix is always "sk-ant-oat01-" for all tokens
return token.slice(-8);
}
// Rate limit: at most one API call per token per 5 minutes