Interface LLMPricingRegistry

All Known Implementing Classes:
InMemoryLLMPricingRegistry, JsonLLMPricingRegistry

public interface LLMPricingRegistry
SPI for converting TokenUsage into a USD CostEstimate (issue #79).

Default implementation is InMemoryLLMPricingRegistry, which holds rates programmatically and is suitable for tests and code-driven configuration. A JSON-loader implementation that ships rates for the 11 framework providers is a focused follow-up — this PR ships only the SPI + the in-memory adapter so consumers can plug in custom pricing (enterprise-negotiated rates, internal model registries) today.

Since:
0.5.0 (issue #79)
  • Method Summary

    Modifier and Type
    Method
    Description
    estimate(String provider, String model, TokenUsage usage)
    Compute a USD cost estimate for the given usage under the named provider + model.
    Stable version identifier of the pricing data — a date string, a content hash, whatever survives "what was the rate when this call was billed?"
  • Method Details

    • estimate

      CostEstimate estimate(String provider, String model, TokenUsage usage)
      Compute a USD cost estimate for the given usage under the named provider + model. Implementations MUST return a non-null CostEstimate; if the pair is unknown, return a zero estimate stamped with tableVersion() so the caller still sees provenance.
    • tableVersion

      String tableVersion()
      Stable version identifier of the pricing data — a date string, a content hash, whatever survives "what was the rate when this call was billed?" audits. Embedded in every CostEstimate the registry produces so downstream cost-aggregation can detect rate-table drift.