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
5609c7f9
authored
Jan 22, 2026
by
Xyfacai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(qwen): support qwen image sync image model config
parent
979c8198
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
6 deletions
+59
-6
relay/channel/ali/adaptor.go
+9
-6
setting/model_setting/qwen.go
+50
-0
No files found.
relay/channel/ali/adaptor.go
View file @
5609c7f9
...
...
@@ -13,6 +13,7 @@ import (
"github.com/QuantumNous/new-api/relay/channel/openai"
relaycommon
"github.com/QuantumNous/new-api/relay/common"
"github.com/QuantumNous/new-api/relay/constant"
"github.com/QuantumNous/new-api/setting/model_setting"
"github.com/QuantumNous/new-api/service"
"github.com/QuantumNous/new-api/types"
...
...
@@ -23,6 +24,13 @@ type Adaptor struct {
IsSyncImageModel
bool
}
/*
var syncModels = []string{
"z-image",
"qwen-image",
"wan2.6",
}
*/
func
supportsAliAnthropicMessages
(
modelName
string
)
bool
{
// Only models with the "qwen" designation can use the Claude-compatible interface; others require conversion.
return
strings
.
Contains
(
strings
.
ToLower
(
modelName
),
"qwen"
)
...
...
@@ -35,12 +43,7 @@ var syncModels = []string{
}
func
isSyncImageModel
(
modelName
string
)
bool
{
for
_
,
m
:=
range
syncModels
{
if
strings
.
Contains
(
modelName
,
m
)
{
return
true
}
}
return
false
return
model_setting
.
IsSyncImageModel
(
modelName
)
}
func
(
a
*
Adaptor
)
ConvertGeminiRequest
(
*
gin
.
Context
,
*
relaycommon
.
RelayInfo
,
*
dto
.
GeminiChatRequest
)
(
any
,
error
)
{
...
...
setting/model_setting/qwen.go
0 → 100644
View file @
5609c7f9
package
model_setting
import
(
"strings"
"github.com/QuantumNous/new-api/setting/config"
)
// QwenSettings defines Qwen model configuration. 注意bool要以enabled结尾才可以生效编辑
type
QwenSettings
struct
{
SyncImageModels
[]
string
`json:"sync_image_models"`
}
// 默认配置
var
defaultQwenSettings
=
QwenSettings
{
SyncImageModels
:
[]
string
{
"z-image"
,
"qwen-image"
,
"wan2.6"
,
"qwen-image-edit"
,
"qwen-image-edit-max"
,
"qwen-image-edit-max-2026-01-16"
,
"qwen-image-edit-plus"
,
"qwen-image-edit-plus-2025-12-15"
,
"qwen-image-edit-plus-2025-10-30"
,
},
}
// 全局实例
var
qwenSettings
=
defaultQwenSettings
func
init
()
{
// 注册到全局配置管理器
config
.
GlobalConfig
.
Register
(
"qwen"
,
&
qwenSettings
)
}
// GetQwenSettings
func
GetQwenSettings
()
*
QwenSettings
{
return
&
qwenSettings
}
// IsSyncImageModel
func
IsSyncImageModel
(
model
string
)
bool
{
for
_
,
m
:=
range
qwenSettings
.
SyncImageModels
{
if
strings
.
Contains
(
model
,
m
)
{
return
true
}
}
return
false
}
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