File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,13 @@ import { mapOpenAIStopReasonToAnthropic } from "./utils"
2626
2727// Payload translation
2828
29+
30+
2931export function translateToOpenAI (
3032 payload : AnthropicMessagesPayload ,
3133) : ChatCompletionsPayload {
3234 return {
33- model : payload . model ,
35+ model : translateModelName ( payload . model ) ,
3436 messages : translateAnthropicMessagesToOpenAI (
3537 payload . messages ,
3638 payload . system ,
@@ -46,6 +48,16 @@ export function translateToOpenAI(
4648 }
4749}
4850
51+ function translateModelName ( model : string ) : string {
52+ // Subagent requests use a specific model number which Copilot doesn't support
53+ if ( model . startsWith ( "claude-sonnet-4-" ) ) {
54+ return model . replace ( / ^ c l a u d e - s o n n e t - 4 - .* / , "claude-sonnet-4" )
55+ } else if ( model . startsWith ( "claude-opus-" ) ) {
56+ return model . replace ( / ^ c l a u d e - o p u s - 4 - .* / , "claude-opus-4" )
57+ }
58+ return model
59+ }
60+
4961function translateAnthropicMessagesToOpenAI (
5062 anthropicMessages : Array < AnthropicMessage > ,
5163 system : string | Array < AnthropicTextBlock > | undefined ,
You can’t perform that action at this time.
0 commit comments