Skip to content

fix: normalize Claude model name variants (opus-4.7, sonnet-4.5, etc.)#244

Open
halton wants to merge 1 commit intoericc-ch:masterfrom
halton:fix_opus_4.7_on_ericc-ch
Open

fix: normalize Claude model name variants (opus-4.7, sonnet-4.5, etc.)#244
halton wants to merge 1 commit intoericc-ch:masterfrom
halton:fix_opus_4.7_on_ericc-ch

Conversation

@halton
Copy link
Copy Markdown

@halton halton commented Apr 18, 2026

Summary

  • Fix translateModelName() to properly normalize versioned Claude model names instead of stripping the minor version
  • The previous regex collapsed claude-opus-4-7-20250514claude-opus-4, losing the .7 minor version and causing "The requested model is not supported" errors for Opus 4.7 (1M context)
  • Now correctly handles all variants using regex matching:
    • claude-opus-4-7-20250514claude-opus-4.7
    • claude-opus-4.7-20250514claude-opus-4.7
    • claude-sonnet-4-5-20250514claude-sonnet-4.5
    • claude-opus-4-7claude-opus-4.7
    • claude-sonnet-4 → passes through unchanged

Test plan

  • Verified Opus 4.7 (1M context) model works after fix — no more "model not supported" error
  • Verified requests return 200 after applying the fix

🤖 Generated with Claude Code

Claude Code sends versioned model names like "claude-opus-4-7-20250514"
which the previous regex collapsed to "claude-opus-4", losing the minor
version. This caused "model not supported" errors for Opus 4.7.

Now properly normalizes all variants:
- claude-opus-4-7-20250514 → claude-opus-4.7
- claude-opus-4.7-20250514 → claude-opus-4.7
- claude-sonnet-4-5-20250514 → claude-sonnet-4.5
- claude-opus-4-7 → claude-opus-4.7

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
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