Skip to content

feat(anthropic): add Claude 5 family pricing & align current rates#1767

Merged
chopratejas merged 1 commit into
headroomlabs-ai:mainfrom
KennethWKZ:feat/anthropic-pricing
Jul 3, 2026
Merged

feat(anthropic): add Claude 5 family pricing & align current rates#1767
chopratejas merged 1 commit into
headroomlabs-ai:mainfrom
KennethWKZ:feat/anthropic-pricing

Conversation

@KennethWKZ

Copy link
Copy Markdown
Contributor

Summary

Adds Claude 5 generation metadata and aligns the Anthropic fallback pricing / context-limit tables in headroom/providers/anthropic.py with current Anthropic pricing (verified 2026-07-04). Several Claude 4.x entries carried stale rates, the new Claude 5 models (Fable 5, Opus 4.8, Sonnet 5) had no metadata, and the generic fallback tests disagreed with the provider tests.

Supersedes #1485 (rebased onto latest main, squashed to one commit, extended with Sonnet 5 / Fable 5 and the requested fallback-test fixes).

Changes

All values $ / MTok; cached_input = prompt-cache read = 0.1× input.

Tier Model Before After Context
Fable claude-fable-5 (new) $10 / $50 / $1.00 1M
Opus claude-opus-4-8 (new) $5 / $25 / $0.50 1M
Opus claude-opus-4-7 $15 / $75 / $1.50 $5 / $25 / $0.50 1M
Opus claude-opus-4-6 $15 / $75 / $1.50 $5 / $25 / $0.50 1M
Opus claude-opus-4-5-20251101 $15 / $75 / $1.50 $5 / $25 / $0.50 200K
Sonnet claude-sonnet-5 (new) $3 / $15 / $0.30 1M
Sonnet claude-sonnet-4-6 (new) $3 / $15 / $0.30 1M
Sonnet claude-sonnet-4-5 (new) $3 / $15 / $0.30 200K
Haiku claude-haiku-4-5-20251001 $0.80 / $4 / $0.08 (3.5 rates) $1 / $5 / $0.10 200K

claude-sonnet-4-20250514 and all Claude 3.x / 3.5.x entries were already correct — left unchanged.

The 1M-context entries (Fable 5, Opus 4.8, Sonnet 5, Sonnet 4.6) are functional, not cosmetic: they ship in the long-context tier, and without explicit entries the sonnet / opus pattern defaults would report 200K.

Sonnet 5 is pinned to the standard Sonnet tier ($3 / $15 / $0.30); Anthropic's introductory rate ($2 / $10 through Aug 31 2026) is intentionally not encoded to avoid a time-dependent fixture.

Fallback-model tests (addresses review on #1485)

_PATTERN_DEFAULTS["opus"] is aligned to the current Opus tier ($5 / $25 / $0.50) so the generic fallback suite and the provider-specific suite agree:

  • test_pricing_for_known_models — Opus 4.5 pins $5 / $25 / $0.50
  • test_pattern_based_inference_opus — unknown-opus fallback now $5 / $25
  • test_cost_estimation_for_new_models — fixture estimate corrected $22.5 → $7.5
  • test_pattern_based_inference_sonnet — retargeted to claude-sonnet-6-* (the old claude-sonnet-5-* probe now prefix-matches the real claude-sonnet-5 key)

New provider coverage:

  • test_get_context_limit_claude_5_family — Fable 5 / Opus 4.8 / Sonnet 5 all 1M
  • test_pricing_claude_5_family — exact rate table for the 3 new models

Full suite: 48 passed.

Source

https://platform.claude.com/docs/en/about-claude/pricing

Add metadata for the Claude 5 generation and correct the Claude 4.x /
Haiku 4.5 rates to Anthropic's current published pricing
(platform.claude.com/docs/en/about-claude/pricing, 2026-07-04):

- claude-fable-5: 1M context, $10 in / $50 out / $1 cache-read
- claude-opus-4-8: 1M context, $5 in / $25 out / $0.50 cache-read
- claude-sonnet-5: 1M context, $3 in / $15 out / $0.30 cache-read
- Opus 4.5-4.8 aligned to the current Opus tier ($5/$25/$0.50)
- Sonnet 4.5/4.6 pinned to the Sonnet tier ($3/$15/$0.30)
- Haiku 4.5 corrected to $1/$5/$0.10
- opus pattern-default fallback aligned to the current Opus tier

Update the provider and fallback-model tests to pin the new values so
the provider-specific and generic fallback suites agree (addresses CI
red on stale $15/$75 Opus assertions and the $22.5 estimate fixture).
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

PR governance

This PR does not yet satisfy the required template fields:

  • Missing required section Description.
  • Missing required section Type of Change.
  • Missing required section Changes Made.
  • Missing required section Testing.
  • Missing required section Real Behavior Proof.
  • Missing required section Review Readiness.
  • Check I have performed a self-review before requesting human review.
  • Check This PR is ready for human review or convert the PR back to draft.

Please update the PR body, or move the PR back to draft while it is still in progress.

@github-actions github-actions Bot added the status: needs author action Pull request body or readiness checklist still needs author updates label Jul 3, 2026
@chopratejas chopratejas merged commit e84ca98 into headroomlabs-ai:main Jul 3, 2026
29 checks passed
@KennethWKZ KennethWKZ deleted the feat/anthropic-pricing branch July 3, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs author action Pull request body or readiness checklist still needs author updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants