From 7a9f7412184bd1dab4847f784d17f1d009eadc23 Mon Sep 17 00:00:00 2001 From: Cokky Turnip Date: Mon, 10 Aug 2026 08:29:06 +0700 Subject: [PATCH] fix(providers): add TokenRouter to provider test support --- src/app/api/providers/[id]/test/testUtils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/api/providers/[id]/test/testUtils.js b/src/app/api/providers/[id]/test/testUtils.js index 0ea46b2d14d..b3c3e9a7e7d 100644 --- a/src/app/api/providers/[id]/test/testUtils.js +++ b/src/app/api/providers/[id]/test/testUtils.js @@ -788,6 +788,13 @@ async function testApiKeyConnection(connection, effectiveProxy = null) { ); return { valid: exRes.ok, error: exRes.ok ? null : "Invalid Personal Access Token" }; } + case "tokenrouter": { + const baseUrl = connection.providerSpecificData?.baseUrl || "https://api.tokenrouter.com/v1"; + const res = await fetchWithConnectionProxy(`${baseUrl.replace(/\/$/, "")}/models`, { + headers: { Authorization: `Bearer ${connection.apiKey}` }, + }, effectiveProxy); + return { valid: res.ok, error: res.ok ? null : "Invalid API key or base URL" }; + } default: return { valid: false, error: "Provider test not supported" }; }