feat(qoder): support PAT auth and refresh model list

Exchange Personal Access Tokens for short-lived job tokens, close the
SSE stream on terminal frames so non-streaming clients do not hang,
re-enable OAuth plus API-key auth modes, and replace the model catalog
with the current Qoder aliases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
decolua
2026-07-29 18:09:57 +07:00
co-authored by Claude Fable 5
parent f17a68aaee
commit 9c9dd7b191
4 changed files with 217 additions and 57 deletions
@@ -785,6 +785,26 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
}, effectiveProxy);
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
}
case "qoder": {
// PAT (pt-...) exchange → job token. A successful exchange proves the PAT.
const raw = connection.apiKey || "";
const pat = raw.startsWith("pt-") ? raw : `pt-${raw}`;
const exRes = await fetchWithConnectionProxy(
"https://openapi.qoder.sh/api/v1/jobToken/exchange",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Cosy-Version": "1.0.1",
"Cosy-ClientType": "5",
},
body: JSON.stringify({ personal_token: pat }),
},
effectiveProxy,
);
return { valid: exRes.ok, error: exRes.ok ? null : "Invalid Personal Access Token" };
}
default:
return { valid: false, error: "Provider test not supported" };
}