Repository navigation
Conversation
…to gpt-4 pricing - gpt-3.5-turbo was priced at 1.5/2 per MTok (the instruct/0613 price); the bare alias points to 0125 at 0.5/1.5 - gpt-4.1, gpt-4.1-mini, gpt-4.1-nano and gpt-4-32k matched the base gpt-4 prefix and were billed at 30/60 - gpt-4o-2024-05-13 is 5/15, not the gpt-4o 2.5/10 - add Claude Sonnet 4/4.5, Haiku 4.5, Opus 4/4.1 and 3.7 Sonnet, which returned no cost at all - add a small workflow that checks this table against the official pricing pages weekly and on PRs that touch it
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This branch has not been deployed
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.
Description
calculateOpenAICostincore/llm/utils/calculateRequestCost.tsprices the baregpt-3.5-turboalias at $1.50/$2.00 per MTok (line 170). That is the instruct/0613 price; the alias points togpt-3.5-turbo-0125at $0.50/$1.50, so the console and CLI show 3x the real input cost. Because the table matches by prefix,gpt-4.1,gpt-4.1-mini,gpt-4.1-nanoandgpt-4-32kall fall through to basegpt-4and are billed at $30/$60 (15x too high forgpt-4.1at $2/$8), andgpt-4o-2024-05-13gets the $2.50/$10gpt-4oprice instead of $5/$15. On the Anthropic side, Sonnet 4/4.5, Haiku 4.5 (the default inconfig_schema.json), Opus 4/4.1 and 3.7 Sonnet return no cost at all, so I added those rows (avoiding a bareclaude-opus-4prefix, which would catch the cheaper Opus 4.5+ ids) and fixed two mislabeled comments. Prices are from https://developers.openai.com/api/docs/pricing and https://platform.claude.com/docs/en/about-claude/pricing.I also added
.github/workflows/llm-price-drift.yml, a 27-line job that runs only on PRs touching this file plus weekly, and fails if a hard-coded price drifts from the official pages. It uses llm-prices, an MIT action I maintain; on this branch it reports 44 prices for 15 models with no drift, and onmainit flags the twogpt-3.5-turbovalues. Happy to drop that file if you would rather keep the PR to the table.AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
N/A, pricing table change only.
Tests
Added 14 cases to
core/llm/utils/calculateRequestCost.vitest.ts(Sonnet 4/4.5, Haiku 4.5 with cache reads, Opus 4/4.1, an Opus 4.6 guard, the baregpt-3.5-turboalias, instruct, 16k,gpt-4.1/mini/nano,gpt-4-32k,gpt-4o-2024-05-13).npx vitest run llm/utils/calculateRequestCost.vitest.ts: 36/36 pass; 12 of the new cases fail onmain. Prettier check passes on the touched files.I made this with help from Claude Code and reviewed it.