Skip to main content

Overview

Calculate the cost of an LLM inference call using FlatRateCostCalculator. Pricing is decoupled from usage — you define rates with InferencePricing, get token counts from the response’s InferenceUsage, and the calculator produces a Cost value object with total and per-category breakdown. The rates below are illustrative; applications should supply current rates from their chosen provider or internal pricing source.

Example