Skip to content

Price GPT-6.1 Terra and GPT-6 Luna Fast usage - #5067

Open
jslabxyz wants to merge 2 commits into
steipete:mainfrom
jslabxyz:fix/codex-terra-luna-fast-pricing
Open

jslabxyz wants to merge 2 commits into
steipete:mainfrom
jslabxyz:fix/codex-terra-luna-fast-pricing

Conversation

@jslabxyz

@jslabxyz jslabxyz commented Nov 12, 2026 •

Copy link
Copy Markdown

Native Codex requests marked Fast (service_tier: priority) for GPT-6.1 Terra and GPT-6 Luna currently fall back to Standard API-equivalent pricing. Apply the published 2× Fast rates to both models, including prompts above 272,000 input tokens. Bundle Terra’s Standard rates for offline or incomplete pricing catalogues and regenerate the parser hash so saved estimates can be recalculated.

The store compatibility update recognises the parser hash shipped in v0.84.0. Existing request rows and scan checkpoints survive the upgrade. Cached reports that used stale pricing are invalidated and recalculated.

The Terra and Luna model cards document the Fast and long-context rates. This follows the Sol pricing path from #4814.

Validation: focused Swift tests passed for both models at 272,000 and 272,001 input tokens, with and without catalogue data. Cases include cached reads, cache writes and output tokens. The parser-hash check, SwiftFormat and repository-wide strict SwiftLint passed.

Fast pricing verification

On 12 November 2026, the macOS CodexBarCLI reproduced the pricing bug on the PR base and passed all four Fast cases with the patch. Both the populated catalogue and bundled fallback returned the published prices in the patched build. The CLI bundled in the signed v0.84.0 app matched the PR base in both modes. The same eight synthetic requests were used throughout, with no account credentials or personal session history. CodexBar PR #5067

Model Total input Tier Base USD Patched USD
GPT-6.1 Terra 272,000 Standard 0.1320000 0.1320000
GPT-6.1 Terra 272,000 Fast 0.1320000 0.2640000
GPT-6.1 Terra 272,001 Standard 0.2390020 0.2390020
GPT-6.1 Terra 272,001 Fast 0.2390020 0.4780040
GPT-6 Luna 272,000 Standard 0.0142000 0.0142000
GPT-6 Luna 272,000 Fast 0.0142000 0.0284000
GPT-6 Luna 272,001 Standard 0.0259002 0.0259002
GPT-6 Luna 272,001 Fast 0.0259002 0.0518004

With the populated catalogue, the four Standard controls matched between builds. The API-equivalent subtotal moved from US$0.8222044 to US$1.2333066. With the empty catalogue, base Terra costs were absent and base Luna Fast requests used Standard prices. The known subtotal moved from US$0.0802004 to US$1.2333066, with four unpriced items falling to zero. In both modes each report contained 2,256,004 tokens, four Standard and four Fast requests, established history coverage and zero unmetered items.

The TSV below was extracted from the two sets of real CLI daily model breakdowns. null represents a cost absent from the base CLI output.

date	model	tier	input_tokens	total_tokens	catalogue_base_usd	catalogue_patched_usd	bundled_base_usd	bundled_patched_usd
2026-11-02	gpt-6.1-terra	Standard	272000	282000	0.1320000	0.1320000	null	0.1320000
2026-11-02	gpt-6-luna	Standard	272000	282000	0.0142000	0.0142000	0.0142000	0.0142000
2026-11-03	gpt-6.1-terra	Fast	272000	282000	0.1320000	0.2640000	null	0.2640000
2026-11-03	gpt-6-luna	Fast	272000	282000	0.0142000	0.0284000	0.0142000	0.0284000
2026-11-04	gpt-6.1-terra	Standard	272001	282001	0.2390020	0.2390020	null	0.2390020
2026-11-04	gpt-6-luna	Standard	272001	282001	0.0259002	0.0259002	0.0259002	0.0259002
2026-11-05	gpt-6.1-terra	Fast	272001	282001	0.2390020	0.4780040	null	0.4780040
2026-11-05	gpt-6-luna	Fast	272001	282001	0.0259002	0.0518004	0.0259002	0.0518004

Fixture and commands

Each model had one request per UTC day in a synthetic Codex session. The four days from 2 to 5 November used Standard at 272,000 input, Fast at 272,000 input, Standard at 272,001 input, and Fast at 272,001 input, respectively. Each request had 200,000 cached input tokens and 10,000 output tokens, including 2,000 reasoning tokens. The generated sessions supplied session_meta, thread_settings_applied, task_started, turn_context, and an identified token_usage_record. The tier values were default and priority.

For example, the short Fast case for Terra used the records below in .codex/sessions/2026/11/03/rollout-2026-11-03T12-00-00-gpt-6.1-terra.jsonl. The other fixtures change the model, date, identifiers, input count or tier according to the table. The synthetic config.json contained {"version":1,"providers":[{"id":"codex","enabled":true}]}.

