Claude Code 2.1.x uses hyphenated model names (e.g. claude-sonnet-4-6) for its internal display mapping, but the GitHub Copilot backend only accepts dot notation (e.g. claude-sonnet-4.6).
The current translateModelName truncates claude-sonnet-4-6 to claude-sonnet-4, which causes:
GitHub Copilot backend rejects the request with HTTP 400
Claude Code welcome screen shows "Sonnet 4" instead of "Sonnet 4.6"
Root Cause
// Before — incorrect truncationif(model.startsWith("claude-sonnet-4-")){returnmodel.replace(/^claude-sonnet-4-.*/,"claude-sonnet-4")// ❌ drops minor version}
claude-sonnet-4-6 → claude-sonnet-4 → rejected by Copilot backend
Fix
Replace with a regex that correctly converts hyphenated minor version to dot notation:
// After — correct conversionconstm=model.match(/^(claude-(?:sonnet|opus|haiku))-(\d+)-(\d+)$/)if(m)return`${m[1]}-${m[2]}.${m[3]}`
Input
Output
Result
claude-sonnet-4-6
claude-sonnet-4.6
✅ HTTP 200
claude-opus-4-7
claude-opus-4.7
✅ HTTP 200
claude-haiku-4-5
claude-haiku-4.5
✅ HTTP 200
claude-sonnet-4.6
claude-sonnet-4.6
✅ passthrough (unchanged)
Future models (e.g. claude-sonnet-5-0) are automatically handled without any code changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Claude Code 2.1.x uses hyphenated model names (e.g. claude-sonnet-4-6) for its internal display mapping, but the GitHub Copilot backend only accepts dot notation (e.g. claude-sonnet-4.6).
The current translateModelName truncates claude-sonnet-4-6 to claude-sonnet-4, which causes:
Root Cause
claude-sonnet-4-6 → claude-sonnet-4 → rejected by Copilot backend
Fix
Replace with a regex that correctly converts hyphenated minor version to dot notation:
Future models (e.g. claude-sonnet-5-0) are automatically handled without any code changes.