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:
@@ -72,7 +72,8 @@ function saveUsageDiskCache(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cacheKey(token: string): string {
|
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
|
// Rate limit: at most one API call per token per 5 minutes
|
||||||
|
|||||||
Reference in New Issue
Block a user