feat(qoder): port Kiro-style provider integration with COSY signing

Replaces the Qoder placeholder with a real free-tier provider:

- Device-flow OAuth: PKCE + nonce generated locally, user authorizes at
  qoder.com/device/selectAccounts, poll openapi.qoder.sh until token
- COSY signing (RSA-1024 + AES-128-CBC + MD5) for chat / model-list
- WAF-bypass body encoding (custom-alphabet base64 + thirds rearrange)
- Live model_config catalog from /algo/api/v2/model/list, cached 1h
- 11 models registered (auto/ultimate/performance/efficient/lite +
  6 frontier *model ids)
- Usage fetcher for openapi.qoder.sh/api/v2/quota/usage
- Dashboard live-models resolver, provider test, OAuth modal hookup
- 24 unit tests covering encoder, PKCE, COSY headers, sigPath stripping
This commit is contained in:
Simon Shi authored and decolua committed 2026-05-29 17:36:27 +07:00
1 parent 468c61b2ac
commit a6fd84691b
20 files changed
+1506 -132

No files matched your search

+13 -8
View File
@@ -63,15 +63,20 @@ export const QWEN_CONFIG = {
codeChallengeMethod: "S256",
};
// Qoder OAuth Configuration (Device Token Flow)
// Qoder OAuth Configuration (Device Token Flow with PKCE).
// Device tokens are long-lived (~30 days for access, ~360 for refresh).
// The upstream refresh endpoint at center.qoder.sh returns 403 for our
// flow — we accept that and surface it to the user as "re-login" instead
// of attempting to silently rotate.
export const QODER_CONFIG = {
apiBaseUrl: "https://api2.qoder.sh",
deviceTokenUrl: "https://api2.qoder.sh/api/v1/deviceToken/poll",
deviceRefreshUrl: "https://api2.qoder.sh/api/v1/deviceToken/refresh",
refreshUrl: "https://api2.qoder.sh/api/v3/user/refresh_token",
userInfoUrl: "https://api2.qoder.sh/api/v1/userinfo",
statusUrl: "https://api2.qoder.sh/api/v3/user/status",
loginUrl: "https://qoder.com/login",
openApiBaseUrl: "https://openapi.qoder.sh",
centerBaseUrl: "https://center.qoder.sh",
chatBaseUrl: "https://api3.qoder.sh",
deviceTokenUrl: "https://openapi.qoder.sh/api/v1/deviceToken/poll",
refreshUrl: "https://center.qoder.sh/algo/api/v3/user/refresh_token",
userInfoUrl: "https://openapi.qoder.sh/api/v1/userinfo",
quotaUsageUrl: "https://openapi.qoder.sh/api/v2/quota/usage",
loginUrl: "https://qoder.com/device/selectAccounts",
};
// iFlow OAuth Configuration (Authorization Code)