zen: tpm based routing
This commit is contained in:
@@ -32,13 +32,7 @@ export function createModelTpmLimiter(providers: { id: string; model: string; tp
|
|||||||
track: async (id: string, model: string, usageInfo: UsageInfo) => {
|
track: async (id: string, model: string, usageInfo: UsageInfo) => {
|
||||||
const key = `${id}/${model}`
|
const key = `${id}/${model}`
|
||||||
if (!keys.includes(key)) return
|
if (!keys.includes(key)) return
|
||||||
const usage =
|
const usage = usageInfo.inputTokens
|
||||||
usageInfo.inputTokens +
|
|
||||||
usageInfo.outputTokens +
|
|
||||||
(usageInfo.reasoningTokens ?? 0) +
|
|
||||||
(usageInfo.cacheReadTokens ?? 0) +
|
|
||||||
(usageInfo.cacheWrite5mTokens ?? 0) +
|
|
||||||
(usageInfo.cacheWrite1hTokens ?? 0)
|
|
||||||
if (usage <= 0) return
|
if (usage <= 0) return
|
||||||
await Database.use((tx) =>
|
await Database.use((tx) =>
|
||||||
tx
|
tx
|
||||||
|
|||||||
Reference in New Issue
Block a user