{"type":"session_meta","timestamp":"2026-11-03T12:00:00Z","payload":{"id":"synthetic-2026-11-03-gpt-6.1-terra","timestamp":"2026-11-03T12:00:00Z"}}
{"type":"event_msg","timestamp":"2026-11-03T12:00:00Z","payload":{"type":"thread_settings_applied","thread_settings":{"service_tier":"priority"}}}
{"type":"event_msg","timestamp":"2026-11-03T12:00:00Z","payload":{"type":"task_started","turn_id":"synthetic-turn"}}
{"type":"turn_context","timestamp":"2026-11-03T12:00:00Z","payload":{"model":"gpt-6.1-terra","turn_id":"synthetic-turn"}}
{"type":"token_usage_record","timestamp":"2026-11-03T12:00:00Z","payload":{"thread_id":"synthetic-2026-11-03-gpt-6.1-terra","response_id":"synthetic-response","turn_id":"synthetic-turn","model":"gpt-6.1-terra","usage":{"input_tokens":272000,"cached_input_tokens":200000,"output_tokens":10000,"reasoning_output_tokens":2000,"total_tokens":282000},"thread_token_usage":{"input_tokens":272000,"cached_input_tokens":200000,"output_tokens":10000,"reasoning_output_tokens":2000,"total_tokens":282000},"turn_token_usage":{"input_tokens":272000,"cached_input_tokens":200000,"output_tokens":10000,"reasoning_output_tokens":2000,"total_tokens":282000}}}

The same synthetic catalogue supplied both models’ Standard rates to both binaries. In USD per million tokens, the short-context input, cached input and output rates are $1.00, $0.05 and $5.00 for Terra, and $0.10, $0.01 and $0.50 for Luna. Above 272,000 input tokens, input and cache rates double and output becomes 1.5× for the entire request. Fast doubles the applicable rates. For example, the Terra Fast request at 272,001 input costs 2 × (72,001 × 2 + 200,000 × 0.10 + 10,000 × 7.50) / 1,000,000 = $0.478004. GPT-6.1 Terra model pricing, GPT-6 Luna model pricing

The PR base was 7447bc77c2497323d9c41e40164ce705533493c8. The patched build used commit 056563def749ece9980a7381d537702db17d7eaa with the local cache compatibility follow-up. Both checkouts built with swift build --product CodexBarCLI on Apple Swift 6.4.2 for arm64 macOS. All binaries ran separately against fresh fixture homes with byte-identical session files. The catalogue mode used a fresh models.dev cache artifact populated with the two model rates and their 272,000-token tiers. The bundled mode used a fresh artifact with catalog.providers set to {}. It stayed empty after every CLI run, confirming the data came from the bundled pricing path.

env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin TZ=UTC \
  HOME="$fixture_home" CFFIXED_USER_HOME="$fixture_home" \
  CODEX_HOME="$fixture_home/.codex" \
  CODEXBAR_CONFIG="$fixture_home/config.json" \
  "$binary" cost --provider codex --provider-native-only --period all --refresh --format json

The table values came from the CLI’s daily model breakdown JSON. An independent decimal calculation compared every cost and token total against the fixture inputs and the published rates. The test exercised native log parsing, service-tier attribution, cost calculation and CLI reporting. It did not launch the desktop UI.

Existing store compatibility

A second synthetic test seeded a cache using the signed v0.84.0 CLI and opened it using a Swift harness linked against the patched CodexBarCore. The cache migrated from schema 77274700 to 82965678 with zero rebuilds. All nine file records, nine request rows and one token snapshot survived. The stale report was cleared, and the interrupted scan recovered its exact pending line after the source was made available again. This checks that adopting the new pricing parser does not discard history or checkpoints from the released app.

A separate warm-cache CLI run used the same command without --refresh. After the signed v0.84.0 CLI seeded the store, one Luna Fast source was compressed to .jsonl.zst and the plain source was removed from the scanner's scope. The patched CLI opened the existing database. Its inode and all eight usage-row payloads stayed byte-identical, including the archive-only row. The report repriced US$0.8222044 to US$1.2333066 with the same 2,256,004 tokens.

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T12:01:57.362363Z 056563d PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Apply Fast pricing to Terra and Luna requests, add bundled Terra rates, and preserve released usage stores during repricing.

Example: A Terra Fast request has 272,001 input tokens, including 200,000 cached tokens, and 10,000 output tokens.

  • Before: The API-equivalent estimate is $0.239002.
  • After: The estimate is $0.478004.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful correction with shipped CLI evidence and released-cache preservation coverage.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied macOS CodexBarCLI results exercise native parsing, tier attribution, shared pricing, and JSON reporting for both models across the context threshold with populated and empty catalogs; Standard controls and token totals remain stable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Terra and Luna Fast usage displays Standard-price estimates, and Terra can remain unpriced when catalog data is unavailable.
