Based on QuantumNous/new-api v1.0.0-rc.36 (shallow history squashed). - CNY quota display mode: RMB-denominated top-up and crediting across Epay/Waffo channels - New CheckinButton in both authenticated and public headers (Turnstile supported) - New /subscribe page with public plan snapshot, Alipay/balance payment, auto group upgrade/reset - New /docs 12-section beginner guide with anchor navigation - New home PromoBanner linking to /docs; i18n synced (en/zh/zh-TW/fr/ja/ru/vi) - README: document custom features, live demo https://ai.88531.cn
61 lines
2.6 KiB
Go
61 lines
2.6 KiB
Go
package common
|
|
|
|
import "github.com/QuantumNous/new-api/constant"
|
|
|
|
// GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点)
|
|
func GetEndpointTypesByChannelType(channelType int, modelName string) []constant.EndpointType {
|
|
var endpointTypes []constant.EndpointType
|
|
switch channelType {
|
|
case constant.ChannelTypeJina:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeJinaRerank}
|
|
//case constant.ChannelTypeMidjourney, constant.ChannelTypeMidjourneyPlus:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeMidjourney}
|
|
//case constant.ChannelTypeSunoAPI:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeSuno}
|
|
//case constant.ChannelTypeKling:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeKling}
|
|
//case constant.ChannelTypeJimeng:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeJimeng}
|
|
case constant.ChannelTypeAws:
|
|
fallthrough
|
|
case constant.ChannelTypeAnthropic:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeAnthropic, constant.EndpointTypeOpenAI}
|
|
case constant.ChannelTypeVertexAi:
|
|
fallthrough
|
|
case constant.ChannelTypeGemini:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeGemini, constant.EndpointTypeOpenAI}
|
|
case constant.ChannelTypeOpenRouter: // OpenRouter 只支持 OpenAI 端点
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
|
case constant.ChannelTypeXai:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI, constant.EndpointTypeOpenAIResponse}
|
|
case constant.ChannelTypeSora:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAIVideo}
|
|
case constant.ChannelTypeSub2API, constant.ChannelTypeNewAPI:
|
|
endpointTypes = []constant.EndpointType{
|
|
constant.EndpointTypeOpenAI,
|
|
constant.EndpointTypeOpenAIResponse,
|
|
constant.EndpointTypeOpenAIResponseCompact,
|
|
constant.EndpointTypeAnthropic,
|
|
constant.EndpointTypeGemini,
|
|
constant.EndpointTypeOpenAIAlphaSearch,
|
|
}
|
|
case constant.ChannelTypeCodex:
|
|
endpointTypes = []constant.EndpointType{
|
|
constant.EndpointTypeOpenAIResponse,
|
|
constant.EndpointTypeOpenAIResponseCompact,
|
|
constant.EndpointTypeOpenAIAlphaSearch,
|
|
}
|
|
default:
|
|
if IsOpenAIResponseOnlyModel(modelName) {
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAIResponse}
|
|
} else {
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
|
}
|
|
}
|
|
if IsImageGenerationModel(modelName) {
|
|
// add to first
|
|
endpointTypes = append([]constant.EndpointType{constant.EndpointTypeImageGeneration}, endpointTypes...)
|
|
}
|
|
return endpointTypes
|
|
}
|