- Added BytePlus Provider
This commit is contained in:
parent
0b8bed5793
commit
14ff69bf90
9 changed files with 29 additions and 6 deletions
|
|
@ -150,6 +150,7 @@ const PROVIDER_MODELS_CONFIG = {
|
|||
parseResponse: (data) => data.data || []
|
||||
},
|
||||
"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
|
||||
deepseek: createOpenAIModelsConfig("https://api.deepseek.com/models"),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { getProviderConnectionById, updateProviderConnection } from "@/lib/local
|
|||
import { resolveConnectionProxyConfig } from "@/lib/network/connectionProxy";
|
||||
import { testProxyUrl } from "@/lib/network/proxyTest";
|
||||
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider } from "@/shared/constants/providers";
|
||||
import { PROVIDER_ENDPOINTS } from "@/shared/constants/config";
|
||||
import { getDefaultModel } from "open-sse/config/providerModels.js";
|
||||
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
|
||||
import {
|
||||
|
|
@ -454,8 +455,9 @@ 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", {
|
||||
case "volcengine-ark":
|
||||
case "byteplus": {
|
||||
const res = await fetchWithConnectionProxy(PROVIDER_ENDPOINTS[connection.provider], {
|
||||
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" }] }),
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { getProviderNodeById } from "@/models";
|
|||
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider, isCustomEmbeddingProvider } from "@/shared/constants/providers";
|
||||
import { getDefaultModel } from "open-sse/config/providerModels.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
|
||||
export async function POST(request) {
|
||||
|
|
@ -211,16 +212,16 @@ 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", {
|
||||
case "volcengine-ark":
|
||||
case "byteplus": {
|
||||
const res = await fetch(PROVIDER_ENDPOINTS[provider], {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Authorization": `Bearer ${apiKey}`,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: testModel,
|
||||
model: getDefaultModel(provider),
|
||||
max_tokens: 1,
|
||||
messages: [{ role: "user", content: "test" }],
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue