Skip to content

feat: add model-specific cache pricing - #45

Merged
pjb157 merged 1 commit into
mainfrom
peter/model-cache-pricing
Jul 31, 2026
Merged

feat: add model-specific cache pricing#45
pjb157 merged 1 commit into
mainfrom
peter/model-cache-pricing

Conversation

@pjb157

@pjb157 pjb157 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalize model-specific prompt-cache pricing from the admin models response
  • add calculated cache-read prices to the model catalog and supported model pages
  • replace the generated catalog’s blanket discount claim with model-specific guidance

Impact

Customers can see the current cache-read price per 1M input tokens for each supported model. Unsupported models display an unavailable marker, and model detail pages only show cache pricing when the required metadata and realtime tariff are present.

Validation

  • npm run test:run -- src/lib/models.test.ts src/lib/model-artifacts.test.ts (10 tests pass)
  • scoped ESLint on the four changed files
  • npm run build
  • git diff --check

The full test suite retains one unrelated existing failure in src/lib/search.test.ts (stripMarkdown removes inline code instead of preserving its text).

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
documentation Ready Ready Preview Jul 31, 2026 11:34am

Request Review

@pjb157
pjb157 marked this pull request as ready for review July 31, 2026 11:39
Copilot AI review requested due to automatic review settings July 31, 2026 11:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for model-specific prompt-cache pricing metadata to the docs site’s model pipeline, and surfaces a calculated cache-read price (per 1M input tokens) in both the models catalog page and individual model pages when the required realtime tariff + cache metadata are present.

Changes:

  • Extend model normalization (transformModels) to parse cache_pricing into a typed cachePricing field.
  • Compute and expose cacheReadPricePer1M (+ multiplier) in generated model artifacts, and render it in the models index table + model detail markdown.
  • Update copy in the models index markdown to remove the blanket “~10%” cache discount claim in favor of model-specific guidance.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/lib/models.ts Adds ModelCachePricing, parses cache_pricing from the admin models response, and exports transformModels for direct testing.
src/lib/models.test.ts Adds focused tests covering cache pricing normalization (enabled/disabled/absent).
src/lib/model-artifacts.ts Calculates cache-read pricing when metadata + realtime pricing exist, renders it in the index table and model markdown, and factors out renderModelsIndexMarkdown for testing.
src/lib/model-artifacts.test.ts Adds tests ensuring cache-read pricing is only computed when appropriate and is rendered (or omitted) correctly in markdown outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pjb157
pjb157 merged commit d25cd97 into main Jul 31, 2026
3 checks passed
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.

2 participants