- Cap maximum cooldown for rate limit handling in account unavailability and single-model chat flows

- Dynamic custom model fetching for model selection
This commit is contained in:
decolua
2026-04-24 16:14:18 +07:00
parent c42c0146ab
commit cca615eaff
19 changed files with 108 additions and 60 deletions
@@ -159,7 +159,9 @@ export async function POST(request) {
authData = JSON.parse(existingAuth);
} catch { /* No existing auth */ }
// Force apikey mode (keep existing tokens untouched for ChatGPT login reuse)
authData.OPENAI_API_KEY = apiKey;
authData.auth_mode = "apikey";
await fs.writeFile(authPath, JSON.stringify(authData, null, 2));
return NextResponse.json({
@@ -215,7 +217,8 @@ export async function DELETE() {
const existingAuth = await fs.readFile(authPath, "utf-8");
const authData = JSON.parse(existingAuth);
delete authData.OPENAI_API_KEY;
delete authData.auth_mode;
// Write back or delete if empty
if (Object.keys(authData).length === 0) {
await fs.unlink(authPath);