MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / fetchRateLimitsByModel

Function fetchRateLimitsByModel

web/src/server/free-session/public-api.ts:175–187  ·  view source on GitHub ↗
(
  userId: string,
  accessTier: FreebuffAccessTier,
  deps: SessionDeps,
)

Source from the content-addressed store, hash-verified

173}
174
175async function fetchRateLimitsByModel(
176 userId: string,
177 accessTier: FreebuffAccessTier,
178 deps: SessionDeps,
179): Promise<Record<string, FreebuffSessionRateLimit>> {
180 const config = quotaConfigForAccessTier(accessTier)
181 const snapshot = await fetchSessionQuotaSnapshot(userId, config, deps)
182 return Object.fromEntries(
183 config.models.map(
184 (model) => [model, toRateLimitInfo(model, snapshot)] as const,
185 ),
186 )
187}
188
189function onlyUsedRateLimitsByModel(
190 rateLimitsByModel: Record<string, FreebuffSessionRateLimit>,

Callers 2

attachRateLimitFunction · 0.85
noneResponseFunction · 0.85

Calls 3

quotaConfigForAccessTierFunction · 0.85
toRateLimitInfoFunction · 0.85

Tested by

no test coverage detected