Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4131304c
authored
Feb 01, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add support for o3-mini models in model ratio and request handling
parent
4470ef97
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
common/model-ratio.go
+3
-1
relay/channel/openai/adaptor.go
+2
-2
relay/channel/openai/constant.go
+1
-0
No files found.
common/model-ratio.go
View file @
4131304c
...
...
@@ -56,6 +56,8 @@ var defaultModelRatio = map[string]float64{
"o1-preview-2024-09-12"
:
7.5
,
"o1-mini"
:
1.5
,
"o1-mini-2024-09-12"
:
1.5
,
"o3-mini"
:
0.55
,
"o3-mini-2025-01-31"
:
0.55
,
"gpt-4o-mini"
:
0.075
,
"gpt-4o-mini-2024-07-18"
:
0.075
,
"gpt-4-turbo"
:
5
,
// $0.01 / 1K tokens
...
...
@@ -366,7 +368,7 @@ func GetCompletionRatio(name string) float64 {
}
return
2
}
if
strings
.
HasPrefix
(
name
,
"o1"
)
{
if
strings
.
HasPrefix
(
name
,
"o1"
)
||
strings
.
HasPrefix
(
name
,
"o3"
)
{
return
4
}
if
name
==
"chatgpt-4o-latest"
{
...
...
relay/channel/openai/adaptor.go
View file @
4131304c
...
...
@@ -109,13 +109,13 @@ func (a *Adaptor) ConvertRequest(c *gin.Context, info *relaycommon.RelayInfo, re
if
info
.
ChannelType
!=
common
.
ChannelTypeOpenAI
&&
info
.
ChannelType
!=
common
.
ChannelTypeAzure
{
request
.
StreamOptions
=
nil
}
if
strings
.
HasPrefix
(
request
.
Model
,
"o1"
)
{
if
strings
.
HasPrefix
(
request
.
Model
,
"o1"
)
||
strings
.
HasPrefix
(
request
.
Model
,
"o3"
)
{
if
request
.
MaxCompletionTokens
==
0
&&
request
.
MaxTokens
!=
0
{
request
.
MaxCompletionTokens
=
request
.
MaxTokens
request
.
MaxTokens
=
0
}
}
if
request
.
Model
==
"o1"
||
request
.
Model
==
"o1-2024-12-17"
{
if
request
.
Model
==
"o1"
||
request
.
Model
==
"o1-2024-12-17"
||
strings
.
HasPrefix
(
request
.
Model
,
"o3"
)
{
//修改第一个Message的内容,将system改为developer
if
len
(
request
.
Messages
)
>
0
&&
request
.
Messages
[
0
]
.
Role
==
"system"
{
request
.
Messages
[
0
]
.
Role
=
"developer"
...
...
relay/channel/openai/constant.go
View file @
4131304c
...
...
@@ -13,6 +13,7 @@ var ModelList = []string{
"gpt-4o-mini"
,
"gpt-4o-mini-2024-07-18"
,
"o1-preview"
,
"o1-preview-2024-09-12"
,
"o1-mini"
,
"o1-mini-2024-09-12"
,
"o3-mini"
,
"o3-mini-2025-01-31"
,
"o1"
,
"o1-2024-12-17"
,
"gpt-4o-audio-preview"
,
"gpt-4o-audio-preview-2024-10-01"
,
"gpt-4o-realtime-preview"
,
"gpt-4o-realtime-preview-2024-10-01"
,
"gpt-4o-realtime-preview-2024-12-17"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment