Skip to content

fix(blackbox-pricing): add claude-*-f2 failover aliases to notional Anthropic providers - #38

Merged
Kyzcreig merged 2 commits into
mainfrom
fix/blackbox-f2-pricing-aliases
Jun 14, 2026
Merged

Kyzcreig merged 2 commits into
mainfrom
fix/blackbox-f2-pricing-aliases

Conversation

@Kyzcreig

Copy link
Copy Markdown
Collaborator

Problem

The -f2 failover lane (claude-api-proxy-f2 / claude-bridge-f2, Sub#3 on the claude-usw-f2 VPS) was missing from NOTIONAL_ANTHROPIC_PROVIDERS — only the bare and -f1 variants were listed. Every turn routed through f2 resolved to billing_mode='unknown' → cost_usd=$0, so /cost was blind to a large slice of real Opus spend.

Impact (audit 2026-06-13, Apollo profile, 5 days)

  • 582 Claude turns unpriced (~28% of turns on heavy days)
  • ~$4,030 of notional Opus spend invisible to /cost — token counts were captured fine; only dollar attribution dropped out.

Fix

  • Add claude-api-proxy-f2 + claude-bridge-f2 to NOTIONAL_ANTHROPIC_PROVIDERS (parity with -f1).
  • Regression test pins both f2 aliases as notional-Anthropic members → they now price estimated at official Opus rates.

Tests

tests/agent/test_usage_pricing.py — 21 passed (existing suite iterates the frozenset dynamically, so it auto-covers f2; added an explicit membership/pricing guard).

Historical rows are being backfilled separately (DB UPDATE); this fixes all future turns.

…nthropic providers

The -f2 failover lane (claude-api-proxy-f2 / claude-bridge-f2, Sub#3 on the
claude-usw-f2 VPS) was missing from NOTIONAL_ANTHROPIC_PROVIDERS — only bare
and -f1 variants were listed. Every turn routed through f2 resolved to
billing_mode='unknown' -> cost_usd=$0, blinding /cost to ~25% of real Opus
spend (~582 turns / ~$4k notional over 5 days, audit 2026-06-13).

Adds the two f2 aliases (parity with f1) + a regression test pinning them as
notional-Anthropic members so they price 'estimated' at official Opus rates.
@github-actions

github-actions Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

🔎 Lint report: fix/blackbox-f2-pricing-aliases vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9909 on HEAD, 9909 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5123 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@greptile-apps

greptile-apps Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR fixes a billing gap where the -f2 failover lane (claude-api-proxy-f2 / claude-bridge-f2) was missing from NOTIONAL_ANTHROPIC_PROVIDERS, causing ~28 % of fleet turns to resolve as billing_mode='unknown' and price at $0. Adding the two aliases brings the frozenset to full parity with the bare and -f1 entries.

  • agent/usage_pricing.py: claude-api-proxy-f2 and claude-bridge-f2 added to NOTIONAL_ANTHROPIC_PROVIDERS; no other logic touched.
  • tests/agent/test_usage_pricing.py: New explicit regression test for f2 membership and positive pricing; the existing dynamic-iteration test auto-covers the new entries.
  • agent/model_metadata.py: Drive-by addition of context-length entries for claude-fable-5 and claude-mythos-5 (not mentioned in the PR description); no corresponding pricing rows added to _OFFICIAL_DOCS_PRICING.

Confidence Score: 5/5

The f2 alias fix is a one-line-per-entry frozenset addition with a targeted regression test; the core change is minimal and correct.

The fix is a straightforward addition to a frozenset — no branching logic or data-path changes. The existing test suite iterates the frozenset dynamically, so the new entries are automatically exercised. The bundled model_metadata.py context-length entries are additive and don't alter any existing behavior.

The claude-fable-5 / claude-mythos-5 entries in agent/model_metadata.py lack matching rows in _OFFICIAL_DOCS_PRICING; if these slugs are routed through notional providers they will price as $0.

Important Files Changed

Filename Overview
agent/usage_pricing.py Adds claude-api-proxy-f2 and claude-bridge-f2 to NOTIONAL_ANTHROPIC_PROVIDERS; straightforward parity fix with no logic changes.
tests/agent/test_usage_pricing.py Adds targeted regression test for f2 alias membership and non-zero pricing; existing dynamic-iteration test already auto-covers f2 after the frozenset change.
agent/model_metadata.py Bundles in context-length entries for claude-fable-5 and claude-mythos-5 (not mentioned in PR description); no pricing entries added — any turns on notional providers with these slugs will still price as unknown/$0.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Turn arrives with provider] --> B{provider in NOTIONAL_ANTHROPIC_PROVIDERS?}
    B -- "Yes (bare / -f1 / -f2)" --> C["Rewrite to provider='anthropic'\nbilling_mode='official_docs_snapshot'"]
    C --> D["_lookup_official_docs_pricing\nlookup by model slug"]
    D -- "Entry found" --> E["status='estimated'\namount_usd > 0"]
    D -- "No entry (e.g. claude-fable-5)" --> F["status='unknown'\namount_usd=$0 ⚠️"]
    B -- "No (unknown provider)" --> G["billing_mode='unknown'\namount_usd=$0"]
Loading

Reviews (2): Last reviewed commit: "feat(model-metadata): add claude-fable-5..." | Re-trigger Greptile

Coverage for the fable/mythos models flagged unpriced in the blackbox
pricing audit — pairs with the f2 failover-alias fix in this branch.
@Kyzcreig
Kyzcreig merged commit 8453fe5 into main Jun 14, 2026
22 checks passed
Kyzcreig pushed a commit that referenced this pull request Sep 28, 2026
…39, #35 sibling)

- #37 import map is module-level; function-local imports bind only in their function
- #38 sink_dotted honoured when sink_names is None
- #39 a function-local import shadows a same-file def
- offload-call args walked (eager), lambda args still deferred
New precision arms: 4 red on base, 5/5 green. Consumer gates 32/32; the
widened walker surfaced 2 pre-existing telegram get_label->requests.get
reaches (same shape as baselined matrix entry), added to REACHABLE_BASELINE.
Kyzcreig pushed a commit that referenced this pull request Sep 28, 2026
…39, #35 sibling)

- #37 import map is module-level; function-local imports bind only in their function
- #38 sink_dotted honoured when sink_names is None
- #39 a function-local import shadows a same-file def
- offload-call args walked (eager), lambda args still deferred
New precision arms: 4 red on base, 5/5 green. Consumer gates 32/32; the
widened walker surfaced 2 pre-existing telegram get_label->requests.get
reaches (same shape as baselined matrix entry), added to REACHABLE_BASELINE.
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.

1 participant