feat(providers): add Kimchi API key support (dual OAuth + API key)

Kimchi's transport is OpenAI-compatible (Authorization: Bearer) but the
registry declared it OAuth-only, so the dashboard, /api/providers, and
the connection test all rejected API keys. Enable dual auth
(authModes: ["oauth", "apikey"]) and add a kimchi case to
testApiKeyConnection so the Test Connection button works for both modes.
Regenerate the golden snapshot with the Kimchi entries (+ other
previously-missing providers).
This commit is contained in:
Fadjrir Herlambang
2026-08-13 17:53:16 +07:00
parent 30fec4318e
commit e02bde4a70
3 changed files with 602 additions and 2 deletions

View File

@@ -788,13 +788,27 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
);
return { valid: exRes.ok, error: exRes.ok ? null : "Invalid Personal Access Token" };
}
case "llm7": {
case "llm7": {
const baseUrl = connection.providerSpecificData?.baseUrl || "https://api.llm7.io/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" };
}
case "kimchi": {
// Dual-auth: same validation endpoint as the OAuth flow — the token (API key
// or OAuth access token) is sent as Authorization: Bearer.
const url = KIMCHI_CONFIG.validationUrl || "https://api.cast.ai/v1/llm/openai/supported-providers";
const res = await fetchWithConnectionProxy(url, {
method: "GET",
headers: {
Accept: "application/json",
Authorization: `Bearer ${connection.apiKey}`,
"User-Agent": "kimchi/0.1.40",
},
}, effectiveProxy);
return { valid: res.ok, error: res.ok ? null : "Invalid API key", refreshed: false };
}
default:
return { valid: false, error: "Provider test not supported" };
}