Add new OpenAI model pricing and remove -codex suffix stripping#358
Add new OpenAI model pricing and remove -codex suffix stripping#358xiaoqianWX wants to merge 1 commit intosteipete:mainfrom
Conversation
xiaoqianWX
commented
Feb 12, 2026
- Add pricing for gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.3-codex
- Fix prev PR's mistake in pricing
- Remove -codex suffix fallback in normalizeCodexModel to ensure exact pricing lookups for bug and consistency with adding gpt-5.1-codex-mini
There was a problem hiding this comment.
Pull request overview
Updates Codex model pricing lookup behavior to use exact model identifiers (no -codex suffix fallback) and expands the pricing table to cover newer Codex model variants.
Changes:
- Add Codex pricing entries for
gpt-5.1-codex,gpt-5.1-codex-mini,gpt-5.1-codex-max, andgpt-5.3-codex. - Remove
-codexsuffix stripping fallback fromnormalizeCodexModelto enforce exact pricing lookups. - Update the normalization test expectation to match the new exact-lookup behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Tests/CodexBarTests/CostUsagePricingTests.swift | Updates Codex model normalization test to stop expecting -codex stripping. |
| Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift | Adds new Codex pricing keys and removes -codex suffix fallback in normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Test | ||
| func normalizesCodexModelVariants() { | ||
| #expect(CostUsagePricing.normalizeCodexModel("openai/gpt-5-codex") == "gpt-5") | ||
| #expect(CostUsagePricing.normalizeCodexModel("gpt-5.2-codex") == "gpt-5.2") | ||
| #expect(CostUsagePricing.normalizeCodexModel("gpt-5.1-codex-max") == "gpt-5.1") | ||
| #expect(CostUsagePricing.normalizeCodexModel("openai/gpt-5-codex") == "gpt-5-codex") | ||
| } |
There was a problem hiding this comment.
The normalizesCodexModelVariants test no longer exercises the key behavior change (that -codex, -codex-max, and -codex-mini are not stripped). Consider adding expectations for inputs like gpt-5.1-codex-max/gpt-5.1-codex-mini (and optionally gpt-5.2-codex) to ensure normalization stays an exact lookup and doesn’t regress back to suffix stripping; alternatively rename the test if it’s only intended to cover the openai/ prefix.
| @@ -41,6 +53,10 @@ enum CostUsagePricing { | |||
| inputCostPerToken: 1.75e-6, | |||
| outputCostPerToken: 1.4e-5, | |||
| cacheReadInputCostPerToken: 1.75e-7), | |||
| "gpt-5.3-codex": CodexPricing( | |||
| inputCostPerToken: 1.75e-6, | |||
| outputCostPerToken: 1.4e-5, | |||
| cacheReadInputCostPerToken: 1.75e-7), | |||
There was a problem hiding this comment.
New Codex pricing keys were added (gpt-5.1-codex, gpt-5.1-codex-mini, gpt-5.1-codex-max, gpt-5.3-codex), but current tests only assert non-nil cost for gpt-5.1-codex-max. Add/extend tests to cover the new keys (especially gpt-5.1-codex-mini and gpt-5.3-codex) so a future typo in the dictionary key or normalization behavior doesn’t silently make lookups return nil.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fa7c65e64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Add pricing for gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.3-codex - Fix gpt-5.1-codex-mini/max pricing (values were swapped) - Remove -codex suffix fallback in normalizeCodexModel to ensure exact pricing lookups - Bump cost-usage cache schema to v2 to invalidate stale normalized keys Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex should be good now? |
|
To use Codex here, create an environment for this repo. |
|
Holding off on this PR as the official API costs for gpt-5.3-codex are not revealed by OpenAI yet. |