mirror of
https://github.com/decolua/9router.git
synced 2026-05-08 12:01:28 +00:00
- Added BytePlus Provider
This commit is contained in:
@@ -344,6 +344,16 @@ export const PROVIDER_MODELS = {
|
|||||||
{ id: "GLM-4.7", name: "GLM-4.7" },
|
{ id: "GLM-4.7", name: "GLM-4.7" },
|
||||||
{ id: "DeepSeek-V3.2", name: "DeepSeek-V3.2" },
|
{ id: "DeepSeek-V3.2", name: "DeepSeek-V3.2" },
|
||||||
],
|
],
|
||||||
|
byteplus: [
|
||||||
|
{ id: "doubao-seed-2.0-pro", name: "Doubao Seed 2.0 Pro" },
|
||||||
|
{ id: "doubao-seed-2.0-code", name: "Doubao Seed 2.0 Code" },
|
||||||
|
{ id: "doubao-seed-2.0-lite", name: "Doubao Seed 2.0 Lite" },
|
||||||
|
{ id: "doubao-seed-code", name: "Doubao Seed Code" },
|
||||||
|
{ id: "glm-5.1", name: "GLM-5.1" },
|
||||||
|
{ id: "glm-4.7", name: "GLM-4.7" },
|
||||||
|
{ id: "kimi-k2.5", name: "Kimi-K2.5" },
|
||||||
|
{ id: "gpt-oss-120b", name: "GPT-OSS-120B" },
|
||||||
|
],
|
||||||
deepseek: [
|
deepseek: [
|
||||||
{ id: "deepseek-v4-flash", name: "DeepSeek V4 Flash" },
|
{ id: "deepseek-v4-flash", name: "DeepSeek V4 Flash" },
|
||||||
{ id: "deepseek-chat", name: "DeepSeek V3.2 Chat" },
|
{ id: "deepseek-chat", name: "DeepSeek V3.2 Chat" },
|
||||||
|
|||||||
@@ -161,6 +161,11 @@ export const PROVIDERS = {
|
|||||||
format: "openai",
|
format: "openai",
|
||||||
headers: {}
|
headers: {}
|
||||||
},
|
},
|
||||||
|
byteplus: {
|
||||||
|
baseUrl: "https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",
|
||||||
|
format: "openai",
|
||||||
|
headers: {}
|
||||||
|
},
|
||||||
github: {
|
github: {
|
||||||
baseUrl: "https://api.githubcopilot.com/chat/completions",
|
baseUrl: "https://api.githubcopilot.com/chat/completions",
|
||||||
responsesUrl: "https://api.githubcopilot.com/responses",
|
responsesUrl: "https://api.githubcopilot.com/responses",
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ const ALIAS_TO_PROVIDER_ID = {
|
|||||||
chutes: "chutes",
|
chutes: "chutes",
|
||||||
ark: "volcengine-ark",
|
ark: "volcengine-ark",
|
||||||
"volcengine-ark": "volcengine-ark",
|
"volcengine-ark": "volcengine-ark",
|
||||||
|
byteplus: "byteplus",
|
||||||
|
bpm: "byteplus",
|
||||||
cursor: "cursor",
|
cursor: "cursor",
|
||||||
vx: "vertex",
|
vx: "vertex",
|
||||||
vertex: "vertex",
|
vertex: "vertex",
|
||||||
|
|||||||
BIN
public/providers/byteplus.png
Executable file
BIN
public/providers/byteplus.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
@@ -150,6 +150,7 @@ const PROVIDER_MODELS_CONFIG = {
|
|||||||
parseResponse: (data) => data.data || []
|
parseResponse: (data) => data.data || []
|
||||||
},
|
},
|
||||||
"volcengine-ark": createOpenAIModelsConfig("https://ark.cn-beijing.volces.com/api/coding/v3/models"),
|
"volcengine-ark": createOpenAIModelsConfig("https://ark.cn-beijing.volces.com/api/coding/v3/models"),
|
||||||
|
byteplus: createOpenAIModelsConfig("https://ark.ap-southeast.bytepluses.com/api/coding/v3/models"),
|
||||||
|
|
||||||
// OpenAI-compatible API key providers
|
// OpenAI-compatible API key providers
|
||||||
deepseek: createOpenAIModelsConfig("https://api.deepseek.com/models"),
|
deepseek: createOpenAIModelsConfig("https://api.deepseek.com/models"),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { getProviderConnectionById, updateProviderConnection } from "@/lib/local
|
|||||||
import { resolveConnectionProxyConfig } from "@/lib/network/connectionProxy";
|
import { resolveConnectionProxyConfig } from "@/lib/network/connectionProxy";
|
||||||
import { testProxyUrl } from "@/lib/network/proxyTest";
|
import { testProxyUrl } from "@/lib/network/proxyTest";
|
||||||
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider } from "@/shared/constants/providers";
|
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider } from "@/shared/constants/providers";
|
||||||
|
import { PROVIDER_ENDPOINTS } from "@/shared/constants/config";
|
||||||
import { getDefaultModel } from "open-sse/config/providerModels.js";
|
import { getDefaultModel } from "open-sse/config/providerModels.js";
|
||||||
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
|
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
|
||||||
import {
|
import {
|
||||||
@@ -454,8 +455,9 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
|
|||||||
const valid = res.status !== 401 && res.status !== 403;
|
const valid = res.status !== 401 && res.status !== 403;
|
||||||
return { valid, error: valid ? null : "Invalid API key" };
|
return { valid, error: valid ? null : "Invalid API key" };
|
||||||
}
|
}
|
||||||
case "volcengine-ark": {
|
case "volcengine-ark":
|
||||||
const res = await fetchWithConnectionProxy("https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions", {
|
case "byteplus": {
|
||||||
|
const res = await fetchWithConnectionProxy(PROVIDER_ENDPOINTS[connection.provider], {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Authorization": `Bearer ${connection.apiKey}`, "content-type": "application/json" },
|
headers: { "Authorization": `Bearer ${connection.apiKey}`, "content-type": "application/json" },
|
||||||
body: JSON.stringify({ model: getDefaultModel(connection.provider), max_tokens: 1, messages: [{ role: "user", content: "test" }] }),
|
body: JSON.stringify({ model: getDefaultModel(connection.provider), max_tokens: 1, messages: [{ role: "user", content: "test" }] }),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { getProviderNodeById } from "@/models";
|
|||||||
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider, isCustomEmbeddingProvider } from "@/shared/constants/providers";
|
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider, isCustomEmbeddingProvider } from "@/shared/constants/providers";
|
||||||
import { getDefaultModel } from "open-sse/config/providerModels.js";
|
import { getDefaultModel } from "open-sse/config/providerModels.js";
|
||||||
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
|
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
|
||||||
|
import { PROVIDER_ENDPOINTS } from "@/shared/constants/config";
|
||||||
|
|
||||||
// POST /api/providers/validate - Validate API key with provider
|
// POST /api/providers/validate - Validate API key with provider
|
||||||
export async function POST(request) {
|
export async function POST(request) {
|
||||||
@@ -211,16 +212,16 @@ export async function POST(request) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "volcengine-ark": {
|
case "volcengine-ark":
|
||||||
const testModel = getDefaultModel(provider);
|
case "byteplus": {
|
||||||
const res = await fetch("https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions", {
|
const res = await fetch(PROVIDER_ENDPOINTS[provider], {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${apiKey}`,
|
"Authorization": `Bearer ${apiKey}`,
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: testModel,
|
model: getDefaultModel(provider),
|
||||||
max_tokens: 1,
|
max_tokens: 1,
|
||||||
messages: [{ role: "user", content: "test" }],
|
messages: [{ role: "user", content: "test" }],
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export const PROVIDER_ENDPOINTS = {
|
|||||||
alicode: "https://coding.dashscope.aliyuncs.com/v1/chat/completions",
|
alicode: "https://coding.dashscope.aliyuncs.com/v1/chat/completions",
|
||||||
"alicode-intl": "https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions",
|
"alicode-intl": "https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions",
|
||||||
"volcengine-ark": "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",
|
"volcengine-ark": "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",
|
||||||
|
byteplus: "https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",
|
||||||
openai: "https://api.openai.com/v1/chat/completions",
|
openai: "https://api.openai.com/v1/chat/completions",
|
||||||
anthropic: "https://api.anthropic.com/v1/messages",
|
anthropic: "https://api.anthropic.com/v1/messages",
|
||||||
gemini: "https://generativelanguage.googleapis.com/v1beta/models",
|
gemini: "https://generativelanguage.googleapis.com/v1beta/models",
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export const APIKEY_PROVIDERS = {
|
|||||||
alicode: { id: "alicode", alias: "alicode", name: "Alibaba", icon: "cloud", color: "#FF6A00", textIcon: "ALi" },
|
alicode: { id: "alicode", alias: "alicode", name: "Alibaba", icon: "cloud", color: "#FF6A00", textIcon: "ALi" },
|
||||||
"alicode-intl": { id: "alicode-intl", alias: "alicode-intl", name: "Alibaba Intl", icon: "cloud", color: "#FF6A00", textIcon: "ALi" },
|
"alicode-intl": { id: "alicode-intl", alias: "alicode-intl", name: "Alibaba Intl", icon: "cloud", color: "#FF6A00", textIcon: "ALi" },
|
||||||
"volcengine-ark": { id: "volcengine-ark", alias: "ark", name: "Volcengine Ark", icon: "cloud", color: "#1677FF", textIcon: "ARK", website: "https://ark.cn-beijing.volces.com" },
|
"volcengine-ark": { id: "volcengine-ark", alias: "ark", name: "Volcengine Ark", icon: "cloud", color: "#1677FF", textIcon: "ARK", website: "https://ark.cn-beijing.volces.com" },
|
||||||
|
byteplus: { id: "byteplus", alias: "bpm", name: "BytePlus ModelArk", icon: "cloud", color: "#2563EB", textIcon: "BP", website: "https://console.byteplus.com/ark", serviceKinds: ["llm"] },
|
||||||
openai: { id: "openai", alias: "openai", name: "OpenAI", icon: "auto_awesome", color: "#10A37F", textIcon: "OA", website: "https://platform.openai.com", serviceKinds: ["llm", "embedding", "tts", "image", "imageToText", "webSearch"], thinkingConfig: THINKING_CONFIG.effort },
|
openai: { id: "openai", alias: "openai", name: "OpenAI", icon: "auto_awesome", color: "#10A37F", textIcon: "OA", website: "https://platform.openai.com", serviceKinds: ["llm", "embedding", "tts", "image", "imageToText", "webSearch"], thinkingConfig: THINKING_CONFIG.effort },
|
||||||
anthropic: { id: "anthropic", alias: "anthropic", name: "Anthropic", icon: "smart_toy", color: "#D97757", textIcon: "AN", website: "https://console.anthropic.com", serviceKinds: ["llm", "imageToText"] },
|
anthropic: { id: "anthropic", alias: "anthropic", name: "Anthropic", icon: "smart_toy", color: "#D97757", textIcon: "AN", website: "https://console.anthropic.com", serviceKinds: ["llm", "imageToText"] },
|
||||||
"opencode-go": { id: "opencode-go", alias: "ocg", name: "OpenCode Go", icon: "terminal", color: "#E87040", textIcon: "OC", website: "https://opencode.ai/auth", notice: { text: "OpenCode Go subscription: $5/mo (then $10/mo). Access to Kimi, GLM, Qwen, MiMo, MiniMax models.", apiKeyUrl: "https://opencode.ai/auth" } },
|
"opencode-go": { id: "opencode-go", alias: "ocg", name: "OpenCode Go", icon: "terminal", color: "#E87040", textIcon: "OC", website: "https://opencode.ai/auth", notice: { text: "OpenCode Go subscription: $5/mo (then $10/mo). Access to Kimi, GLM, Qwen, MiMo, MiniMax models.", apiKeyUrl: "https://opencode.ai/auth" } },
|
||||||
|
|||||||
Reference in New Issue
Block a user