Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64f7628

Browse files
committed
add model conversion
1 parent 1e3408c commit 64f7628

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/server/middleware/anthropic-proxy.middleware.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ function transformRequestBody(body: any) {
5959

6060
const transformedBody: any = { ...body }
6161

62+
// Rename the model
63+
if (transformedBody.model) {
64+
if (transformedBody.model.includes('gpt-4')) {
65+
transformedBody.model = 'claude-3-5-sonnet-20240620'
66+
} else if (transformedBody.model.includes('gpt-3')) {
67+
transformedBody.model = 'claude-3-haiku-20240307'
68+
}
69+
}
70+
6271
// Convert OpenAI format to Anthropic format
6372
if (transformedBody.messages) {
6473
let systemMessage = null;

0 commit comments

Comments
 (0)