Reason: The correction follows the established API-equivalent Fast pricing contract without adding settings, changing tier attribution, or creating another pricing path.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current pricing error and resolves the earlier released-store compatibility finding; no actionable defect remains in the reviewed diff.

Priority: P2
Reviewed head: c6c6181cc4b05e3d99374b86ca89c2bd4a335a73

Before merge

None.

Findings

None.

Agent review details

How this fits together

CodexBar parses native Codex session logs into persisted token rows, resolves model and service-tier pricing, and publishes API-equivalent estimates through the CLI and app.

flowchart LR
  A[Codex session logs] --> B[Usage scanner]
  B --> C[SQLite token rows]
  C --> D[Shared pricing resolver]
  E[Catalog and bundled rates] --> D
  D --> F[CLI and app cost reports]
Loading

Technical review

Best possible solution:

Land the focused extension of shared pricing with released-store adoption and stale-total recalculation.

Do we have a high-confidence way to reproduce the issue?

Current main omits both models from the Fast multiplier, causing the shared scanner to retain Standard costs; the contributor also supplies matching base and v0.84.0 CLI results.

Is this the best way to solve the issue?

The patch uses the existing pricing and compatibility owners, preserves catalog precedence, and adds focused coverage for catalog fallback, token thresholds, and released-store adoption.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7447bc77c249.

Provenance checked

  • Fast multiplier and long-context pricing keeps the original intent (279a263: The Sol repair extended the shared API Fast pricing contract to documented long-context rates while retaining older models' cutoff.)
  • Generated parser fingerprint keeps the original intent (c727c08: The revert restored v0.84.0's fingerprint to preserve released cost history; this PR changes pricing and explicitly adopts that released predecessor.)
  • Store adoption and migration coverage keeps the original intent (26fd0bb: SQLite owns derived Codex history and checkpoints; later compatible-predecessor adoption preserves them across parser changes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Verified introduced patch: The pinned diff extends the existing Fast multiplier and long-context allowlist, adds Terra fallback rates, and registers the released parser hash without changing stored row formats. (Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift:686, c6c6181cc4b0)
  • Earlier compatibility finding resolved: The follow-up accepts v0.84.0's ad011f05e9ab733a parser hash. Existing adoption logic preserves rows and checkpoints and clears its stale previousReportPayload; both migration tests now include this released predecessor. (Sources/CodexBarCore/Vendored/CostUsage/CostUsageStore.swift:125, c6c6181cc4b0)
  • Shipped CLI and released-store evidence: The full PR body supplies macOS CodexBarCLI output for both models at 272,000 and 272,001 input tokens, Standard controls, populated and empty catalogs, and a v0.84.0 warm-cache upgrade retaining all eight usage-row payloads while repricing $0.8222044 to $1.2333066. Separate store evidence records nine preserved files and request rows, one snapshot, zero rebuilds, and successful checkpoint recovery. Captured body sourceRevision: 39d6ca0280b325a4a31c5d8828e69b31dbdda87959b6a161aaaead830a5cbe67. (c6c6181cc4b0)
  • Official pricing contract: Official OpenAI documentation confirms Terra's $1/$0.05/$5 and Luna's $0.10/$0.01/$0.50 Standard input/cached-input/output rates per million tokens, doubled Fast rates, and full-request long-context adjustments above 272K: Terra model card, Luna model card.
  • Established product intent and feature history: The maintainer-authored Define Codex Fast cost as API Fast USD #2632 defines Fast USD using public API rates after shared Standard pricing. The merged Fix GPT-6.1 Sol Fast cost accounting #4814 establishes the same long-context repair and history-preserving repricing path for Sol; its maintainer closing comment confirms that contract. History was searched across CostUsagePricing.swift and its former CCUsageMinPricing.swift name. (Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift:683, 405a2a467867)
  • Validation scope: The exact head has a successful GitGuardian Security Checks run. Focused Swift tests, parser-hash validation, formatting, and strict lint are contributor-reported; no build or test was run during this read-only review. (Tests/CodexBarTests/CostUsageTerraLunaFastPricingTests.swift:5, c6c6181cc4b0)

Likely related people:

  • Peter Steinberger: Raw commit 405a2a4 adds Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift:583 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 405a2a467867; files: Sources/CodexBarCore/Vendored/CostUsage/CostUsagePricing.swift)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: Incorrect API-equivalent estimates affect two models' Fast requests without blocking usage collection or application operation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-12T12:13:21.965Z sha 056563d :: needs real behavior proof before merge. :: [P1] Preserve released stores when changing the parser hash

Reviewed November 12, 2026, 7:37 AM ET / 12:37 UTC (Revision 2).

@jslabxyz

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant