From 22f4c2e2703e8653e255b31e55ddc0b824fdb18c Mon Sep 17 00:00:00 2001 From: Dayuan Jiang <34411969+DayuanJiang@users.noreply.github.com> Date: Fri, 9 Jan 2026 13:21:34 +0900 Subject: [PATCH] fix: update SiliconFlow default endpoint to .cn (#543) SiliconFlow is transitioning from .com to .cn domain. The .cn endpoint uses Global Traffic Manager (GTM) for better global access, while .com is being phased out. --- app/api/validate-model/route.ts | 2 +- lib/ai-providers.ts | 4 ++-- lib/types/model-config.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/validate-model/route.ts b/app/api/validate-model/route.ts index 79e9369..b8b258e 100644 --- a/app/api/validate-model/route.ts +++ b/app/api/validate-model/route.ts @@ -202,7 +202,7 @@ export async function POST(req: Request) { case "siliconflow": { const sf = createOpenAI({ apiKey, - baseURL: baseUrl || "https://api.siliconflow.com/v1", + baseURL: baseUrl || "https://api.siliconflow.cn/v1", }) model = sf.chat(modelId) break diff --git a/lib/ai-providers.ts b/lib/ai-providers.ts index 3513159..806493d 100644 --- a/lib/ai-providers.ts +++ b/lib/ai-providers.ts @@ -464,7 +464,7 @@ function validateProviderCredentials(provider: ProviderName): void { * - DEEPSEEK_API_KEY: DeepSeek API key * - DEEPSEEK_BASE_URL: DeepSeek endpoint (optional) * - SILICONFLOW_API_KEY: SiliconFlow API key - * - SILICONFLOW_BASE_URL: SiliconFlow endpoint (optional, defaults to https://api.siliconflow.com/v1) + * - SILICONFLOW_BASE_URL: SiliconFlow endpoint (optional, defaults to https://api.siliconflow.cn/v1) * - SGLANG_API_KEY: SGLang API key * - SGLANG_BASE_URL: SGLang endpoint (optional) * - MODELSCOPE_API_KEY: ModelScope API key @@ -721,7 +721,7 @@ export function getAIModel(overrides?: ClientOverrides): ModelConfig { const baseURL = overrides?.baseUrl || process.env.SILICONFLOW_BASE_URL || - "https://api.siliconflow.com/v1" + "https://api.siliconflow.cn/v1" const siliconflowProvider = createOpenAI({ apiKey, baseURL, diff --git a/lib/types/model-config.ts b/lib/types/model-config.ts index 1699953..9e38368 100644 --- a/lib/types/model-config.ts +++ b/lib/types/model-config.ts @@ -80,7 +80,7 @@ export const PROVIDER_INFO: Record< deepseek: { label: "DeepSeek" }, siliconflow: { label: "SiliconFlow", - defaultBaseUrl: "https://api.siliconflow.com/v1", + defaultBaseUrl: "https://api.siliconflow.cn/v1", }, sglang: { label: "SGLang",