MCPcopy
hub / github.com/codeaashu/claude-code / extractRawUtilization

Function extractRawUtilization

src/services/claudeAiLimits.ts:164–179  ·  view source on GitHub ↗
(headers: globalThis.Headers)

Source from the content-addressed store, hash-verified

162}
163
164function extractRawUtilization(headers: globalThis.Headers): RawUtilization {
165 const result: RawUtilization = {}
166 for (const [key, abbrev] of [
167 ['five_hour', '5h'],
168 ['seven_day', '7d'],
169 ] as const) {
170 const util = headers.get(
171 `anthropic-ratelimit-unified-${abbrev}-utilization`,
172 )
173 const reset = headers.get(`anthropic-ratelimit-unified-${abbrev}-reset`)
174 if (util !== null && reset !== null) {
175 result[key] = { utilization: Number(util), resets_at: Number(reset) }
176 }
177 }
178 return result
179}
180
181type StatusChangeListener = (limits: ClaudeAILimits) => void
182export const statusListeners: Set<StatusChangeListener> = new Set()

Callers 2

Calls 1

getMethod · 0.65

Tested by

no test coverage detected