diff --git a/relay/adaptor/openai/adaptor.go b/relay/adaptor/openai/adaptor.go index 8faf90a5..b0726c6b 100644 --- a/relay/adaptor/openai/adaptor.go +++ b/relay/adaptor/openai/adaptor.go @@ -16,6 +16,7 @@ import ( "github.com/songquanpeng/one-api/relay/adaptor/geminiv2" "github.com/songquanpeng/one-api/relay/adaptor/minimax" "github.com/songquanpeng/one-api/relay/adaptor/novita" + "github.com/songquanpeng/one-api/relay/adaptor/xunfeiv2" "github.com/songquanpeng/one-api/relay/channeltype" "github.com/songquanpeng/one-api/relay/meta" "github.com/songquanpeng/one-api/relay/model" @@ -62,6 +63,8 @@ func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) { return alibailian.GetRequestURL(meta) case channeltype.GeminiOpenAICompatible: return geminiv2.GetRequestURL(meta) + case channeltype.XunfeiV2: + return xunfeiv2.GetRequestURL(meta) default: return GetFullRequestURL(meta.BaseURL, meta.RequestURLPath, meta.ChannelType), nil } diff --git a/relay/adaptor/xunfeiv2/constants.go b/relay/adaptor/xunfeiv2/constants.go index 08c32646..8e8259d1 100644 --- a/relay/adaptor/xunfeiv2/constants.go +++ b/relay/adaptor/xunfeiv2/constants.go @@ -9,4 +9,5 @@ var ModelList = []string{ "generalv3.5", "max-32k", "4.0Ultra", + "x1", } diff --git a/relay/adaptor/xunfeiv2/main.go b/relay/adaptor/xunfeiv2/main.go new file mode 100644 index 00000000..f1397677 --- /dev/null +++ b/relay/adaptor/xunfeiv2/main.go @@ -0,0 +1,16 @@ +package xunfeiv2 + +import ( + "fmt" + + "github.com/songquanpeng/one-api/relay/meta" +) + +func GetRequestURL(meta *meta.Meta) (string, error) { + switch meta.ActualModelName { + case "x1": + return fmt.Sprintf("%s/v2/chat/completions", meta.BaseURL), nil + default: + } + return fmt.Sprintf("%s/v2/chat/completions", meta.BaseURL), nil +}