fix(perplexity): use /v1/models endpoint for key validation

Perplexity deprecated /models (404); switch to /v1/models for provider
test connection and models route. (#1895, fixes #1894)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gaoliao1688andCursor authored and decolua committed 2026-06-19 15:14:15 +07:00
1 parent 126aa244c5
commit db4499d6df
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -502,7 +502,7 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
}
case "perplexity": {
const res = await fetchWithConnectionProxy("https://api.perplexity.ai/models", { headers: { Authorization: `Bearer ${connection.apiKey}` } }, effectiveProxy);
const res = await fetchWithConnectionProxy("https://api.perplexity.ai/v1/models", { headers: { Authorization: `Bearer ${connection.apiKey}` } }, effectiveProxy);
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
}
case "together": {