Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

feat(ui): add AutoDisableCard to Resilience settings (#765)

diegosouzapwd0c172830c30
diff --git a/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx b/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx
new file mode 100644
index 0000000000..3d3d0c3387
--- /dev/null
+++ b/src/app/(dashboard)/dashboard/settings/components/AutoDisableCard.tsx
@@ -0,0 +1,132 @@
+"use client";
+
+import { useState, useEffect } from "react";
+import { Card, Button, Input } from "@/shared/components";
+import { useTranslations } from "next-intl";
+import { useNotificationStore } from "@/store/notificationStore";
+
+export default function AutoDisableCard() {
+ const [data, setData] = useState({ enabled: false, threshold: 3 });
+ const [draft, setDraft] = useState({ enabled: false, threshold: 3 });
+ const [loading, setLoading] = useState(true);
+ const [saving, setSaving] = useState(false);
+ const [editMode, setEditMode] = useState(false);
+ const t = useTranslations("settings");
+ const tc = useTranslations("common");
+ const notify = useNotificationStore();
+
+ useEffect(() => {
+ fetch("/api/settings/auto-disable-accounts")
+ .then((res) => res.json())
+ .then((json) => {
+ setData(json);
+ setDraft(json);
+ setLoading(false);
+ })
+ .catch(() => setLoading(false));
+ }, []);
+
+ const handleSave = async () => {
+ setSaving(true);
+ try {
+ const res = await fetch("/api/settings/auto-disable-accounts", {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(draft),
+ });
+ if (!res.ok) throw new Error("Failed to save auto-disable config");
+ const savedData = await res.json();
+ setData(savedData);
+ setEditMode(false);
+ notify.success(t("savedSuccessfully") || "Saved successfully");
+ } catch (err) {
+ notify.error(err instanceof Error ? err.message : "Error saving");
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ if (loading) return null;
+
+ return (
+ <Card className="p-0 overflow-hidden">
+ <div className="p-6">
+ <div className="flex items-center justify-between mb-4">
+ <div className="flex items-center gap-2">
+ <span className="material-symbols-outlined text-xl text-primary" aria-hidden="true">
+ block
+ </span>
+ <h2 className="text-lg font-bold">{t("autoDisableBannedAccounts")}</h2>
+ </div>
+ {editMode ? (
+ <div className="flex gap-2">
+ <Button
+ size="sm"
+ variant="secondary"
+ onClick={() => {
+ setDraft(data);
+ setEditMode(false);
+ }}
+ >
+ {tc("cancel")}
+ </Button>
+ <Button
+ size="sm"
+ variant="primary"
+ icon="save"
+ onClick={handleSave}
+ disabled={saving}
+ >
+ {tc("save")}
+ </Button>
+ </div>
+ ) : (
+ <Button size="sm" variant="secondary" icon="edit" onClick={() => setEditMode(true)}>
+ {tc("edit")}
+ </Button>
+ )}
+ </div>
+
+ <p className="text-sm text-text-muted mb-4">{t("autoDisableDescription")}</p>
+
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
+ <div className="rounded-lg bg-black/5 dark:bg-white/5 p-4 flex flex-col justify-center">
+ <label className="flex items-center gap-3 cursor-pointer">
+ <input
+ type="checkbox"
+ checked={editMode ? draft.enabled : data.enabled}
+ onChange={(e) => setDraft((prev) => ({ ...prev, enabled: e.target.checked }))}
+ disabled={!editMode}
+ className="w-4 h-4 text-primary bg-surface/50 border-white/20 rounded focus:ring-primary/50"
+ />
+ <span className="text-sm font-medium">{t("autoDisableBannedAccounts")}</span>
+ </label>
+ </div>
+
+ <div className="rounded-lg bg-black/5 dark:bg-white/5 p-4">
+ <h3 className="text-xs font-bold uppercase tracking-wider mb-2 flex items-center gap-2">
+ {t("autoDisableThreshold")}
+ </h3>
+ {editMode ? (
+ <Input
+ type="number"
+ min="1"
+ max="10"
+ value={draft.threshold}
+ onChange={(e) =>
+ setDraft((prev) => ({ ...prev, threshold: parseInt(e.target.value) || 1 }))
+ }
+ disabled={!draft.enabled}
+ />
+ ) : (
+ <span className={`text-sm font-mono ${!data.enabled && "opacity-50"}`}>
+ {data.threshold} {t("failures", { count: data.threshold })}
+ </span>
+ )}
+ <p className="text-xs text-text-muted mt-2">{t("autoDisableThresholdDesc")}</p>
+ </div>
+ </div>
+ </div>
+ </Card>
+ );
+}
diff --git a/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx b/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx
index 4ee1bc349f..6e127dac38 100644
--- a/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx
+++ b/src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx
@@ -4,6 +4,7 @@ import { useState, useEffect, useCallback } from "react";
import { Card, Button } from "@/shared/components";
import { useNotificationStore } from "@/store/notificationStore";
import { useLocale, useTranslations } from "next-intl";
+import AutoDisableCard from "./AutoDisableCard";
// ─── State colors and labels ──────────────────────────────────────────────
const STATE_STYLES = {
@@ -656,6 +657,8 @@ export default function ResilienceTab() {
onSave={handleSaveProfiles}
saving={saving}
/>
+ {/* 1.5 Auto Disable Banned Accounts */}
+ <AutoDisableCard />
{/* 2. Rate Limiting (editable defaults + active limiters) */}
<RateLimitCard
rateLimitStatus={data?.rateLimitStatus || []}
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json
index c5b3d79207..25bff6e968 100644
--- a/src/i18n/messages/en.json
+++ b/src/i18n/messages/en.json
@@ -1688,6 +1688,10 @@
"timeoutMs": "Timeout (ms)",
"enableSystemPrompt": "Enable System Prompt",
"systemPromptText": "System Prompt Text",
+ "autoDisableBannedAccounts": "Auto-Disable Banned Accounts",
+ "autoDisableDescription": "Permanently mark provider connections as deactivated if they return specific terminal ban signals (e.g. HTTP 403 'verify your account'). This removes them from the combo rotation.",
+ "autoDisableThreshold": "Ban Threshold",
+ "autoDisableThresholdDesc": "Consecutive ban signals required before permanent deactivation.",
"enableThinking": "Enable Thinking",
"maxThinkingTokens": "Max Thinking Tokens",
"enableProxy": "Enable Proxy",