Repository navigation
Conversation
ProxyServer.estimateCost kept its own per-1K table that priced every OpenAI run at $5/$15 per 1M (GPT-4o is $2.50/$10) and every Claude run at Sonnet rates regardless of model, so a Haiku 4.5 run was billed 3x and an Opus 4.6 run at 60% of list. Price by request.model through telemetry.ts MODEL_PRICING (which takes its Claude and GPT-5 rows from model-pricing.ts), and fall back to a per-provider row only when the model has no price. Adds a regression test and a weekly drift check on src/ against the providers' pricing pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ProxyServer.estimateCostinsrc/server.ts(line 1363 on main) keeps its own per-1K table, so every OpenAI run lands in the ledger at $5/$15 per 1M (GPT-4o lists at $2.50/$10) and every Claude run at Sonnet rates whatever the model: a Haiku 4.5 run is recorded at 3x its price and an Opus 4.6 run at 60%. That table is also the only Claude/GPT price outsidemodel-pricing.ts, which its header says should not happen.This prices each run by
request.modelthroughtelemetry.tsMODEL_PRICING(aliases andprovider/prefixes included) and only falls back to a per-provider row, now real list prices, when the model has no price.__tests__/server-estimate-cost.test.tsadds 7 cases, including one that checks the new helper agrees withestimateCostfor every row;tsc --noEmitis clean andmodel-pricingandrun-attributionstill pass (the suites that need the monorepo ordist/fail the same way on main).I also added
.github/workflows/llm-prices.yml, which runs on PRs touchingsrc/and weekly and fails if a hard-coded price drifts from the official pages. It uses llm-prices, an MIT action I maintain: on main it flags exactly the two values above, and on this branch it finds 54 prices for 22 models with no drift. Since this repo is synced frompackages/proxy, the workflow may belong in the monorepo instead, and I am happy to drop it if you would rather keep the PR to the fix.