(config?: FalClientConfig)
| 19 | } |
| 20 | |
| 21 | export function configureFalClient(config?: FalClientConfig): void { |
| 22 | const apiKey = config?.apiKey ?? getFalApiKeyFromEnv() |
| 23 | fal.config({ |
| 24 | credentials: apiKey, |
| 25 | // Wrap the (optionally overridden) fetch to read fal's |
| 26 | // `x-fal-billable-units` header off every response so adapters can surface |
| 27 | // the billed quantity as `result.usage`. See ./billing.ts. |
| 28 | fetch: createBillingFetch(config?.fetch), |
| 29 | ...(config?.proxyUrl ? { proxyUrl: config.proxyUrl } : {}), |
| 30 | }) |
| 31 | } |
| 32 | |
| 33 | export function generateId(prefix: string): string { |
| 34 | return _generateId(prefix) |
no test coverage detected