( requestId: string | undefined, )
| 63 | * keeps the registry from growing across the lifetime of the process. |
| 64 | */ |
| 65 | export 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 |
no test coverage detected