Price Claude bare model IDs via first-party vendor fallback - #3002
Price Claude bare model IDs via first-party vendor fallback#3002Yuxin-Qiao wants to merge 5 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0b22be9a4
ℹ️ 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".
| "google", | ||
| "moonshot", | ||
| "minimax", | ||
| "deepseek", |
There was a problem hiding this comment.
Include Claude fallback vendors in the Pi pricing key
When a Pi/OMP Claude session uses one of these newly supported bare IDs, PiSessionCostScanner persists the per-message cost and prefers that complete cached cost in buildReport. Its pricing key still fingerprints only the Codex providers plus anthropic (PiSessionCostScanner.swift:255-259), so a rate change under google, moonshot, minimax, or deepseek does not force unchanged session files to be repriced and the displayed spend can remain obsolete indefinitely. Include this fallback vendor set in the pricing fingerprint and cover the invalidation path with a focused Pi scanner test.
AGENTS.md reference: AGENTS.md:L5-L5
Useful? React with 👍 / 👎.
| "deepseek", | ||
| ] | ||
|
|
||
| private static func claudeModelsDevPricingTargets(for rawModel: String) -> [(providerID: String, modelID: String)] { |
There was a problem hiding this comment.
Reuse Claude pricing targets for unknown-model refresh
For a foreground load where the cached catalog is less than 24 hours old but more than 15 minutes old and lacks a bare model that now exists only under one of these first-party vendors, the initial scan is unpriced and unknownPricingRefreshRequest still requests only anthropic/<model>. The refresh downloads the global catalog but then checks availability under anthropic, returns .unavailable, and skips the recursive rescan, so this load remains unpriced despite the newly downloaded vendor rate. Expose and reuse claudeModelsDevPricingTargets in the fetcher, with a focused foreground-refresh test.
AGENTS.md reference: AGENTS.md:L5-L5
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 11:24 AM ET / 15:24 UTC. ClawSweeper reviewWhat this changesThis PR estimates costs for bare Claude transcript model IDs from selected first-party models.dev vendor catalogs, while retaining explicit-route pricing and synchronizing cache and refresh targets. Merge readinessKeep open for maintainer product-direction review. The implementation and real CLI proof are coherent, but the fallback intentionally changes CodexBar’s documented provider-scoped pricing rule for Claude transcripts. Priority: P2 Review scores
Verification
How this fits togetherCodexBar scans local Claude and Pi session transcripts, resolves model prices from models.dev, then exposes estimated spend through its CLI and Usage & Spend views. This change sits between parsed model IDs and the price/cache layer. flowchart LR
A[Local session transcripts] --> B[Claude model identifier]
B --> C{Bare or prefixed route?}
C -->|Bare| D[Selected first-party catalogs]
C -->|Prefixed| E[Explicit route catalog]
D --> F[Cost estimate and cache key]
E --> F
F --> G[CLI and Usage Spend output]
Decision needed
Why: The branch deliberately changes what an existing user’s historical spend estimate means; source cannot establish whether that policy tradeoff is acceptable. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep provider-scoped estimates unless a maintainer explicitly adopts the bare-ID heuristic; if adopted, update the public pricing contract to explain vendor order, estimate limitations, and cache refresh behavior. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is new estimation behavior, and the current-head JSON artifact directly demonstrates bare IDs receiving prices in a local CLI scan. Is this the best way to solve the issue? Unclear: the implementation is internally consistent, but it intentionally replaces the documented provider-scoped contract with a vendor-priority heuristic that needs product approval. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2fe9de487f8a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
After-fix proofLocal Claude Code JSONL on this machine (
That is the transcript shape this PR prices. Focused tests on
Not claimed fixed here: Pi cache fingerprint and unknown-model refresh still Anthropic-only (review P2s). Native Usage & Spend still needs #3001 so a priced Claude row can surface in the group total. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Bare DeepSeek IDs now invalidate Pi pricing caches and trigger models.dev refresh on the same vendor list used for lookup. Co-authored-by: Cursor <cursoragent@cursor.com>
After-fix proof
Prefixed Focused test @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
The pricing-file change left CodexParserHash.generated.swift stale and failed lint. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Lint should be unblocked: regenerated @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…back. Google is now a Claude first-party pricing vendor, so the unrelated-catalog case uses Groq instead. Co-authored-by: Cursor <cursoragent@cursor.com>
…scripts. Document the first-party estimate policy, cover the fetcher/Pi paths, and attach a redacted local cost scan. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Current-head proof (
Policy in Coverage added:
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: Price Claude bare model IDs via first-party vendor fallback This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b66dd62cfb
ℹ️ 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".
| Self.claudeModelsDevProviderID, | ||
| "openai", | ||
| "google", | ||
| "moonshot", |
There was a problem hiding this comment.
Resolve the observed bare Kimi alias
For Claude transcripts whose bare model is kimi-for-coding, this list never queries the separate kimi-for-coding models.dev provider already recognized by codexModelsDevPricingTargets; consequently neither direct lookup nor unknown-model refresh can resolve its vendor pricing. The newly added .github/pr-proof/claude-bare-id-cost.json demonstrates the regression remains: that exact model has 209,202 tokens but costUSD: null. Add the Kimi provider and required model-alias mapping to the shared target/fingerprint logic, with a focused test for this observed transcript value.
Useful? React with 👍 / 👎.
Fix Claude vendor pricing after #3002
|
Thanks @Yuxin-Qiao! This landed via #3012, which carried your commits onto current main and fixed the CI failures (stale parser fingerprint after #2946, shifted gatekeeper anchors, a vendor-collision ordering hazard, and a test shard reading the ambient Codex database). The changelog credits you. Closing as superseded. |
Summary
opencode-go/deepseek-v4-flashstay on that route and never fall through to another vendor's official price.deepseek-v4-flash/kimi-for-codingwithout inventing a $0.Policy
A Claude transcript that records only an unqualified model ID is estimated at that vendor's first-party models.dev list price. Prefixed routes stay on that route. This is not a claim about which bill the session actually hit.
Evidence
Current-head local scan (
CodexBarCLI cost --provider claude --days 365 --format json, source=local, no prompts or keys):MiniMax-M3deepseek-v4-prodeepseek-v4-flashkimi-for-codingstays unpriced (not on the first-party vendor list). Full redacted JSON: https://raw.githubusercontent.com/Yuxin-Qiao/CodexBar/fix/claude-bare-model-first-party-pricing/.github/pr-proof/claude-bare-id-cost.jsonLocal Claude Code JSONL on this machine (
~/.claude/projects, 11 files, no prompts or keys):deepseek-v4-prodeepseek-v4-flashkimi-for-codingMiniMax-M3All of those IDs are bare (no
vendor/prefix). That is the live transcript shape this PR prices.Focused after-fix on
fbe70c3e9(claude cost prices bare first-party model IDs from vendor catalogs):Test plan
make checkmake test(74/74 groups)deepseek-v4-flash/kimi-for-coding/deepseek-v4-proopencode-go/...stays on that route inclaudeCostUSDtestsCodexBarCLI cost --provider claude --days 365prices bare MiniMax-M3 / DeepSeek IDsdeepseek-v4-flash