Price provider-qualified Codex models - #2946
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 2:06 AM ET / 06:06 UTC. ClawSweeper reviewWhat this changesThe PR resolves provider-qualified Codex model names through matching models.dev providers, refreshes missing qualified prices, invalidates affected local estimate caches, and adds regression coverage. Merge readinessKeep open for normal maintainer review. The branch safely prices allowlisted provider-qualified routes, preserves unknown routes as unpriced, refreshes through the same mapping, and includes sufficient redacted CLI proof; current main still has the OpenAI-only lookup. Priority: P2 Review scores
Verification
How this fits togetherCodexBar scans local Codex session records and converts model token counts into local cost estimates using a cached models.dev catalog. Those estimates feed the CLI and dashboard history without representing provider account billing. flowchart LR
A[Local Codex sessions] --> B[Usage scanner]
B --> C[Qualified model resolver]
C --> D[models.dev catalog]
D --> E[Local cost estimates]
E --> F[CLI and dashboard history]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the allowlisted provider-qualified lookup with its shared refresh and cache invalidation behavior, while retaining unrecognized route prefixes as unpriced. Do we have a high-confidence way to reproduce the issue? Yes. Current main's OpenAI-only resolver leaves a supported qualified-route model unpriced; the PR supplies a redacted isolated CLI transcript and focused fixtures for that path. Is this the best way to solve the issue? Yes. The shared allowlisted target mapping keeps direct lookup and unknown-price refresh consistent, without cross-charging unknown providers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b9ccac302b28. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
…n-zero history, Antigravity dashboard lanes, Claude OAuth revoked detection steipete#2946 Codex routed models pricing — codex_routed_provider() + strip_route_prefix() in cost_pricing.rs; deepseek/, kimi/, opencode/ routes price against matching models.dev provider; unknown provider/ prefixes return None. steipete#2944 Codex auth.json read-only during refresh — codex_external_oauth_sources_allowed setting (default OFF); is_external_oauth + last_refresh fields on CodexCredentials; enforce_external_oauth_gate (8-day staleness window). steipete#2932 Codex known-zero history — known_zero field on CostSummary; set in both cache-debounce and full-scan paths (history_coverage_established && sessions_count == 0); knownZero JSON field + CLI text update. steipete#2963 Antigravity dashboard lanes — quota-bucket dedup in parse_user_status; models sharing the same (remaining_fraction, reset_time) collapse to one lane. steipete#2516 Claude revoked vs missing OAuth — ProviderError::OAuthRevoked variant; revocation detection (401/403 with revoked/invalid_grant/token_revoked); 15-min CLI result cache (LazyLock<Mutex<Option<CachedCliResult>>>); fetch_via_auto returns cached CLI result when OAuth revoked, and stale cache when all live sources fail.
…n-zero history, Antigravity dashboard lanes, Claude OAuth revoked detection steipete#2946 Codex routed models pricing — codex_routed_provider() + strip_route_prefix() in cost_pricing.rs; deepseek/, kimi/, opencode/ routes price against matching models.dev provider; unknown provider/ prefixes return None. steipete#2944 Codex auth.json read-only during refresh — codex_external_oauth_sources_allowed setting (default OFF); is_external_oauth + last_refresh fields on CodexCredentials; enforce_external_oauth_gate (8-day staleness window). steipete#2932 Codex known-zero history — known_zero field on CostSummary; set in both cache-debounce and full-scan paths (history_coverage_established && sessions_count == 0); knownZero JSON field + CLI text update. steipete#2963 Antigravity dashboard lanes — quota-bucket dedup in parse_user_status; models sharing the same (remaining_fraction, reset_time) collapse to one lane. steipete#2516 Claude revoked vs missing OAuth — ProviderError::OAuthRevoked variant; revocation detection (401/403 with revoked/invalid_grant/token_revoked); 15-min CLI result cache (LazyLock<Mutex<Option<CachedCliResult>>>); fetch_via_auto returns cached CLI result when OAuth revoked, and stale cache when all live sources fail.
* Port upstream 0.50.1: Cursor rename + Ollama cookie stripping (steipete#2951, steipete#2949) * Port upstream 0.50.1: OpenCode Go session+weekly pace in CLI (steipete#2957) * Port upstream 0.50.1: chart axis label centering (steipete#2974) * Port upstream 0.50.1: Kiro re-authenticate via kiro-cli login (steipete#2340) * Port upstream 0.50.1: serve identity follows app redaction per-request (steipete#2960) * Port upstream 0.50.1: Codex routed pricing, auth.json read-only, known-zero history, Antigravity dashboard lanes, Claude OAuth revoked detection steipete#2946 Codex routed models pricing — codex_routed_provider() + strip_route_prefix() in cost_pricing.rs; deepseek/, kimi/, opencode/ routes price against matching models.dev provider; unknown provider/ prefixes return None. steipete#2944 Codex auth.json read-only during refresh — codex_external_oauth_sources_allowed setting (default OFF); is_external_oauth + last_refresh fields on CodexCredentials; enforce_external_oauth_gate (8-day staleness window). steipete#2932 Codex known-zero history — known_zero field on CostSummary; set in both cache-debounce and full-scan paths (history_coverage_established && sessions_count == 0); knownZero JSON field + CLI text update. steipete#2963 Antigravity dashboard lanes — quota-bucket dedup in parse_user_status; models sharing the same (remaining_fraction, reset_time) collapse to one lane. steipete#2516 Claude revoked vs missing OAuth — ProviderError::OAuthRevoked variant; revocation detection (401/403 with revoked/invalid_grant/token_revoked); 15-min CLI result cache (LazyLock<Mutex<Option<CachedCliResult>>>); fetch_via_auto returns cached CLI result when OAuth revoked, and stale cache when all live sources fail. * Port upstream 0.50.1: Mistral PAYG spend, cost-summary display style, per-provider accent color Item 1 — Mistral PAYG current-month API spend (steipete#2821, steipete#2947): - Add MonthlyPlan variant to MetricPreference enum - Add currency_symbol field to CostSnapshot with with_currency_symbol builder - Set currency_symbol from Mistral billing API response - Add MonthlyPlan to bridge label/parse, tray selected_metric_percent (None = no bar) - Show formatted cost amount in provider_status_label for MonthlyPlan - Add format_cost_amount helper in bridge.rs - Add Mistral monthly spend row in MenuCardDetails - Add monthlyPlan option to MenuBarMetricSection for Mistral Item 2 — Menu cost-summary display style per provider (steipete#2976): - Add CostSummaryDisplayStyle enum (Compact/Detailed/Hidden) in types.rs - Add cost_summary_display_style field to Settings + Default + RawSettings round-trip - Add to SettingsSnapshot bridge + SettingsUpdate + apply in Tauri commands - Add bridge label/parse functions - Apply in MenuCardDetails: hidden hides cost section, compact shows used/limit only - Update describeCard to filter hasCost for hidden style - Add Select control in UsageSpendTab Item 3 — Per-provider accent color override (steipete#2972): - Add accent_color field to ProviderConfig - Add brand_color(ProviderId) function in provider.rs (mirrors frontend registry) - Add accent_color/set_accent_color/effective_accent_color accessors in Settings - Add set/get/get_effective Tauri commands + normalize_hex_accent_color validator - Add providerAccentColors map to SettingsSnapshot bridge - Add setProviderAccentColor/getProviderAccentColor/getProviderEffectiveAccentColor to tauri.ts - Create AccentColorSection component (hex input, color picker, reset button) - Inject --provider-accent CSS variable on MenuCard article and ChartsSection - Update menu-metric__bar-fill and chart colors to use --provider-accent fallback - Update chartPalette providerCostColor/providerCreditsColor fallback chain - Pass providerAccentColors through TrayPanel/PopOutPanel/ProvidersTab/ProviderDetailPane Also: - Add 11 new locale keys to all 7 .ftl files + keys.ts - Add costSummaryDisplayStyle + providerAccentColors to all test mock SettingsSnapshot - Update chartPalette tests for --provider-accent fallback * Resolve merge conflicts and fix gate checks * Thermo-nuclear: extract ollama cookies, codex pricing, simplify accent color * fix: correct serde attribute placement on currency_symbol after rebase
Summary
models.devprovider, including OpenCodex route aliasesWhy
OpenCodex records routed models such as
opencode-go/deepseek-v4-flash,opencode-free/deepseek-v4-flash-free,kimi-coding/k3, anddeepseek/deepseek-v4-flash. CodexBar's Codex cost resolver previously queried only theopenaiprovider inmodels.dev, so these rows stayed unpriced and the dashboard treated the partially priced history as unavailable.This change only fixes local estimate attribution through the existing models.dev catalog. It does not import OpenCodex's usage ledger or present provider estimates as account billing, avoiding duplicate counting and preserving the existing ownership boundary.
Validation
make checkmake test(862 selections, 72 groups; all passed)swift test --filter CostUsagePricingTestsswift test --filter ProviderArchitectureGatekeeperTestsAfter-fix local runtime evidence (2026-08-15)
Ran the built CLI against an isolated temporary
CODEX_HOMEcontaining two redacted local Codex JSONL sessions; no account files, cookies, or bearer tokens were present. The--refreshrun fetched the public models.dev catalog and scanned the local records:This is after-fix local runtime evidence: the supported OpenCodex-qualified route is repriced after the on-demand catalog refresh, while an unknown route remains unpriced instead of inheriting an unrelated OpenAI rate. The output contains no credentials.
CI classification (2026-08-16)
d4232410af8fce36fd2c2c1f4921b4363f0ac08bhas green Linux, lint, and change-detection jobs.lint-build-testfailure is the repository's Draft-policy gate reporting that macOS Swift tests are deferred; it is not a pricing or parser failure.