MCPcopy Create free account
hub / github.com/TanStack/ai / takeBillableUnits

Function takeBillableUnits

packages/ai-fal/src/utils/billing.ts:65–72  ·  view source on GitHub ↗
(
  requestId: string | undefined,
)

Source from the content-addressed store, hash-verified

63 * keeps the registry from growing across the lifetime of the process.
64 */
65export function takeBillableUnits(
66 requestId: string | undefined,
67): number | undefined {
68 if (!requestId) return undefined
69 const units = billableUnitsByRequestId.get(requestId)
70 if (units !== undefined) billableUnitsByRequestId.delete(requestId)
71 return units
72}
73
74/**
75 * Build a {@link TokenUsage} carrying fal's billed quantity. Media generation has

Callers 6

getVideoUrlMethod · 0.90
transformResponseMethod · 0.90
transformResponseMethod · 0.90
transformResponseMethod · 0.90
transformResponseMethod · 0.90
billing.test.tsFile · 0.90

Calls 2

getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected