Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support new openai models (4o 0806, chatgpt-4o-latest) #1721

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions relay/adaptor/openai/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ 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",
"chatgpt-4o-latest",
"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",
Expand Down
7 changes: 6 additions & 1 deletion relay/billing/ratio/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"gpt-4-turbo": 5, // $0.01 / 1K tokens
"gpt-4-turbo-2024-04-09": 5, // $0.01 / 1K tokens
"gpt-4o": 2.5, // $0.005 / 1K tokens
"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-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
Expand Down Expand Up @@ -313,7 +315,7 @@
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" {

Check warning on line 318 in relay/billing/ratio/model.go

View check run for this annotation

Codecov / codecov/patch

relay/billing/ratio/model.go#L318

Added line #L318 was not covered by tests
return 4
}
if strings.HasPrefix(name, "gpt-4-turbo") ||
Expand All @@ -323,6 +325,9 @@
}
return 2
}
if name == "chatgpt-4o-latest" {
return 3

Check warning on line 329 in relay/billing/ratio/model.go

View check run for this annotation

Codecov / codecov/patch

relay/billing/ratio/model.go#L328-L329

Added lines #L328 - L329 were not covered by tests
}
if strings.HasPrefix(name, "claude-3") {
return 5
}
Expand Down
Loading