Documentation
    Preparing search index...

    Function calculateTokenCost

    • Calculates exact token counts and cost in USD from usage metadata.

      Parameters

      • usage: RawTokenUsageMetadata | null | undefined

        Raw usage metadata returned from the AI model API.

      • model: string = 'gemini-2.5-flash'

        Identifier of the model used.

      Returns OkfTokenUsage

      Standardized OkfTokenUsage with cost in USD.