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
5c1386af
authored
Apr 10, 2025
by
HynoR
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add xai grok-3-mini reasoning effort
parent
4622c17c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
relay/channel/xai/adaptor.go
+19
-0
relay/channel/xai/constants.go
+9
-2
No files found.
relay/channel/xai/adaptor.go
View file @
5c1386af
...
...
@@ -10,6 +10,7 @@ import (
"one-api/relay/channel"
"one-api/relay/channel/openai"
relaycommon
"one-api/relay/common"
"strings"
)
type
Adaptor
struct
{
...
...
@@ -49,6 +50,24 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
return
nil
,
errors
.
New
(
"request is nil"
)
}
request
.
StreamOptions
=
nil
if
strings
.
HasPrefix
(
request
.
Model
,
"grok-3-mini"
)
{
if
request
.
MaxCompletionTokens
==
0
&&
request
.
MaxTokens
!=
0
{
request
.
MaxCompletionTokens
=
request
.
MaxTokens
request
.
MaxTokens
=
0
}
if
strings
.
HasSuffix
(
request
.
Model
,
"-high"
)
{
request
.
ReasoningEffort
=
"high"
request
.
Model
=
strings
.
TrimSuffix
(
request
.
Model
,
"-high"
)
}
else
if
strings
.
HasSuffix
(
request
.
Model
,
"-low"
)
{
request
.
ReasoningEffort
=
"low"
request
.
Model
=
strings
.
TrimSuffix
(
request
.
Model
,
"-low"
)
}
else
if
strings
.
HasSuffix
(
request
.
Model
,
"-medium"
)
{
request
.
ReasoningEffort
=
"medium"
request
.
Model
=
strings
.
TrimSuffix
(
request
.
Model
,
"-medium"
)
}
info
.
ReasoningEffort
=
request
.
ReasoningEffort
info
.
UpstreamModelName
=
request
.
Model
}
return
request
,
nil
}
...
...
relay/channel/xai/constants.go
View file @
5c1386af
package
xai
var
ModelList
=
[]
string
{
// grok-2,grok-2-vision,grok-3-mini-beta,grok-3-beta
"grok-3-beta"
,
"grok-3-mini-beta"
,
"grok-2"
,
"grok-2-vision"
,
"grok-3"
,
"grok-beta"
,
"grok-vision-beta"
,
// grok-3
"grok-3-beta"
,
"grok-3-mini-beta"
,
// grok-3 mini
"grok-3-fast-beta"
,
"grok-3-mini-fast-beta"
,
// extend grok-3-mini reasoning
"grok-3-mini-beta-high"
,
"grok-3-mini-beta-low"
,
"grok-3-mini-beta-medium"
,
"grok-3-mini-fast-beta-high"
,
"grok-3-mini-fast-beta-low"
,
"grok-3-mini-fast-beta-medium"
,
"grok-2"
,
"grok-2-vision"
,
"grok-beta"
,
"grok-vision-beta"
,
}
var
ChannelName
=
"xai"
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