From 7adf0a61fe6360d4b6cde356f093fa5a39f83e16 Mon Sep 17 00:00:00 2001 From: HynoR <20227709+HynoR@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:58:28 +0800 Subject: [PATCH] feat: support new model gpt-4o-2024-08-06 --- relay/adaptor/openai/constants.go | 1 + relay/billing/ratio/model.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/relay/adaptor/openai/constants.go b/relay/adaptor/openai/constants.go index 156a50e7..9885ce68 100644 --- a/relay/adaptor/openai/constants.go +++ b/relay/adaptor/openai/constants.go @@ -8,6 +8,7 @@ var ModelList = []string{ "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613", "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-mini", "gpt-4o-mini-2024-07-18", "gpt-4-vision-preview", "text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large", diff --git a/relay/billing/ratio/model.go b/relay/billing/ratio/model.go index 7bc6cd54..1ee37e8b 100644 --- a/relay/billing/ratio/model.go +++ b/relay/billing/ratio/model.go @@ -35,6 +35,7 @@ var ModelRatio = map[string]float64{ "gpt-4-turbo-2024-04-09": 5, // $0.01 / 1K tokens "gpt-4o": 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-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 @@ -313,7 +314,7 @@ 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") { + if strings.HasPrefix(name, "gpt-4o-mini") || name == "gpt-4o-2024-08-06" { return 4 } if strings.HasPrefix(name, "gpt-4-turbo") ||