(endpointId: string)
| 37 | } |
| 38 | |
| 39 | function getFalAIFallbackProviderCostDollars(endpointId: string): number { |
| 40 | const normalizedEndpointId = endpointId.toLowerCase() |
| 41 | |
| 42 | const isImageEndpoint = |
| 43 | normalizedEndpointId.includes('image') || |
| 44 | normalizedEndpointId.includes('nano-banana') || |
| 45 | normalizedEndpointId.includes('seedream') || |
| 46 | normalizedEndpointId.includes('flux') || |
| 47 | normalizedEndpointId.includes('grok-imagine') |
| 48 | if (isImageEndpoint) return FALAI_IMAGE_FALLBACK_PROVIDER_COST_DOLLARS |
| 49 | |
| 50 | // Audio (TTS/voice clone, music, sound effects) is far cheaper than video, so it |
| 51 | // must not fall through to the video floor — that would over-bill a short clip. |
| 52 | const isAudioEndpoint = |
| 53 | normalizedEndpointId.includes('tts') || |
| 54 | normalizedEndpointId.includes('speech') || |
| 55 | normalizedEndpointId.includes('music') || |
| 56 | normalizedEndpointId.includes('sound-effect') || |
| 57 | normalizedEndpointId.includes('audio') || |
| 58 | normalizedEndpointId.includes('elevenlabs') |
| 59 | if (isAudioEndpoint) return FALAI_AUDIO_FALLBACK_PROVIDER_COST_DOLLARS |
| 60 | |
| 61 | return FALAI_VIDEO_FALLBACK_PROVIDER_COST_DOLLARS |
| 62 | } |
| 63 | |
| 64 | function parseBillingEvent(value: unknown): FalAIBillingEvent | undefined { |
| 65 | if (!isRecordLike(value)) return undefined |
no outgoing calls
no test coverage detected