Skip to content

Add cached input pricing support in cost calculations. Closes #1582#1613

Open
waldekmastykarz wants to merge 2 commits intodotnet:mainfrom
waldekmastykarz:waldekmastykarz/1582
Open

Add cached input pricing support in cost calculations. Closes #1582#1613
waldekmastykarz wants to merge 2 commits intodotnet:mainfrom
waldekmastykarz:waldekmastykarz/1582

Conversation

@waldekmastykarz
Copy link
Copy Markdown
Collaborator

Add cached input pricing support in cost calculations. Closes #1582

@waldekmastykarz waldekmastykarz requested a review from a team as a code owner April 11, 2026 14:53
Copilot AI review requested due to automatic review settings April 11, 2026 14:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for cache-aware OpenAI token pricing so cost calculations can account for cached prompt tokens separately from regular prompt tokens, aligning Dev Proxy telemetry/reporting with OpenAI’s cached-token billing model.

Changes:

  • Extends pricing data model to include CachedInput and updates cost calculation API to accept cached input token counts.
  • Updates OpenAI telemetry cost calculation to pass cached token usage into pricing calculations.
  • Enhances language model pricing loader to read optional cached_input pricing from the prices JSON.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
DevProxy.Plugins/Inspection/OpenAITelemetryPlugin.cs Passes cached prompt token counts into pricing cost calculation for telemetry and reporting.
DevProxy.Plugins/Inspection/LanguageModelPricingLoader.cs Loads optional cached_input price per model from pricing JSON data.
DevProxy.Abstractions/LanguageModel/PricesData.cs Adds cached input price field and updates cost calculation logic/signature to account for cached tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend OpenAITelemetryPlugin: Add tracking & pricing for cached tokens

2 participants