(value: unknown)
| 62 | } |
| 63 | |
| 64 | function parseBillingEvent(value: unknown): FalAIBillingEvent | undefined { |
| 65 | if (!isRecordLike(value)) return undefined |
| 66 | |
| 67 | const requestId = value.request_id |
| 68 | const endpointId = value.endpoint_id |
| 69 | const costEstimateNanoUsd = getNumber(value.cost_estimate_nano_usd) |
| 70 | |
| 71 | if (typeof requestId !== 'string' || typeof endpointId !== 'string') return undefined |
| 72 | if (costEstimateNanoUsd === undefined) return undefined |
| 73 | |
| 74 | return { |
| 75 | request_id: requestId, |
| 76 | endpoint_id: endpointId, |
| 77 | output_units: getNumber(value.output_units) ?? null, |
| 78 | unit_price: getNumber(value.unit_price) ?? null, |
| 79 | percent_discount: getNumber(value.percent_discount) ?? null, |
| 80 | cost_estimate_nano_usd: costEstimateNanoUsd, |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | async function fetchFalAIBillingEvent( |
| 85 | apiKey: string, |
nothing calls this directly
no test coverage detected