@@ -55,6 +55,7 @@ export async function handleCompletion(c: Context) {
5555 await checkRateLimit ( state )
5656
5757 const anthropicPayload = await c . req . json < AnthropicMessagesPayload > ( )
58+ const originalModel = anthropicPayload . model
5859 logger . debug ( "Anthropic request payload:" , JSON . stringify ( anthropicPayload ) )
5960
6061 // fix claude code 2.0.28 warmup request consume premium request, forcing small model if no tools are used
@@ -69,20 +70,21 @@ export async function handleCompletion(c: Context) {
6970 }
7071
7172 if ( useResponsesApi ) {
72- return await handleWithResponsesApi ( c , anthropicPayload )
73+ return await handleWithResponsesApi ( c , anthropicPayload , originalModel )
7374 }
7475
75- return await handleWithChatCompletions ( c , anthropicPayload )
76+ return await handleWithChatCompletions ( c , anthropicPayload , originalModel )
7677}
7778
7879const RESPONSES_ENDPOINT = "/responses"
7980
8081const handleWithChatCompletions = async (
8182 c : Context ,
8283 anthropicPayload : AnthropicMessagesPayload ,
84+ originalModel : string ,
8385) => {
8486 const openAIPayload = translateToOpenAI ( anthropicPayload )
85- consola . info ( `IN ${ anthropicPayload . model } → ${ openAIPayload . model } ` )
87+ consola . info ( `IN ${ originalModel } → ${ openAIPayload . model } ` )
8688 logger . debug (
8789 "Translated OpenAI request payload:" ,
8890 JSON . stringify ( openAIPayload ) ,
@@ -162,10 +164,11 @@ const handleWithChatCompletions = async (
162164const handleWithResponsesApi = async (
163165 c : Context ,
164166 anthropicPayload : AnthropicMessagesPayload ,
167+ originalModel : string ,
165168) => {
166169 const responsesPayload =
167170 translateAnthropicMessagesToResponsesPayload ( anthropicPayload )
168- consola . info ( `IN ${ anthropicPayload . model } → ${ responsesPayload . model } ` )
171+ consola . info ( `IN ${ originalModel } → ${ responsesPayload . model } ` )
169172 logger . debug (
170173 "Translated Responses payload:" ,
171174 JSON . stringify ( responsesPayload ) ,
0 commit comments