Skip to content

Add new OpenAI model pricing and remove -codex suffix stripping#358

Open
xiaoqianWX wants to merge 1 commit intosteipete:mainfrom
xiaoqianWX:main
Open

Add new OpenAI model pricing and remove -codex suffix stripping#358
xiaoqianWX wants to merge 1 commit intosteipete:mainfrom
xiaoqianWX:main

Conversation

@xiaoqianWX
Copy link

  • 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

Copilot AI review requested due to automatic review settings February 12, 2026 03:41
Copy link

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

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, and gpt-5.3-codex.
  • Remove -codex suffix stripping fallback from normalizeCodexModel to 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.

Comment on lines 6 to 9
@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")
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines 36 to 59
@@ -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),
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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>
@xiaoqianWX
Copy link
Author

@codex should be good now?

@chatgpt-codex-connector
Copy link

To use Codex here, create an environment for this repo.

@ratulsarna
Copy link
Collaborator

Holding off on this PR as the official API costs for gpt-5.3-codex are not revealed by OpenAI yet.

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