Repository navigation
fix(blackbox-pricing): add claude-*-f2 failover aliases to notional Anthropic providers - #38
Conversation
…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.
🔎 Lint report:
|
|
| 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"]
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.
…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.
…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.
Problem
The
-f2failover lane (claude-api-proxy-f2/claude-bridge-f2, Sub#3 on theclaude-usw-f2VPS) was missing fromNOTIONAL_ANTHROPIC_PROVIDERS— only the bare and-f1variants were listed. Every turn routed through f2 resolved tobilling_mode='unknown'→cost_usd=$0, so/costwas blind to a large slice of real Opus spend.Impact (audit 2026-06-13, Apollo profile, 5 days)
/cost— token counts were captured fine; only dollar attribution dropped out.Fix
claude-api-proxy-f2+claude-bridge-f2toNOTIONAL_ANTHROPIC_PROVIDERS(parity with-f1).estimatedat 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.