mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
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:
co-authored by
Claude Fable 5
parent
f17a68aaee
commit
9c9dd7b191
@@ -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" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user