mirror of
https://github.com/decolua/9router.git
synced 2026-05-08 12:01:28 +00:00
feat: add built-in Volcengine Ark provider support (#741)
Add Volcengine Ark as a first-class API key provider with official model presets, endpoint configuration, API key validation, model discovery, connection testing, provider logo, and runtime alias mapping for `ark/*` model IDs. Made-with: Cursor Co-authored-by: kingsy <kingsylin@vip.qq.com>
This commit is contained in:
@@ -327,6 +327,19 @@ export const PROVIDER_MODELS = {
|
||||
{ id: "qwen3-coder-plus", name: "Qwen3 Coder Plus" },
|
||||
{ id: "glm-4.7", name: "GLM 4.7" },
|
||||
],
|
||||
"volcengine-ark": [
|
||||
{ id: "Doubao-Seed-2.0-Code", name: "Doubao-Seed-2.0-Code" },
|
||||
{ id: "Doubao-Seed-2.0-pro", name: "Doubao-Seed-2.0-pro" },
|
||||
{ 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: "MiniMax-M2.7", name: "MiniMax-M2.7" },
|
||||
{ id: "Kimi-K2.6", name: "Kimi-K2.6" },
|
||||
{ id: "MiniMax-M2.5", name: "MiniMax-M2.5" },
|
||||
{ id: "Kimi-K2.5", name: "Kimi-K2.5" },
|
||||
{ id: "GLM-4.7", name: "GLM-4.7" },
|
||||
{ id: "DeepSeek-V3.2", name: "DeepSeek-V3.2" },
|
||||
],
|
||||
deepseek: [
|
||||
{ id: "deepseek-chat", name: "DeepSeek V3.2 Chat" },
|
||||
{ id: "deepseek-reasoner", name: "DeepSeek V3.2 Reasoner" },
|
||||
|
||||
@@ -156,6 +156,11 @@ export const PROVIDERS = {
|
||||
format: "openai",
|
||||
headers: {}
|
||||
},
|
||||
"volcengine-ark": {
|
||||
baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",
|
||||
format: "openai",
|
||||
headers: {}
|
||||
},
|
||||
github: {
|
||||
baseUrl: "https://api.githubcopilot.com/chat/completions",
|
||||
responsesUrl: "https://api.githubcopilot.com/responses",
|
||||
|
||||
@@ -49,6 +49,8 @@ const ALIAS_TO_PROVIDER_ID = {
|
||||
nanobanana: "nanobanana",
|
||||
ch: "chutes",
|
||||
chutes: "chutes",
|
||||
ark: "volcengine-ark",
|
||||
"volcengine-ark": "volcengine-ark",
|
||||
cursor: "cursor",
|
||||
vx: "vertex",
|
||||
vertex: "vertex",
|
||||
|
||||
BIN
public/providers/volcengine-ark.png
Normal file
BIN
public/providers/volcengine-ark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@@ -149,6 +149,7 @@ const PROVIDER_MODELS_CONFIG = {
|
||||
authPrefix: "Bearer ",
|
||||
parseResponse: (data) => data.data || []
|
||||
},
|
||||
"volcengine-ark": createOpenAIModelsConfig("https://ark.cn-beijing.volces.com/api/coding/v3/models"),
|
||||
|
||||
// OpenAI-compatible API key providers
|
||||
deepseek: createOpenAIModelsConfig("https://api.deepseek.com/models"),
|
||||
|
||||
@@ -439,6 +439,15 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
|
||||
const valid = res.status !== 401 && res.status !== 403;
|
||||
return { valid, error: valid ? null : "Invalid API key" };
|
||||
}
|
||||
case "volcengine-ark": {
|
||||
const res = await fetchWithConnectionProxy("https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions", {
|
||||
method: "POST",
|
||||
headers: { "Authorization": `Bearer ${connection.apiKey}`, "content-type": "application/json" },
|
||||
body: JSON.stringify({ model: getDefaultModel(connection.provider), max_tokens: 1, messages: [{ role: "user", content: "test" }] }),
|
||||
}, effectiveProxy);
|
||||
const valid = res.status !== 401 && res.status !== 403;
|
||||
return { valid, error: valid ? null : "Invalid API key" };
|
||||
}
|
||||
case "deepseek": {
|
||||
const res = await fetchWithConnectionProxy("https://api.deepseek.com/models", { headers: { Authorization: `Bearer ${connection.apiKey}` } }, effectiveProxy);
|
||||
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
|
||||
|
||||
@@ -151,6 +151,23 @@ export async function POST(request) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "volcengine-ark": {
|
||||
const testModel = getDefaultModel(provider);
|
||||
const res = await fetch("https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Authorization": `Bearer ${apiKey}`,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: testModel,
|
||||
max_tokens: 1,
|
||||
messages: [{ role: "user", content: "test" }],
|
||||
}),
|
||||
});
|
||||
isValid = res.status !== 401 && res.status !== 403;
|
||||
break;
|
||||
}
|
||||
|
||||
case "deepseek":
|
||||
case "groq":
|
||||
|
||||
@@ -56,6 +56,7 @@ export const PROVIDER_ENDPOINTS = {
|
||||
"minimax-cn": "https://api.minimaxi.com/anthropic/v1/messages",
|
||||
alicode: "https://coding.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",
|
||||
openai: "https://api.openai.com/v1/chat/completions",
|
||||
anthropic: "https://api.anthropic.com/v1/messages",
|
||||
gemini: "https://generativelanguage.googleapis.com/v1beta/models",
|
||||
|
||||
@@ -59,6 +59,7 @@ export const APIKEY_PROVIDERS = {
|
||||
"minimax-cn": { id: "minimax-cn", alias: "minimax-cn", name: "Minimax (China)", icon: "memory", color: "#DC2626", textIcon: "MC", website: "https://www.minimaxi.com" },
|
||||
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" },
|
||||
"volcengine-ark": { id: "volcengine-ark", alias: "ark", name: "Volcengine Ark", icon: "cloud", color: "#1677FF", textIcon: "ARK", website: "https://ark.cn-beijing.volces.com" },
|
||||
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"] },
|
||||
"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