Skip to main content
Changelog
2026-04-19

Generic long-context pricing tier support

feature

Provider pricing entries gained an optional long-context tier: a token threshold, plus elevated input and output rates that apply when a request’s input exceeds the threshold.

New fields on ModelPricingEntry:

  • long_context_threshold_tokens — e.g. 200000
  • long_context_input_cost_per_1m_tokens
  • long_context_output_cost_per_1m_tokens

Behavior: cost calculation automatically applies the elevated rates when the request crosses the threshold. Below the threshold, standard rates apply.

Current consumer: Gemini 2.5 Pro (the >200K context tier has distinct pricing). Anthropic removed the long-context premium on Opus 4.6/4.7 and Sonnet 4.6 prior to this release.

Safety fix included: safeTokenCount now clamps NaN and negative values to zero across all token buckets, preventing cost-calculation edge cases from producing spurious numbers.