From a858292b54175debf66fa8497b6cebe82cb8e865 Mon Sep 17 00:00:00 2001 From: Qiying Wang <781345688@qq.com> Date: Sun, 22 Dec 2024 19:49:50 +0800 Subject: [PATCH] feat: support gpt-4o-2024-11-20 (#1941) --- relay/adaptor/openai/constants.go | 1 + relay/billing/ratio/model.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/relay/adaptor/openai/constants.go b/relay/adaptor/openai/constants.go index be4804c259..8a643bc6ad 100644 --- a/relay/adaptor/openai/constants.go +++ b/relay/adaptor/openai/constants.go @@ -9,6 +9,7 @@ var ModelList = []string{ "gpt-4-turbo-preview", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4o", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", + "gpt-4o-2024-11-20", "chatgpt-4o-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", "gpt-4-vision-preview", diff --git a/relay/billing/ratio/model.go b/relay/billing/ratio/model.go index 8fa708f021..f83aa70c11 100644 --- a/relay/billing/ratio/model.go +++ b/relay/billing/ratio/model.go @@ -37,6 +37,7 @@ var ModelRatio = map[string]float64{ "chatgpt-4o-latest": 2.5, // $0.005 / 1K tokens "gpt-4o-2024-05-13": 2.5, // $0.005 / 1K tokens "gpt-4o-2024-08-06": 1.25, // $0.0025 / 1K tokens + "gpt-4o-2024-11-20": 1.25, // $0.0025 / 1K tokens "gpt-4o-mini": 0.075, // $0.00015 / 1K tokens "gpt-4o-mini-2024-07-18": 0.075, // $0.00015 / 1K tokens "gpt-4-vision-preview": 5, // $0.01 / 1K tokens @@ -453,11 +454,13 @@ func GetCompletionRatio(name string, channelType int) float64 { return 4.0 / 3.0 } if strings.HasPrefix(name, "gpt-4") { - if strings.HasPrefix(name, "gpt-4o-mini") || name == "gpt-4o-2024-08-06" { + if strings.HasPrefix(name, "gpt-4o") { + if name == "gpt-4o-2024-05-13" { + return 3 + } return 4 } if strings.HasPrefix(name, "gpt-4-turbo") || - strings.HasPrefix(name, "gpt-4o") || strings.HasSuffix(name, "preview") { return 3 }