Skip to content

fix(cost): add dated model ID for Claude Sonnet 4.6#5591

Merged
H2Shami merged 1 commit intomainfrom
fix/sonnet-4.6-dated-model-pricing
Feb 20, 2026
Merged

fix(cost): add dated model ID for Claude Sonnet 4.6#5591
H2Shami merged 1 commit intomainfrom
fix/sonnet-4.6-dated-model-pricing

Conversation

@colegottdank
Copy link
Collaborator

Summary

  • Fixes $0 cost calculations for Claude Sonnet 4.6

Problem

PR #5579 added pricing for claude-sonnet-4-6 but the Anthropic API returns the dated version claude-sonnet-4-6-20260217. The cost lookup uses exact string matching, so it failed to find the model.

Changes

  • Added claude-sonnet-4-6-20260217 to legacy cost lookup
  • Added dated version to unified models mapping

Testing

All cost tests pass.

Priority

HIGH - Blocking customer from going live (ref: Arpit's Slack message)

🤖 Generated with Claude Code

PR #5579 added `claude-sonnet-4-6` but the Anthropic API returns
the dated version `claude-sonnet-4-6-20260217`. This caused $0 cost
calculations since the exact string match failed.

Adds the dated model ID to both the legacy cost lookup and unified
models mapping.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
helicone Ready Ready Preview, Comment Feb 19, 2026 10:08pm
helicone-eu Ready Ready Preview, Comment Feb 19, 2026 10:08pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
helicone-bifrost Skipped Skipped Feb 19, 2026 10:08pm

Request Review

@supabase
Copy link

supabase bot commented Feb 19, 2026

This pull request has been ignored for the connected project bolqqmqbrciybnypvklh because there are no changes detected in supbase/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@supabase
Copy link

supabase bot commented Feb 19, 2026

This pull request has been ignored for the connected project lmahfbbnchpworytrrqk because there are no changes detected in .supabase/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@claude
Copy link
Contributor

claude bot commented Feb 19, 2026

Claude finished @colegottdank's task —— View job


PR Review Complete ✅

Score: 8/10 - Good to merge, with minor suggestions for improvement

Analysis

This PR fixes a critical issue where Claude Sonnet 4.6 cost calculations were failing because the Anthropic API returns the dated version claude-sonnet-4-6-20260217 but the cost lookup only had claude-sonnet-4-6. The fix correctly adds the dated model ID to both the legacy cost system and unified model mapping.

Code Quality Review

✅ Strengths:

  • Correct Fix: Addresses the exact problem described - API returning dated model ID while costs only defined for base model ID
  • Consistent Implementation: Properly adds the dated model to both cost lookup systems
  • Identical Cost Structure: Uses exact same pricing as the base model, which is appropriate since it's the same model
  • Good Code Style: Follows existing patterns and formatting conventions
  • Proper Documentation: Includes clear inline comments for cost values

⚠️ Areas for Improvement:

  1. Missing Test Coverage: While the PR mentions "All cost tests pass", there don't appear to be specific tests for the dated model ID. Consider adding tests to ensure both claude-sonnet-4-6 and claude-sonnet-4-6-20260217 return the same costs.

  2. Future Maintenance: This pattern suggests a potential need for a more systematic approach to handling dated model IDs. Consider whether a mapping or alias system could reduce duplication.

Technical Correctness

  • ✅ Cost Values: Identical to base model - correct for same underlying model
  • ✅ Model Mapping: Properly added to Anthropic provider with correct model string
  • ✅ Structure Consistency: Follows existing patterns for model definitions
  • ✅ No Breaking Changes: Additive changes only, maintains backward compatibility

Security & Performance

  • ✅ No Security Issues: Changes are configuration-only with no executable code
  • ✅ Performance Impact: Minimal - just additional lookup entries

Suggestions for Improvement

  1. Add Unit Tests (packages/cost/__tests__/):

    describe('claude-sonnet-4-6 pricing', () => {
      it('should return same cost for base and dated model IDs', () => {
        // Test both claude-sonnet-4-6 and claude-sonnet-4-6-20260217
      });
    });
  2. Consider Abstraction: For future dated models, consider implementing an alias system to reduce duplication while maintaining explicit control.

Summary

This is a well-implemented fix for a high-priority customer blocking issue. The changes are minimal, correct, and follow established patterns. The fix directly addresses the stated problem without introducing any risks or breaking changes.


@H2Shami H2Shami merged commit b9158ae into main Feb 20, 2026
14 checks passed
@H2Shami H2Shami deleted the fix/sonnet-4.6-dated-model-pricing branch February 20, 2026 23:08
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.

2 participants