Skip to content

Commit 681289b

Browse files
WqyJhmxdlzg
authored andcommitted
feat: support gpt-4o (songquanpeng#1431)
1 parent b32ee78 commit 681289b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

relay/adaptor/openai/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var ModelList = []string{
77
"gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-0125-preview",
88
"gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613",
99
"gpt-4-turbo-preview", "gpt-4-turbo", "gpt-4-turbo-2024-04-09",
10+
"gpt-4o", "gpt-4o-2024-05-13",
1011
"gpt-4-vision-preview",
1112
"text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large",
1213
"text-curie-001", "text-babbage-001", "text-ada-001", "text-davinci-002", "text-davinci-003",

relay/billing/ratio/model.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ var ModelRatio = map[string]float64{
3232
"gpt-4-turbo-preview": 5, // $0.01 / 1K tokens
3333
"gpt-4-turbo": 5, // $0.01 / 1K tokens
3434
"gpt-4-turbo-2024-04-09": 5, // $0.01 / 1K tokens
35+
"gpt-4o": 2.5, // $0.005 / 1K tokens
36+
"gpt-4o-2024-05-13": 2.5, // $0.005 / 1K tokens
3537
"gpt-4-vision-preview": 5, // $0.01 / 1K tokens
3638
"gpt-3.5-turbo": 0.25, // $0.0005 / 1K tokens
3739
"gpt-3.5-turbo-0301": 0.75,
@@ -280,7 +282,9 @@ func GetCompletionRatio(name string) float64 {
280282
return 4.0 / 3.0
281283
}
282284
if strings.HasPrefix(name, "gpt-4") {
283-
if strings.HasPrefix(name, "gpt-4-turbo") || strings.HasSuffix(name, "preview") {
285+
if strings.HasPrefix(name, "gpt-4-turbo") ||
286+
strings.HasPrefix(name, "gpt-4o") ||
287+
strings.HasSuffix(name, "preview") {
284288
return 3
285289
}
286290
return 2

0 commit comments

Comments
 (0)