mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-23 01:43:42 +08:00
Compare commits
4 Commits
v0.6.6-alp
...
v0.6.6
Author | SHA1 | Date | |
---|---|---|---|
|
91b80ae879 | ||
|
2720e1a358 | ||
|
71f4403fd5 | ||
|
1f76c80553 |
@@ -87,6 +87,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
|
||||
+ [x] [DeepSeek](https://www.deepseek.com/)
|
||||
+ [x] [Cloudflare Workers AI](https://developers.cloudflare.com/workers-ai/)
|
||||
+ [x] [DeepL](https://www.deepl.com/)
|
||||
+ [x] [together.ai](https://www.together.ai/)
|
||||
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
|
||||
3. 支持通过**负载均衡**的方式访问多个渠道。
|
||||
4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。
|
||||
|
@@ -1,7 +1,11 @@
|
||||
package minimax
|
||||
|
||||
// https://www.minimaxi.com/document/guides/chat-model/V2?id=65e0736ab2845de20908e2dd
|
||||
|
||||
var ModelList = []string{
|
||||
"abab5.5s-chat",
|
||||
"abab5.5-chat",
|
||||
"abab6.5-chat",
|
||||
"abab6.5s-chat",
|
||||
"abab6-chat",
|
||||
"abab5.5-chat",
|
||||
"abab5.5s-chat",
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/mistral"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/moonshot"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/stepfun"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/togetherai"
|
||||
"github.com/songquanpeng/one-api/relay/channeltype"
|
||||
)
|
||||
|
||||
@@ -24,6 +25,7 @@ var CompatibleChannels = []int{
|
||||
channeltype.LingYiWanWu,
|
||||
channeltype.StepFun,
|
||||
channeltype.DeepSeek,
|
||||
channeltype.TogetherAI,
|
||||
}
|
||||
|
||||
func GetCompatibleChannelMeta(channelType int) (string, []string) {
|
||||
@@ -48,6 +50,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
|
||||
return "stepfun", stepfun.ModelList
|
||||
case channeltype.DeepSeek:
|
||||
return "deepseek", deepseek.ModelList
|
||||
case channeltype.TogetherAI:
|
||||
return "together.ai", togetherai.ModelList
|
||||
default:
|
||||
return "openai", ModelList
|
||||
}
|
||||
|
10
relay/adaptor/togetherai/constants.go
Normal file
10
relay/adaptor/togetherai/constants.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package togetherai
|
||||
|
||||
// https://docs.together.ai/docs/inference-models
|
||||
|
||||
var ModelList = []string{
|
||||
"meta-llama/Llama-3-70b-chat-hf",
|
||||
"deepseek-ai/deepseek-coder-33b-instruct",
|
||||
"mistralai/Mixtral-8x22B-Instruct-v0.1",
|
||||
"Qwen/Qwen1.5-72B-Chat",
|
||||
}
|
@@ -138,6 +138,8 @@ var ModelRatio = map[string]float64{
|
||||
"Baichuan2-Turbo-192k": 0.016 * RMB,
|
||||
"Baichuan2-53B": 0.02 * RMB,
|
||||
// https://api.minimax.chat/document/price
|
||||
"abab6.5-chat": 0.03 * RMB,
|
||||
"abab6.5s-chat": 0.01 * RMB,
|
||||
"abab6-chat": 0.1 * RMB,
|
||||
"abab5.5-chat": 0.015 * RMB,
|
||||
"abab5.5s-chat": 0.005 * RMB,
|
||||
@@ -169,7 +171,7 @@ var ModelRatio = map[string]float64{
|
||||
"command-light": 0.5,
|
||||
"command-light-nightly": 0.5,
|
||||
"command-r": 0.5 / 1000 * USD,
|
||||
"command-r-plus ": 3.0 / 1000 * USD,
|
||||
"command-r-plus": 3.0 / 1000 * USD,
|
||||
// https://platform.deepseek.com/api-docs/pricing/
|
||||
"deepseek-chat": 1.0 / 1000 * RMB,
|
||||
"deepseek-coder": 1.0 / 1000 * RMB,
|
||||
|
@@ -40,6 +40,7 @@ const (
|
||||
DeepSeek
|
||||
Cloudflare
|
||||
DeepL
|
||||
TogetherAI
|
||||
|
||||
Dummy
|
||||
)
|
||||
|
@@ -40,6 +40,7 @@ var ChannelBaseURLs = []string{
|
||||
"https://api.deepseek.com", // 36
|
||||
"https://api.cloudflare.com", // 37
|
||||
"https://api-free.deepl.com", // 38
|
||||
"https://api.together.xyz", // 39
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@@ -53,6 +53,16 @@ func (e GeneralErrorResponse) ToMessage() string {
|
||||
}
|
||||
|
||||
func RelayErrorHandler(resp *http.Response) (ErrorWithStatusCode *model.ErrorWithStatusCode) {
|
||||
if resp == nil {
|
||||
return &model.ErrorWithStatusCode{
|
||||
StatusCode: 500,
|
||||
Error: model.Error{
|
||||
Message: "resp is nil",
|
||||
Type: "upstream_error",
|
||||
Code: "bad_response",
|
||||
},
|
||||
}
|
||||
}
|
||||
ErrorWithStatusCode = &model.ErrorWithStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Error: model.Error{
|
||||
|
@@ -208,6 +208,9 @@ func getMappedModelName(modelName string, mapping map[string]string) (string, bo
|
||||
|
||||
func isErrorHappened(meta *meta.Meta, resp *http.Response) bool {
|
||||
if resp == nil {
|
||||
if meta.ChannelType == channeltype.AwsClaude {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
|
@@ -143,6 +143,12 @@ export const CHANNEL_OPTIONS = {
|
||||
value: 38,
|
||||
color: 'primary'
|
||||
},
|
||||
39: {
|
||||
key: 39,
|
||||
text: 'together.ai',
|
||||
value: 39,
|
||||
color: 'primary'
|
||||
},
|
||||
8: {
|
||||
key: 8,
|
||||
text: '自定义渠道',
|
||||
|
@@ -24,6 +24,7 @@ export const CHANNEL_OPTIONS = [
|
||||
{key: 36, text: 'DeepSeek', value: 36, color: 'black'},
|
||||
{key: 37, text: 'Cloudflare', value: 37, color: 'orange'},
|
||||
{key: 38, text: 'DeepL', value: 38, color: 'black'},
|
||||
{key: 39, text: 'together.ai', value: 39, color: 'blue'},
|
||||
{key: 8, text: '自定义渠道', value: 8, color: 'pink'},
|
||||
{key: 22, text: '知识库:FastGPT', value: 22, color: 'blue'},
|
||||
{key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple'},
|
||||
|
Reference in New Issue
Block a user