Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

feat(routing): opt-in provider-moment failure attribution (#1347) (#1567)

suantea (asuan_suan)d2e2615c1598
diff --git a/client/src/components/provider-moment-control.tsx b/client/src/components/provider-moment-control.tsx
new file mode 100644
index 00000000..d2d26f79
--- /dev/null
+++ b/client/src/components/provider-moment-control.tsx
@@ -0,0 +1,45 @@
+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
+import { useI18n } from '@/i18n'
+import { apiFetch } from '@/lib/api'
+import { Tooltip } from '@/components/tooltip'
+
+// Provider-moment failure attribution (#1347, opt-in): tag 429 / 5xx /
+// timeout / transport failures as the provider's bad minute so they steer the
+// key without counting against the model's reliability. Independent of the
+// routing-strategy snapshot — it lives in settings, so it owns its own
+// query + mutation. Off by default; existing installs keep today's scoring.
+async function fetchAttribution(): Promise<{ enabled: boolean }> {
+ return apiFetch('/api/settings/provider-moment-attribution')
+}
+
+export function ProviderMomentControl() {
+ const { t } = useI18n()
+ const queryClient = useQueryClient()
+ const { data } = useQuery({ queryKey: ['settings', 'provider-moment-attribution'], queryFn: fetchAttribution })
+ const enabled = data?.enabled ?? false
+
+ const mutation = useMutation({
+ mutationFn: (value: boolean) =>
+ apiFetch('/api/settings/provider-moment-attribution', {
+ method: 'PUT',
+ body: JSON.stringify({ enabled: value }),
+ }),
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: ['settings', 'provider-moment-attribution'] }),
+ })
+
+ return (
+ <label className="inline-flex items-center gap-2 text-xs text-muted-foreground">
+ <span>{t('strategies.providerMomentAttribution')}</span>
+ <input
+ type="checkbox"
+ checked={enabled}
+ disabled={mutation.isPending}
+ onChange={e => mutation.mutate(e.target.checked)}
+ className="h-3.5 w-3.5 accent-foreground"
+ />
+ <Tooltip text={t('strategies.providerMomentAttributionHint')}>
+ <span className="cursor-help underline decoration-dotted underline-offset-2">?</span>
+ </Tooltip>
+ </label>
+ )
+}
diff --git a/client/src/i18n/locales/am.json b/client/src/i18n/locales/am.json
index 73a90f70..480e31ad 100644
--- a/client/src/i18n/locales/am.json
+++ b/client/src/i18n/locales/am.json
@@ -347,7 +347,9 @@
"scoreColumn": "ውጤት",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "የራውተር ግፊት",
diff --git a/client/src/i18n/locales/ar.json b/client/src/i18n/locales/ar.json
index 66441378..9443dd08 100644
--- a/client/src/i18n/locales/ar.json
+++ b/client/src/i18n/locales/ar.json
@@ -347,7 +347,9 @@
"scoreColumn": "النتيجة",
"minReliabilityFloor": "الحد الأدنى للموثوقية",
"minReliabilityFloorHint": "يستبعد النموذج من التوجيه عندما تنخفض نسبة نجاحه المرصودة دون هذه القيمة. 0.8 تعني 80٪. اتركه فارغًا للتعطيل — تُحفظ دائمًا النماذج ذات السجلّ القليل حتى تظل النماذج الجديدة قابلة للتجربة. لا يُفرِّغ السلسلة كاملة أبدًا.",
- "minReliabilityFloorOff": "معطّل"
+ "minReliabilityFloorOff": "معطّل",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "ضغط جهاز التوجيه",
diff --git a/client/src/i18n/locales/az.json b/client/src/i18n/locales/az.json
index 58688093..183eef8b 100644
--- a/client/src/i18n/locales/az.json
+++ b/client/src/i18n/locales/az.json
@@ -347,7 +347,9 @@
"scoreColumn": "Musiqi",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Router təzyiqi",
diff --git a/client/src/i18n/locales/bg.json b/client/src/i18n/locales/bg.json
index b5827ef0..d452f715 100644
--- a/client/src/i18n/locales/bg.json
+++ b/client/src/i18n/locales/bg.json
@@ -347,7 +347,9 @@
"scoreColumn": "Партитура",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Налягане в рутера",
diff --git a/client/src/i18n/locales/bn.json b/client/src/i18n/locales/bn.json
index 8d3c4953..05af12f0 100644
--- a/client/src/i18n/locales/bn.json
+++ b/client/src/i18n/locales/bn.json
@@ -347,7 +347,9 @@
"scoreColumn": "স্কোর",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "রাউটারের চাপ",
diff --git a/client/src/i18n/locales/cs.json b/client/src/i18n/locales/cs.json
index 0d77dc4d..aab9d35d 100644
--- a/client/src/i18n/locales/cs.json
+++ b/client/src/i18n/locales/cs.json
@@ -347,7 +347,9 @@
"scoreColumn": "Hudba",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Tlak frézky",
diff --git a/client/src/i18n/locales/da.json b/client/src/i18n/locales/da.json
index 5dd89e82..3aa9a418 100644
--- a/client/src/i18n/locales/da.json
+++ b/client/src/i18n/locales/da.json
@@ -347,7 +347,9 @@
"scoreColumn": "Score",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Fræsertryk",
diff --git a/client/src/i18n/locales/de.json b/client/src/i18n/locales/de.json
index 33306ad6..ce656358 100644
--- a/client/src/i18n/locales/de.json
+++ b/client/src/i18n/locales/de.json
@@ -347,7 +347,9 @@
"scoreColumn": "Punktzahl",
"minReliabilityFloor": "Minimale Zuverlässigkeitsschwelle",
"minReliabilityFloorHint": "Nimmt ein Modell aus dem Routing, sobald seine beobachtete Erfolgsquote unter diesen Wert fällt. 0,8 bedeutet 80 %. Leer lassen zum Deaktivieren – Modelle mit zu wenig Historie bleiben immer erhalten, damit neue Modelle weiter getestet werden können. Leert niemals die gesamte Kette.",
- "minReliabilityFloorOff": "Deaktiviert"
+ "minReliabilityFloorOff": "Deaktiviert",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Router-Druck",
diff --git a/client/src/i18n/locales/el.json b/client/src/i18n/locales/el.json
index 3fd7724a..daffba3a 100644
--- a/client/src/i18n/locales/el.json
+++ b/client/src/i18n/locales/el.json
@@ -347,7 +347,9 @@
"scoreColumn": "Σκορ",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Πίεση δρομολογητή",
diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.json
index 51020c98..ae7b7fdf 100644
--- a/client/src/i18n/locales/en.json
+++ b/client/src/i18n/locales/en.json
@@ -323,6 +323,8 @@
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
"minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring.",
"guardrails": "Guardrails",
"guardrailsTooltip": "Always-on guardrails: free-quota headroom × live rate-limit penalty. Below 1.0 means the model is being held back.",
"scoreTooltip": "Final routing score = weighted average of the three axes, multiplied by the guardrails. Higher routes first.",
diff --git a/client/src/i18n/locales/es.json b/client/src/i18n/locales/es.json
index b7393f26..c4fcf2c1 100644
--- a/client/src/i18n/locales/es.json
+++ b/client/src/i18n/locales/es.json
@@ -347,7 +347,9 @@
"scoreColumn": "Puntuación",
"minReliabilityFloor": "Umbral mínimo de fiabilidad",
"minReliabilityFloorHint": "Excluye un modelo del enrutamiento cuando su tasa de éxito observada cae por debajo de este valor. 0,8 significa 80 %. Déjelo vacío para desactivarlo: los modelos con poco historial siempre se conservan para que los nuevos modelos sigan probándose. Nunca vacía toda la cadena.",
- "minReliabilityFloorOff": "Desactivado"
+ "minReliabilityFloorOff": "Desactivado",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Presión del router",
diff --git a/client/src/i18n/locales/fa.json b/client/src/i18n/locales/fa.json
index ab9beb59..6d1d86fb 100644
--- a/client/src/i18n/locales/fa.json
+++ b/client/src/i18n/locales/fa.json
@@ -347,7 +347,9 @@
"scoreColumn": "امتیاز",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "فشار روتر",
diff --git a/client/src/i18n/locales/fi.json b/client/src/i18n/locales/fi.json
index b2324d31..49334abf 100644
--- a/client/src/i18n/locales/fi.json
+++ b/client/src/i18n/locales/fi.json
@@ -347,7 +347,9 @@
"scoreColumn": "Musiikki",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Jyrsimen paine",
diff --git a/client/src/i18n/locales/fr.json b/client/src/i18n/locales/fr.json
index dff24196..b53a809a 100644
--- a/client/src/i18n/locales/fr.json
+++ b/client/src/i18n/locales/fr.json
@@ -347,7 +347,9 @@
"scoreColumn": "Score",
"minReliabilityFloor": "Seuil de fiabilité minimal",
"minReliabilityFloorHint": "Retire un modèle du routage dès que son taux de succès observé passe sous cette valeur. 0,8 signifie 80 %. Laissez vide pour désactiver — les modèles avec trop peu d'historique sont toujours conservés afin que les nouveaux modèles puissent encore être essayés. Ne vide jamais toute la chaîne.",
- "minReliabilityFloorOff": "Désactivé"
+ "minReliabilityFloorOff": "Désactivé",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Pression sur le routeur",
diff --git a/client/src/i18n/locales/gu.json b/client/src/i18n/locales/gu.json
index 6eaebf6b..4196f77d 100644
--- a/client/src/i18n/locales/gu.json
+++ b/client/src/i18n/locales/gu.json
@@ -347,7 +347,9 @@
"scoreColumn": "સ્કોર",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "રાઉટર દબાણ",
diff --git a/client/src/i18n/locales/ha.json b/client/src/i18n/locales/ha.json
index e3712c2a..f63c6f4b 100644
--- a/client/src/i18n/locales/ha.json
+++ b/client/src/i18n/locales/ha.json
@@ -347,7 +347,9 @@
"scoreColumn": "Maki",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Matsin na'ura mai ba da hanya tsakanin hanyoyin sadarwa",
diff --git a/client/src/i18n/locales/he.json b/client/src/i18n/locales/he.json
index 04b65260..2bbc2e6b 100644
--- a/client/src/i18n/locales/he.json
+++ b/client/src/i18n/locales/he.json
@@ -347,7 +347,9 @@
"scoreColumn": "פסקול",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "לחץ הנתב",
diff --git a/client/src/i18n/locales/hi.json b/client/src/i18n/locales/hi.json
index 682b9b71..9eeb0390 100644
--- a/client/src/i18n/locales/hi.json
+++ b/client/src/i18n/locales/hi.json
@@ -347,7 +347,9 @@
"scoreColumn": "स्कोर",
"minReliabilityFloor": "न्यूनतम विश्वसनीयता सीमा",
"minReliabilityFloorHint": "जब किसी मॉडल की देखी गई सफलता दर इस मान से नीचे गिर जाए, तो उसे रूटिंग से हटा देता है। 0.8 का अर्थ 80% है। अक्षम करने के लिए खाली छोड़ें — बहुत कम इतिहास वाले मॉडल हमेशा रखे जाते हैं ताकि नए मॉडल आज़माए जा सकें। पूरी श्रृंखला कभी खाली नहीं करता।",
- "minReliabilityFloorOff": "अक्षम"
+ "minReliabilityFloorOff": "अक्षम",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "राउटर का दबाव",
diff --git a/client/src/i18n/locales/hr.json b/client/src/i18n/locales/hr.json
index c3676979..6439f540 100644
--- a/client/src/i18n/locales/hr.json
+++ b/client/src/i18n/locales/hr.json
@@ -347,7 +347,9 @@
"scoreColumn": "Glazba",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Tlak glodalice",
diff --git a/client/src/i18n/locales/hu.json b/client/src/i18n/locales/hu.json
index 7fcb3a55..6d968cf8 100644
--- a/client/src/i18n/locales/hu.json
+++ b/client/src/i18n/locales/hu.json
@@ -347,7 +347,9 @@
"scoreColumn": "Zene",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Router nyomás",
diff --git a/client/src/i18n/locales/id.json b/client/src/i18n/locales/id.json
index c2bd7f52..8e8bf178 100644
--- a/client/src/i18n/locales/id.json
+++ b/client/src/i18n/locales/id.json
@@ -347,7 +347,9 @@
"scoreColumn": "Skor",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Tekanan router",
diff --git a/client/src/i18n/locales/ig.json b/client/src/i18n/locales/ig.json
index ab6f1bfc..d1b5d1bd 100644
--- a/client/src/i18n/locales/ig.json
+++ b/client/src/i18n/locales/ig.json
@@ -347,7 +347,9 @@
"scoreColumn": "Akara",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Nrụgide rawụta",
diff --git a/client/src/i18n/locales/it.json b/client/src/i18n/locales/it.json
index c31b399c..77f068f2 100644
--- a/client/src/i18n/locales/it.json
+++ b/client/src/i18n/locales/it.json
@@ -347,7 +347,9 @@
"scoreColumn": "Punteggio",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Pressione del router",
diff --git a/client/src/i18n/locales/ja.json b/client/src/i18n/locales/ja.json
index 7ecfeb34..507394d3 100644
--- a/client/src/i18n/locales/ja.json
+++ b/client/src/i18n/locales/ja.json
@@ -347,7 +347,9 @@
"scoreColumn": "スコア",
"minReliabilityFloor": "最低信頼性しきい値",
"minReliabilityFloorHint": "観測された成功率がこの値を下回ったモデルをルーティングから除外します。0.8 は 80% を意味します。空欄で無効 — 履歴が少なすぎるモデルは常に保持され、新しいモデルも試行され続けます。チェーン全体が空になることはありません。",
- "minReliabilityFloorOff": "無効"
+ "minReliabilityFloorOff": "無効",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "ルーターの圧力",
diff --git a/client/src/i18n/locales/ka.json b/client/src/i18n/locales/ka.json
index 23ce0865..57ea9f3a 100644
--- a/client/src/i18n/locales/ka.json
+++ b/client/src/i18n/locales/ka.json
@@ -347,7 +347,9 @@
"scoreColumn": "ქულა",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "როუტერის წნევა",
diff --git a/client/src/i18n/locales/km.json b/client/src/i18n/locales/km.json
index 49be6e2a..b381afb7 100644
--- a/client/src/i18n/locales/km.json
+++ b/client/src/i18n/locales/km.json
@@ -347,7 +347,9 @@
"scoreColumn": "ពិន្ទុ",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "សំពាធរ៉ោទ័រ",
diff --git a/client/src/i18n/locales/kn.json b/client/src/i18n/locales/kn.json
index 7164193a..fc078fea 100644
--- a/client/src/i18n/locales/kn.json
+++ b/client/src/i18n/locales/kn.json
@@ -347,7 +347,9 @@
"scoreColumn": "ಸ್ಕೋರ್",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "ರೂಟರ್ ಒತ್ತಡ",
diff --git a/client/src/i18n/locales/ko.json b/client/src/i18n/locales/ko.json
index e2e3529d..46410ae7 100644
--- a/client/src/i18n/locales/ko.json
+++ b/client/src/i18n/locales/ko.json
@@ -347,7 +347,9 @@
"scoreColumn": "점수",
"minReliabilityFloor": "최소 신뢰성 기준",
"minReliabilityFloorHint": "관측된 성공률이 이 값 아래로 떨어지면 해당 모델을 라우팅에서 제외합니다. 0.8은 80%를 의미합니다. 비워 두면 비활성화됩니다 — 기록이 너무 적은 모델은 항상 유지되어 새 모델도 계속 시도할 수 있습니다. 전체 체인을 비우지는 않습니다.",
- "minReliabilityFloorOff": "비활성"
+ "minReliabilityFloorOff": "비활성",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "라우터 압력",
diff --git a/client/src/i18n/locales/lt.json b/client/src/i18n/locales/lt.json
index d1eff417..ab3dc56c 100644
--- a/client/src/i18n/locales/lt.json
+++ b/client/src/i18n/locales/lt.json
@@ -347,7 +347,9 @@
"scoreColumn": "Muzika",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Maršrutizatoriaus slėgis",
diff --git a/client/src/i18n/locales/ml.json b/client/src/i18n/locales/ml.json
index 9eb3b7ea..ed768112 100644
--- a/client/src/i18n/locales/ml.json
+++ b/client/src/i18n/locales/ml.json
@@ -347,7 +347,9 @@
"scoreColumn": "സ്കോർ",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "റൂട്ടർ മർദ്ദം",
diff --git a/client/src/i18n/locales/mr.json b/client/src/i18n/locales/mr.json
index 48d20d2a..011cb889 100644
--- a/client/src/i18n/locales/mr.json
+++ b/client/src/i18n/locales/mr.json
@@ -347,7 +347,9 @@
"scoreColumn": "स्कोअर",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "राउटर दबाव",
diff --git a/client/src/i18n/locales/ms.json b/client/src/i18n/locales/ms.json
index c3d890be..c5fe0eb4 100644
--- a/client/src/i18n/locales/ms.json
+++ b/client/src/i18n/locales/ms.json
@@ -347,7 +347,9 @@
"scoreColumn": "Skor",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Tekanan penghala",
diff --git a/client/src/i18n/locales/my.json b/client/src/i18n/locales/my.json
index 6d701e70..c444dca8 100644
--- a/client/src/i18n/locales/my.json
+++ b/client/src/i18n/locales/my.json
@@ -347,7 +347,9 @@
"scoreColumn": "အမှတ်",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "ရောတာဖိအား",
diff --git a/client/src/i18n/locales/ne.json b/client/src/i18n/locales/ne.json
index b9a87ba4..37e58345 100644
--- a/client/src/i18n/locales/ne.json
+++ b/client/src/i18n/locales/ne.json
@@ -347,7 +347,9 @@
"scoreColumn": "प्राप्ताङ्क",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "राउटरको चाप",
diff --git a/client/src/i18n/locales/nl.json b/client/src/i18n/locales/nl.json
index cf9b33c0..00ebe470 100644
--- a/client/src/i18n/locales/nl.json
+++ b/client/src/i18n/locales/nl.json
@@ -347,7 +347,9 @@
"scoreColumn": "Partituur",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Routerdruk",
diff --git a/client/src/i18n/locales/no.json b/client/src/i18n/locales/no.json
index 07b6fb15..a684465f 100644
--- a/client/src/i18n/locales/no.json
+++ b/client/src/i18n/locales/no.json
@@ -347,7 +347,9 @@
"scoreColumn": "Poengsum",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Frestrykk",
diff --git a/client/src/i18n/locales/or.json b/client/src/i18n/locales/or.json
index 36d18773..a31303cf 100644
--- a/client/src/i18n/locales/or.json
+++ b/client/src/i18n/locales/or.json
@@ -347,7 +347,9 @@
"scoreColumn": "ସ୍କୋର",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "ରାଉଟର ଚାପ",
diff --git a/client/src/i18n/locales/pa.json b/client/src/i18n/locales/pa.json
index 97927e83..efe104be 100644
--- a/client/src/i18n/locales/pa.json
+++ b/client/src/i18n/locales/pa.json
@@ -347,7 +347,9 @@
"scoreColumn": "ਸਕੋਰ",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "ਰਾਊਟਰ ਦਾ ਦਬਾਅ",
diff --git a/client/src/i18n/locales/pl.json b/client/src/i18n/locales/pl.json
index 8fbba06b..e34838dc 100644
--- a/client/src/i18n/locales/pl.json
+++ b/client/src/i18n/locales/pl.json
@@ -347,7 +347,9 @@
"scoreColumn": "Wynik",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Ciśnienie routera",
diff --git a/client/src/i18n/locales/pt-BR.json b/client/src/i18n/locales/pt-BR.json
index ae734446..1ef45a61 100644
--- a/client/src/i18n/locales/pt-BR.json
+++ b/client/src/i18n/locales/pt-BR.json
@@ -347,7 +347,9 @@
"scoreColumn": "Pontuação",
"minReliabilityFloor": "Piso mínimo de confiabilidade",
"minReliabilityFloorHint": "Remove um modelo do roteamento quando sua taxa de sucesso observada cai abaixo deste valor. 0,8 significa 80%. Deixe em branco para desativar — modelos com pouco histórico são sempre mantidos para que modelos novos ainda possam ser testados. Nunca esvazia toda a cadeia.",
- "minReliabilityFloorOff": "Desativado"
+ "minReliabilityFloorOff": "Desativado",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Pressão do roteador",
diff --git a/client/src/i18n/locales/pt-PT.json b/client/src/i18n/locales/pt-PT.json
index 68f9c31e..21bca9d5 100644
--- a/client/src/i18n/locales/pt-PT.json
+++ b/client/src/i18n/locales/pt-PT.json
@@ -347,7 +347,9 @@
"scoreColumn": "Banda sonora",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Pressão do router",
diff --git a/client/src/i18n/locales/ro.json b/client/src/i18n/locales/ro.json
index 073a33aa..86e10720 100644
--- a/client/src/i18n/locales/ro.json
+++ b/client/src/i18n/locales/ro.json
@@ -347,7 +347,9 @@
"scoreColumn": "Scorul",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Presiunea routerului",
diff --git a/client/src/i18n/locales/ru.json b/client/src/i18n/locales/ru.json
index 613a9eb9..642ef8bb 100644
--- a/client/src/i18n/locales/ru.json
+++ b/client/src/i18n/locales/ru.json
@@ -347,7 +347,9 @@
"scoreColumn": "Оценка",
"minReliabilityFloor": "Минимальный порог надёжности",
"minReliabilityFloorHint": "Исключает модель из маршрутизации, когда её наблюдаемая доля успешных запросов падает ниже этого значения. 0,8 означает 80 %. Оставьте пустым, чтобы отключить — модели с малой историей всегда сохраняются, чтобы новые модели продолжали пробоваться. Никогда не опустошает всю цепочку.",
- "minReliabilityFloorOff": "Отключено"
+ "minReliabilityFloorOff": "Отключено",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Давление маршрутизатора",
diff --git a/client/src/i18n/locales/si.json b/client/src/i18n/locales/si.json
index 80647889..77a5835c 100644
--- a/client/src/i18n/locales/si.json
+++ b/client/src/i18n/locales/si.json
@@ -347,7 +347,9 @@
"scoreColumn": "ලකුණු",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "රවුටරයේ පීඩනය",
diff --git a/client/src/i18n/locales/sk.json b/client/src/i18n/locales/sk.json
index 2bb0ff94..828745fc 100644
--- a/client/src/i18n/locales/sk.json
+++ b/client/src/i18n/locales/sk.json
@@ -347,7 +347,9 @@
"scoreColumn": "Hudba",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Tlak frézky",
diff --git a/client/src/i18n/locales/sr.json b/client/src/i18n/locales/sr.json
index 42acb29d..ae6e1227 100644
--- a/client/src/i18n/locales/sr.json
+++ b/client/src/i18n/locales/sr.json
@@ -347,7 +347,9 @@
"scoreColumn": "Резултат",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Притисак рутера",
diff --git a/client/src/i18n/locales/sv.json b/client/src/i18n/locales/sv.json
index afa6e4c5..0a5c5406 100644
--- a/client/src/i18n/locales/sv.json
+++ b/client/src/i18n/locales/sv.json
@@ -347,7 +347,9 @@
"scoreColumn": "Poäng",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Frästryck",
diff --git a/client/src/i18n/locales/sw.json b/client/src/i18n/locales/sw.json
index 905d9c92..60a47690 100644
--- a/client/src/i18n/locales/sw.json
+++ b/client/src/i18n/locales/sw.json
@@ -347,7 +347,9 @@
"scoreColumn": "Alama",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Shinikizo la router",
diff --git a/client/src/i18n/locales/ta.json b/client/src/i18n/locales/ta.json
index 19bd908c..2796ff6d 100644
--- a/client/src/i18n/locales/ta.json
+++ b/client/src/i18n/locales/ta.json
@@ -347,7 +347,9 @@
"scoreColumn": "மதிப்பெண்",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "திசைவி அழுத்தம்",
diff --git a/client/src/i18n/locales/te.json b/client/src/i18n/locales/te.json
index b7b2caae..bee85113 100644
--- a/client/src/i18n/locales/te.json
+++ b/client/src/i18n/locales/te.json
@@ -347,7 +347,9 @@
"scoreColumn": "స్కోర్",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "రూటర్ ఒత్తిడి",
diff --git a/client/src/i18n/locales/th.json b/client/src/i18n/locales/th.json
index 8243968f..ca3d991e 100644
--- a/client/src/i18n/locales/th.json
+++ b/client/src/i18n/locales/th.json
@@ -347,7 +347,9 @@
"scoreColumn": "คะแนน",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "แรงดันเราเตอร์",
diff --git a/client/src/i18n/locales/tl.json b/client/src/i18n/locales/tl.json
index a0ca3462..9595a7ed 100644
--- a/client/src/i18n/locales/tl.json
+++ b/client/src/i18n/locales/tl.json
@@ -347,7 +347,9 @@
"scoreColumn": "Iskor",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Presyon ng router",
diff --git a/client/src/i18n/locales/tr.json b/client/src/i18n/locales/tr.json
index 333a0c9e..504a4563 100644
--- a/client/src/i18n/locales/tr.json
+++ b/client/src/i18n/locales/tr.json
@@ -347,7 +347,9 @@
"scoreColumn": "Puan",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Yönlendirici baskısı",
diff --git a/client/src/i18n/locales/uk.json b/client/src/i18n/locales/uk.json
index 6b5be05c..e752bbb3 100644
--- a/client/src/i18n/locales/uk.json
+++ b/client/src/i18n/locales/uk.json
@@ -347,7 +347,9 @@
"scoreColumn": "Оцінка",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Тиск фрезера",
diff --git a/client/src/i18n/locales/ur.json b/client/src/i18n/locales/ur.json
index 1990cc70..e222c1ac 100644
--- a/client/src/i18n/locales/ur.json
+++ b/client/src/i18n/locales/ur.json
@@ -347,7 +347,9 @@
"scoreColumn": "سکور",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "راؤٹر کا دباؤ",
diff --git a/client/src/i18n/locales/uz.json b/client/src/i18n/locales/uz.json
index 9f9e094b..339f22e7 100644
--- a/client/src/i18n/locales/uz.json
+++ b/client/src/i18n/locales/uz.json
@@ -347,7 +347,9 @@
"scoreColumn": "Gol",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Router bosimi",
diff --git a/client/src/i18n/locales/vi.json b/client/src/i18n/locales/vi.json
index 7719672a..dc3bba5b 100644
--- a/client/src/i18n/locales/vi.json
+++ b/client/src/i18n/locales/vi.json
@@ -347,7 +347,9 @@
"scoreColumn": "Điểm",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Áp lực bộ định tuyến",
diff --git a/client/src/i18n/locales/yo.json b/client/src/i18n/locales/yo.json
index cd5a587d..f2ac16a9 100644
--- a/client/src/i18n/locales/yo.json
+++ b/client/src/i18n/locales/yo.json
@@ -347,7 +347,9 @@
"scoreColumn": "Dimegilio",
"minReliabilityFloor": "Minimum reliability floor",
"minReliabilityFloorHint": "Drop a model from routing once its observed success rate falls below this. 0.8 means 80%. Leave blank to disable — models with too little history are always kept so new models can still be tried. Never empties the whole chain.",
- "minReliabilityFloorOff": "Disabled"
+ "minReliabilityFloorOff": "Disabled",
+ "providerMomentAttribution": "Attribute rate-limit failures to the provider",
+ "providerMomentAttributionHint": "When on, 429s, 5xx errors, timeouts and dropped connections are treated as the provider having a bad minute: they still bench the key, but they no longer count against the model's reliability score. Off by default — leave it off to keep today's scoring."
},
"penaltyInspector": {
"title": "Ipa olulana",
diff --git a/client/src/i18n/locales/zh-CN.json b/client/src/i18n/locales/zh-CN.json
index 4eebc830..61909bd5 100644
--- a/client/src/i18n/locales/zh-CN.json
+++ b/client/src/i18n/locales/zh-CN.json
@@ -323,6 +323,8 @@
"minReliabilityFloor": "最低可靠性门槛",
"minReliabilityFloorHint": "当模型的实测成功率低于此值时将其移出路由。0.8 即 80%。留空表示关闭——历史样本不足的模型始终保留,以便新模型仍有机会被尝试。绝不会让整条链变空。",
"minReliabilityFloorOff": "关闭",
+ "providerMomentAttribution": "把限流失败归因到渠道",
+ "providerMomentAttributionHint": "开启后,429、5xx、超时和连接中断会被视为「渠道这一刻不行」:仍会冷却对应的 key,但不再计入模型的可靠性评分。默认关闭——关闭即保持现有评分行为。",
"guardrails": "护栏",
"guardrailsTooltip": "始终生效的护栏:免费额度余量 × 实时限流惩罚。低于 1.0 表示该模型正在被抑制。",
"scoreTooltip": "最终路由得分 = 三个维度的加权平均值,再乘以护栏系数。得分越高越优先路由。",
diff --git a/client/src/i18n/locales/zh-TW.json b/client/src/i18n/locales/zh-TW.json
index 669a95a0..033e4883 100644
--- a/client/src/i18n/locales/zh-TW.json
+++ b/client/src/i18n/locales/zh-TW.json
@@ -347,7 +347,9 @@
"scoreColumn": "分數",
"minReliabilityFloor": "最低可靠性門檻",
"minReliabilityFloorHint": "模型實際成功率低於此值時不再參與路由。0.8 表示 80%。留空表示關閉——歷史樣本太少的模型始終保留,以便新模型仍有機會被嘗試。不會清空整條候選鏈。",
- "minReliabilityFloorOff": "關閉"
+ "minReliabilityFloorOff": "關閉",
+ "providerMomentAttribution": "把限流失敗歸因到渠道",
+ "providerMomentAttributionHint": "開啟後,429、5xx、逾時和連接中斷會被視為「渠道這一刻不行」:仍會冷卻對應的 key,但不再計入模型的可靠性評分。預設關閉——關閉即保持現有評分行為。"
},
"penaltyInspector": {
"title": "路由壓力",
diff --git a/client/src/pages/FallbackPage.tsx b/client/src/pages/FallbackPage.tsx
index 092e7cb2..05430d35 100644
--- a/client/src/pages/FallbackPage.tsx
+++ b/client/src/pages/FallbackPage.tsx
@@ -49,6 +49,7 @@ import { Tooltip } from '@/components/tooltip'
import { PenaltyInspector } from '@/components/penalty-inspector'
import { PeakHoursControls } from '@/components/peak-hours-controls'
import { ReliabilityFloorControl } from '@/components/reliability-floor-control'
+import { ProviderMomentControl } from '@/components/provider-moment-control'
import { ChainManager } from '@/components/chain-manager'
// `tKey` is the i18n suffix under `strategies.*` (label) and `strategies.*Blurb`.
@@ -495,6 +496,10 @@ export default function FallbackPage() {
Shown in every mode; the floor pre-filters the candidate chain
regardless of how models are ranked. */}
<ReliabilityFloorControl />
+ {/* Provider-moment failure attribution (#1347, opt-in): 429s, 5xx,
+ timeouts and transport drops steer the key without counting
+ against the model's reliability. Off by default. */}
+ <ProviderMomentControl />
</div>
)}
diff --git a/server/src/__tests__/db/migrate/request-failure-attribution.test.ts b/server/src/__tests__/db/migrate/request-failure-attribution.test.ts
new file mode 100644
index 00000000..344a39ea
--- /dev/null
+++ b/server/src/__tests__/db/migrate/request-failure-attribution.test.ts
@@ -0,0 +1,61 @@
+import Database from 'better-sqlite3';
+import { afterEach, describe, expect, it } from 'vitest';
+import { up, down } from '../../../db/migrations/20261017_233153_request_failure_attribution.js';
+
+// #1347 (PR 1): the migration only adds one column to requests; a minimal
+// stand-in table is enough to verify the roundtrip.
+function makeDb(): Database.Database {
+ const db = new Database(':memory:');
+ db.exec(`
+ CREATE TABLE requests (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ platform TEXT NOT NULL,
+ model_id TEXT NOT NULL,
+ key_id INTEGER,
+ status TEXT NOT NULL
+ );
+ `);
+ return db;
+}
+
+function hasAttributionColumn(db: Database.Database): boolean {
+ const cols = db.prepare('PRAGMA table_info(requests)').all() as { name: string }[];
+ return cols.some((c) => c.name === 'failure_attribution');
+}
+
+const dbs: Database.Database[] = [];
+afterEach(() => {
+ for (const db of dbs.splice(0)) db.close();
+});
+
+describe('request_failure_attribution migration (#1347 PR 1)', () => {
+ it('adds the failure_attribution column', () => {
+ const db = makeDb();
+ dbs.push(db);
+
+ expect(hasAttributionColumn(db)).toBe(false);
+ up(db);
+ expect(hasAttributionColumn(db)).toBe(true);
+ });
+
+ it('is idempotent — a second up() is a no-op', () => {
+ const db = makeDb();
+ dbs.push(db);
+
+ up(db);
+ up(db);
+ expect(hasAttributionColumn(db)).toBe(true);
+ });
+
+ it('down() drops the column, and up() can add it back (full roundtrip)', () => {
+ const db = makeDb();
+ dbs.push(db);
+
+ up(db);
+ down(db);
+ expect(hasAttributionColumn(db)).toBe(false);
+
+ up(db);
+ expect(hasAttributionColumn(db)).toBe(true);
+ });
+});
diff --git a/server/src/__tests__/db/migrate/roundtrip.test.ts b/server/src/__tests__/db/migrate/roundtrip.test.ts
index f549c9da..f6805c37 100644
--- a/server/src/__tests__/db/migrate/roundtrip.test.ts
+++ b/server/src/__tests__/db/migrate/roundtrip.test.ts
@@ -47,6 +47,7 @@ const SEARCH_ENGINES_FILENAME = '20261013_000001_search_engines.ts';
const DECISION_REQUESTS_FILENAME = '20261016_000001_decision_requests.ts';
const LLMTR_REENABLE_KEYS_FILENAME = '20261017_000001_llmtr_reenable_keys.ts';
const REMOVE_GITHUB_PROVIDER_FILENAME = '20261017_000002_remove_github_provider.ts';
+const REQUEST_FAILURE_ATTRIBUTION_FILENAME = '20261017_233153_request_failure_attribution.ts';
interface SchemaRow {
type: string;
@@ -140,6 +141,7 @@ describe('migration round trip', () => {
DECISION_REQUESTS_FILENAME,
LLMTR_REENABLE_KEYS_FILENAME,
REMOVE_GITHUB_PROVIDER_FILENAME,
+ REQUEST_FAILURE_ATTRIBUTION_FILENAME,
]);
} finally {
db.close();
diff --git a/server/src/__tests__/lib/error-classify-provider-moment.test.ts b/server/src/__tests__/lib/error-classify-provider-moment.test.ts
new file mode 100644
index 00000000..a43db439
--- /dev/null
+++ b/server/src/__tests__/lib/error-classify-provider-moment.test.ts
@@ -0,0 +1,87 @@
+import { describe, it, expect } from 'vitest';
+import {
+ isProviderMomentFailure,
+ newClientAbortError,
+} from '../../lib/error-classify.js';
+
+// #1347 (PR 1): the "provider had a bad minute" class. These failures steer
+// the key (existing cooldowns) but, when attribution is enabled, must NOT be
+// counted against the model's reliability — so the boundary of the class is
+// load-bearing and gets its own unit coverage.
+describe('isProviderMomentFailure (#1347 PR 1)', () => {
+ it('classifies a structured 429', () => {
+ expect(isProviderMomentFailure(Object.assign(new Error('API error 429: rate limit exceeded'), { status: 429 })))
+ .toBe(true);
+ });
+
+ it('classifies 5xx statuses as a sick provider', () => {
+ for (const status of [500, 502, 503, 529]) {
+ expect(isProviderMomentFailure(Object.assign(new Error(`API error ${status}`), { status })))
+ .toBe(true);
+ }
+ });
+
+ it('classifies a timeout that carries no structured status', () => {
+ expect(isProviderMomentFailure(new Error('Request timeout: no response from upstream')))
+ .toBe(true);
+ });
+
+ it('classifies a transport failure by code', () => {
+ expect(isProviderMomentFailure(Object.assign(new Error('fetch failed'), { code: 'ECONNRESET' })))
+ .toBe(true);
+ });
+
+ it('classifies a transport failure found in the cause chain', () => {
+ const cause = Object.assign(new Error('socket hang up'), { code: 'ECONNRESET' });
+ expect(isProviderMomentFailure(Object.assign(new Error('fetch failed'), { cause })))
+ .toBe(true);
+ });
+
+ it('classifies a mid-stream truncation (connection reset mid-SSE)', () => {
+ expect(isProviderMomentFailure(new Error('stream ended unexpectedly: no [done], no finish_reason')))
+ .toBe(true);
+ });
+
+ it('classifies rate-limit wording on a status-less response', () => {
+ expect(isProviderMomentFailure(new Error('rate limit exceeded, retry after 60s')))
+ .toBe(true);
+ expect(isProviderMomentFailure(new Error('Too Many Requests')))
+ .toBe(true);
+ });
+
+ it('classifies a degraded deployment wearing a 400', () => {
+ expect(isProviderMomentFailure(Object.assign(new Error('deployment degraded'), { status: 400 })))
+ .toBe(true);
+ });
+
+ it('does NOT classify auth failures (key-scoped)', () => {
+ expect(isProviderMomentFailure(Object.assign(new Error('API error 401: invalid api key'), { status: 401 })))
+ .toBe(false);
+ expect(isProviderMomentFailure(Object.assign(new Error('API error 403: forbidden'), { status: 403 })))
+ .toBe(false);
+ });
+
+ it('does NOT classify quota (402) or model-not-found (404/410)', () => {
+ expect(isProviderMomentFailure(Object.assign(new Error('API error 402: insufficient credits'), { status: 402 })))
+ .toBe(false);
+ expect(isProviderMomentFailure(Object.assign(new Error('API error 404: model not found'), { status: 404 })))
+ .toBe(false);
+ expect(isProviderMomentFailure(Object.assign(new Error('API error 410: model retired'), { status: 410 })))
+ .toBe(false);
+ });
+
+ it('does NOT classify an empty completion or a context-too-large 400', () => {
+ expect(isProviderMomentFailure(new Error('empty completion'))).toBe(false);
+ expect(isProviderMomentFailure(Object.assign(new Error('This model maximum context length is 8192'), { status: 400 })))
+ .toBe(false);
+ });
+
+ it('does NOT classify a client abort', () => {
+ expect(isProviderMomentFailure(newClientAbortError('client disconnected'))).toBe(false);
+ });
+
+ it('does NOT classify a model-scoped 400 (skipModelForRequest)', () => {
+ expect(isProviderMomentFailure(Object.assign(new Error('response_format unsupported'), { status: 400, skipModelForRequest: true })))
+ .toBe(false);
+ });
+});
diff --git a/server/src/__tests__/lib/fallback-loop-provider-moment.test.ts b/server/src/__tests__/lib/fallback-loop-provider-moment.test.ts
new file mode 100644
index 00000000..f538700b
--- /dev/null
+++ b/server/src/__tests__/lib/fallback-loop-provider-moment.test.ts
@@ -0,0 +1,111 @@
+import { describe, it, expect, beforeAll, beforeEach, afterEach, vi } from 'vitest';
+
+// #1347 (PR 1): with provider-moment attribution enabled, a 429 / 5xx /
+// timeout / transport failure still benches the KEY (the cooldown ladder is
+// the steering mechanism) but must NOT touch the model's books — the failure
+// window and the rate-limit/failure penalties. With the feature off (the
+// default) the behaviour is exactly today's.
+
+const { mockCheckKeyHealth } = vi.hoisted(() => ({ mockCheckKeyHealth: vi.fn() }));
+vi.mock('../../services/health.js', () => ({
+ checkKeyHealth: mockCheckKeyHealth,
+ markKeyHealthyFromRequest: vi.fn(),
+}));
+
+import { initDb, getDb } from '../../db/index.js';
+import { newFallbackState, recordRetryableFailure } from '../../lib/fallback-loop.js';
+import { getAllPenalties, isProviderMomentAttributionEnabled, type RouteResult } from '../../services/router.js';
+
+// Distinct keyId AND modelDbId per fake route: the router's penalty map and
+// the cooldown store are module-global, so shared ids would leak state.
+let keySeq = 900000;
+function fakeRoute(overrides: Partial<RouteResult> = {}): RouteResult {
+ const n = ++keySeq;
+ return {
+ provider: {} as any, modelId: 'fake-model', modelDbId: n, apiKey: 'k',
+ keyId: n, platform: 'fake', displayName: 'Fake Model',
+ rpdLimit: null, tpdLimit: null,
+ ...overrides,
+ };
+}
+
+const err429 = () => Object.assign(new Error('API error 429: rate limit exceeded'), { status: 429 });
+const err500 = () => Object.assign(new Error('API error 500: internal error'), { status: 500 });
+const errTimeout = () => new Error('Request timeout: no response from upstream');
+const errBadReq = () => Object.assign(new Error('API error 400: unknown parameter'), { status: 400 });
+
+function penaltyFor(modelDbId: number) {
+ return getAllPenalties().find(p => p.modelDbId === modelDbId);
+}
+
+function cooldownCount(route: RouteResult): number {
+ return (getDb().prepare('SELECT COUNT(*) AS n FROM rate_limit_cooldowns WHERE key_id = ?')
+ .get(route.keyId) as { n: number }).n;
+}
+
+describe('provider-moment attribution in recordRetryableFailure (#1347 PR 1)', () => {
+ beforeAll(() => {
+ process.env.ENCRYPTION_KEY = '0'.repeat(64);
+ initDb(':memory:');
+ });
+
+ beforeEach(() => {
+ mockCheckKeyHealth.mockReset();
+ mockCheckKeyHealth.mockResolvedValue('invalid');
+ getDb().prepare('DELETE FROM rate_limit_cooldowns').run();
+ delete process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION;
+ });
+
+ afterEach(() => {
+ delete process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION;
+ });
+
+ it('feature ON: a 429 benches the key but leaves the model penalty untouched', () => {
+ process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION = '1';
+ expect(isProviderMomentAttributionEnabled()).toBe(true);
+
+ const route = fakeRoute();
+ recordRetryableFailure(route, err429(), newFallbackState());
+
+ expect(penaltyFor(route.modelDbId)).toBeUndefined();
+ expect(cooldownCount(route)).toBe(1);
+ });
+
+ it('feature OFF (default): a 429 still penalizes the model — current behaviour preserved', () => {
+ const route = fakeRoute();
+ recordRetryableFailure(route, err429(), newFallbackState());
+
+ expect(penaltyFor(route.modelDbId)).toBeDefined();
+ expect(penaltyFor(route.modelDbId)!.penalty).toBeGreaterThan(0);
+ });
+
+ it('feature ON: a timeout benches the key but leaves the model penalty untouched', () => {
+ process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION = '1';
+
+ const route = fakeRoute();
+ recordRetryableFailure(route, errTimeout(), newFallbackState());
+
+ expect(penaltyFor(route.modelDbId)).toBeUndefined();
+ expect(cooldownCount(route)).toBe(1);
+ });
+
+ it('feature ON: a 5xx benches the key but leaves the model penalty untouched', () => {
+ process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION = '1';
+
+ const route = fakeRoute();
+ recordRetryableFailure(route, err500(), newFallbackState());
+
+ expect(penaltyFor(route.modelDbId)).toBeUndefined();
+ expect(cooldownCount(route)).toBe(1);
+ });
+
+ it('feature ON: a provider 400 is NOT a provider moment — the model penalty stays', () => {
+ process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION = '1';
+
+ const route = fakeRoute();
+ recordRetryableFailure(route, errBadReq(), newFallbackState());
+
+ expect(penaltyFor(route.modelDbId)).toBeDefined();
+ expect(penaltyFor(route.modelDbId)!.penalty).toBeGreaterThan(0);
+ });
+});
diff --git a/server/src/__tests__/routes/settings-provider-moment-attribution.test.ts b/server/src/__tests__/routes/settings-provider-moment-attribution.test.ts
new file mode 100644
index 00000000..d2451065
--- /dev/null
+++ b/server/src/__tests__/routes/settings-provider-moment-attribution.test.ts
@@ -0,0 +1,85 @@
+import { describe, it, expect, beforeAll, beforeEach, afterEach } from 'vitest';
+import type { Express } from 'express';
+import { createApp } from '../../app.js';
+import { initDb, getDb, getSetting } from '../../db/index.js';
+import { mintDashboardToken } from '../helpers/auth.js';
+import { PROVIDER_MOMENT_ATTRIBUTION_KEY } from '../../services/router.js';
+
+// #1347 (PR 1): GET/PUT /api/settings/provider-moment-attribution — the
+// dashboard toggle for rate-limit-aware failure attribution. Off by default;
+// the ROUTER_PROVIDER_MOMENT_ATTRIBUTION env var pins the behaviour.
+async function request(app: Express, method: string, path: string, body: any, token: string) {
+ const server = app.listen(0, '127.0.0.1');
+ if (!server.listening) await new Promise<void>(resolve => server.once('listening', () => resolve()));
+ const addr = server.address() as any;
+ const res = await fetch(`http://127.0.0.1:${addr.port}${path}`, {
+ method,
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
+ body: body === undefined ? undefined : JSON.stringify(body),
+ });
+ const raw = await res.text();
+ server.close();
+ let json: any = null;
+ try { json = JSON.parse(raw); } catch {}
+ return { status: res.status, body: json };
+}
+
+describe('/api/settings/provider-moment-attribution (#1347 PR 1)', () => {
+ let app: Express;
+ let token: string;
+
+ beforeAll(() => {
+ process.env.ENCRYPTION_KEY = '0'.repeat(64);
+ initDb(':memory:');
+ app = createApp();
+ token = mintDashboardToken();
+ });
+
+ beforeEach(() => {
+ delete process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION;
+ getDb().prepare('DELETE FROM settings WHERE key = ?').run(PROVIDER_MOMENT_ATTRIBUTION_KEY);
+ });
+
+ afterEach(() => {
+ delete process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION;
+ });
+
+ it('reports disabled (off by default) before anything is configured', async () => {
+ const { status, body } = await request(app, 'GET', '/api/settings/provider-moment-attribution', undefined, token);
+ expect(status).toBe(200);
+ expect(body).toEqual({ enabled: false });
+ });
+
+ it('enables and reports the toggle', async () => {
+ const put = await request(app, 'PUT', '/api/settings/provider-moment-attribution', { enabled: true }, token);
+ expect(put.status).toBe(200);
+ expect(put.body).toEqual({ enabled: true });
+ expect(getSetting(PROVIDER_MOMENT_ATTRIBUTION_KEY)).toBe('1');
+
+ const get = await request(app, 'GET', '/api/settings/provider-moment-attribution', undefined, token);
+ expect(get.body).toEqual({ enabled: true });
+ });
+
+ it('disables again and clears the stored setting', async () => {
+ await request(app, 'PUT', '/api/settings/provider-moment-attribution', { enabled: true }, token);
+ const put = await request(app, 'PUT', '/api/settings/provider-moment-attribution', { enabled: false }, token);
+ expect(put.body).toEqual({ enabled: false });
+ expect(getSetting(PROVIDER_MOMENT_ATTRIBUTION_KEY)).toBeUndefined();
+ });
+
+ it('rejects a non-boolean body', async () => {
+ const { status } = await request(app, 'PUT', '/api/settings/provider-moment-attribution', { enabled: 'yes' }, token);
+ expect(status).toBe(400);
+ });
+
+ it('the env var pins the behaviour over the stored setting', async () => {
+ process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION = '1';
+ await request(app, 'PUT', '/api/settings/provider-moment-attribution', { enabled: false }, token);
+ const get = await request(app, 'GET', '/api/settings/provider-moment-attribution', undefined, token);
+ expect(get.body).toEqual({ enabled: true });
+
+ process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION = '0';
+ const put = await request(app, 'PUT', '/api/settings/provider-moment-attribution', { enabled: true }, token);
+ expect(put.body).toEqual({ enabled: false });
+ });
+});
diff --git a/server/src/__tests__/services/router-provider-moment-stats.test.ts b/server/src/__tests__/services/router-provider-moment-stats.test.ts
new file mode 100644
index 00000000..5af1e5fb
--- /dev/null
+++ b/server/src/__tests__/services/router-provider-moment-stats.test.ts
@@ -0,0 +1,74 @@
+import { describe, it, expect, beforeAll, beforeEach } from 'vitest';
+import {
+ getRoutingScores, refreshStatsCache, setProviderMomentAttribution,
+} from '../../services/router.js';
+import { getDb, initDb } from '../../db/index.js';
+import { logRequest } from '../../lib/request-log.js';
+
+// #1347 (PR 1): rows tagged 'provider_moment' are the provider's bad minute,
+// not the model — with attribution ON they drop out of the reliability stats
+// (denominator, failures, timeouts, speed). With it OFF (the default) every
+// row counts and scoring is byte-identical to today.
+function addModel(platform: string, modelId: string): number {
+ const db = getDb();
+ db.prepare(`
+ INSERT INTO models (platform, model_id, display_name, intelligence_rank, speed_rank, size_label, monthly_token_budget, enabled, supports_vision, supports_tools)
+ VALUES (?, ?, ?, 3, 1, 'Large', '~50M', 1, 0, 1)
+ `).run(platform, modelId, modelId.toUpperCase());
+ return (db.prepare('SELECT id FROM models WHERE platform = ? AND model_id = ?').get(platform, modelId) as { id: number }).id;
+}
+
+function scoreFor(modelDbId: number) {
+ return getRoutingScores().scores.find(s => s.modelDbId === modelDbId);
+}
+
+// 1 success, 1 ordinary failure, 1 attributed provider-moment failure —
+// all logged this instant, so the day-0 decay weight is 1 for each.
+function seed() {
+ logRequest('groq', 'test-model', null, 'success', 100, 50, 12, null);
+ logRequest('groq', 'test-model', null, 'error', 30, 0, 9, 'API error 500: boom');
+ logRequest('groq', 'test-model', null, 'error', 30, 0, 9, 'API error 429: rate limit', null, null, null, null, 'provider_moment');
+}
+
+describe('provider-moment rows in the reliability stats (#1347 PR 1)', () => {
+ beforeAll(() => {
+ process.env.ENCRYPTION_KEY = '0'.repeat(64);
+ initDb(':memory:');
+ });
+
+ beforeEach(() => {
+ delete process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION;
+ // Drop our rows only (requests first: they reference the model): the
+ // seeded catalog's fallback_config rows would fail the FK on a blanket
+ // DELETE FROM models.
+ getDb().prepare('DELETE FROM requests').run();
+ const mine = getDb().prepare('SELECT id FROM models WHERE platform = ? AND model_id = ?')
+ .get('groq', 'test-model') as { id: number } | undefined;
+ if (mine) getDb().prepare('DELETE FROM models WHERE id = ?').run(mine.id);
+ setProviderMomentAttribution(false);
+ });
+
+ it('feature OFF (default): every row counts, exactly as today', () => {
+ const id = addModel('groq', 'test-model');
+ seed();
+ refreshStatsCache(getDb(), true);
+
+ const score = scoreFor(id);
+ expect(score).toBeDefined();
+ expect(score!.totalRequests).toBe(3);
+ expect(score!.reliability).toBeLessThan(1);
+ });
+
+ it('feature ON: attributed rows drop out of the model books', () => {
+ const id = addModel('groq', 'test-model');
+ seed();
+ refreshStatsCache(getDb(), true);
+ const off = scoreFor(id);
+
+ setProviderMomentAttribution(true); // force-refreshes the stats cache
+ const on = scoreFor(id);
+
+ expect(on!.totalRequests).toBe(2);
+ expect(on!.reliability).toBeGreaterThan(off!.reliability);
+ });
+});
diff --git a/server/src/db/migrate/defaults.ts b/server/src/db/migrate/defaults.ts
index c5e3c068..b0ed517a 100644
--- a/server/src/db/migrate/defaults.ts
+++ b/server/src/db/migrate/defaults.ts
@@ -42,6 +42,7 @@ import * as searchEngines from '../migrations/20261013_000001_search_engines.js'
import * as decisionRequests from '../migrations/20261016_000001_decision_requests.js';
import * as llmtrReenableKeys from '../migrations/20261017_000001_llmtr_reenable_keys.js';
import * as removeGithubProvider from '../migrations/20261017_000002_remove_github_provider.js';
+import * as requestFailureAttribution from '../migrations/20261017_233153_request_failure_attribution.js';
export interface MigrationModule {
up(db: Db): void;
@@ -96,6 +97,7 @@ export const SEARCH_ENGINES_FILENAME = '20261013_000001_search_engines.ts';
export const DECISION_REQUESTS_FILENAME = '20261016_000001_decision_requests.ts';
export const LLMTR_REENABLE_KEYS_FILENAME = '20261017_000001_llmtr_reenable_keys.ts';
export const REMOVE_GITHUB_PROVIDER_FILENAME = '20261017_000002_remove_github_provider.ts';
+export const REQUEST_FAILURE_ATTRIBUTION_FILENAME = '20261017_233153_request_failure_attribution.ts';
export const DEFAULT_MIGRATIONS: readonly DefaultMigration[] = [
{ filename: LEGACY_BASELINE_FILENAME, module: legacyBaseline },
@@ -141,4 +143,5 @@ export const DEFAULT_MIGRATIONS: readonly DefaultMigration[] = [
{ filename: DECISION_REQUESTS_FILENAME, module: decisionRequests },
{ filename: LLMTR_REENABLE_KEYS_FILENAME, module: llmtrReenableKeys },
{ filename: REMOVE_GITHUB_PROVIDER_FILENAME, module: removeGithubProvider },
+ { filename: REQUEST_FAILURE_ATTRIBUTION_FILENAME, module: requestFailureAttribution },
];
diff --git a/server/src/db/migrations/20261017_233153_request_failure_attribution.ts b/server/src/db/migrations/20261017_233153_request_failure_attribution.ts
new file mode 100644
index 00000000..eb2335fa
--- /dev/null
+++ b/server/src/db/migrations/20261017_233153_request_failure_attribution.ts
@@ -0,0 +1,30 @@
+// Migration: tag provider-moment failures on requests (#1347 PR 1)
+// Created: 2026-10-17
+//
+// DOWN: reversible (DROP COLUMN)
+
+import type { Db } from '../types.js';
+
+function hasColumn(db: Db, table: string, column: string): boolean {
+ const columns = db.prepare(`PRAGMA table_info(${table})`).all() as { name: string }[];
+ return columns.some((candidate) => candidate.name === column);
+}
+
+// #1347 (PR 1): rate-limit-aware failure attribution. A failed attempt whose
+// root cause is a provider moment — a 429, a 5xx, a timeout, a dropped socket
+// — is evidence about the provider's minute, not the model's quality. When
+// the opt-in setting is on, such rows are tagged 'provider_moment' so the
+// routing stats can exclude them from the model-level books. NULL (the
+// default, and every historical row) means "unattributed" and keeps today's
+// scoring behaviour exactly.
+export function up(db: Db): void {
+ if (!hasColumn(db, 'requests', 'failure_attribution')) {
+ db.prepare('ALTER TABLE requests ADD COLUMN failure_attribution TEXT').run();
+ }
+}
+
+export function down(db: Db): void {
+ if (hasColumn(db, 'requests', 'failure_attribution')) {
+ db.prepare('ALTER TABLE requests DROP COLUMN failure_attribution').run();
+ }
+}
diff --git a/server/src/lib/error-classify.ts b/server/src/lib/error-classify.ts
index 898495a5..33a0889b 100644
--- a/server/src/lib/error-classify.ts
+++ b/server/src/lib/error-classify.ts
@@ -414,6 +414,36 @@ export function isProviderLevelError(err: any): boolean {
|| msg.includes('fetch failed'); // undici transport error (DNS/TLS/proxy down)
}
+// #1347 (PR 1): provider-moment failures — the "provider had a bad minute"
+// class: a 429, a 5xx, a degraded deployment, a timeout, a transport drop
+// (including a mid-stream reset / truncated SSE), or rate-limit wording on a
+// response that carried no structured status. This is evidence about the
+// provider's minute, not the model's quality: when failure attribution is
+// enabled such failures still steer the key (the cooldown ladder is
+// untouched) but are excluded from the model-level books — the reliability
+// stats and the failure penalties. Deliberately NOT in this class: auth
+// (401/403), quota (402), model-not-found (404/410), context-too-large,
+// empty completions and model-scoped 400s, which keep their existing
+// key/model-scoped handling.
+export function isProviderMomentFailure(err: any): boolean {
+ // A canceled request (client hang-up, time-budget hedge) is the gateway's
+ // own doing. isTransportError already treats those as non-transport, but
+ // the timeout-marker text check below could still match an abort message.
+ if (isClientAbortError(err) || isHedgeAbortError(err)) return false;
+ if (err?.skipModelForRequest === true) return false;
+ const status = typeof err?.status === 'number' ? err.status : 0;
+ if (status === 429 || status >= 500) return true;
+ if (isProviderDegradedError(err)) return true;
+ if (isTransportError(err)) return true;
+ if (isStreamTruncatedError(err)) return true;
+ const msg = (err?.message ?? '').toLowerCase();
+ if (isTimeoutErrorText(msg)) return true;
+ // Rate-limit wording without a structured status: some gateways answer a
+ // throttled request with a 200/500 body that only says "rate limit".
+ if (status === 0 && (msg.includes('rate limit') || msg.includes('too many requests'))) return true;
+ return false;
+}
+
// #809: kilo's free relay occasionally answers with a bare classification
// word ("safe" / "unsafe") instead of a real reply — an upstream content
// filter, not the requested model. Such a turn is a dead turn: treat it like
diff --git a/server/src/lib/fallback-loop.ts b/server/src/lib/fallback-loop.ts
index eb2bf24e..dbbfc4bd 100644
--- a/server/src/lib/fallback-loop.ts
+++ b/server/src/lib/fallback-loop.ts
@@ -17,7 +17,7 @@ import { nextMonthResetAt } from '../services/key-budget.js';
// the fire-and-forget key revalidation kicked off on an upstream 401 (below).
import type { RouteResult } from '../services/router.js';
-import { recordRateLimitHit, recordModelFailure, recordSuccess, hasOtherUsableKey, routableKeyIdsForModel, formatResetEta } from '../services/router.js';
+import { recordRateLimitHit, recordModelFailure, recordSuccess, hasOtherUsableKey, routableKeyIdsForModel, formatResetEta, isProviderMomentAttributionEnabled } from '../services/router.js';
import { safeHeaderValue } from './header-value.js';
import {
recordRequest,
@@ -47,6 +47,7 @@ import {
isProviderBadRequestError,
isProviderDegradedError,
isProviderLevelError,
+ isProviderMomentFailure,
isContextTooLargeError,
isTimeoutErrorText,
isStreamTruncatedError,
@@ -588,11 +589,20 @@ export function recordRetryableFailure(route: RouteResult, err: any, state: Fall
// different wallet and may well have credits, so only THIS key is out.
benchKeyAcrossPlatform(route, decision.durationMs, decision.source, state, 'is out of credits (402)');
}
- // Model-level failure benching: a model failing across keys (or repeatedly on
- // one key) must sink out of routing instead of being re-picked every request.
- noteModelFailure(route, now);
+ // #1347 (PR 1): a provider-moment failure (429 / 5xx / timeout / transport)
+ // is the provider's bad minute, not model evidence. When attribution is
+ // enabled it still steers the key via the cooldown above, but leaves the
+ // model's books (failure window, penalties) untouched — so one slow minute
+ // stops sinking a healthy model out of routing.
+ const providerMoment = isProviderMomentAttributionEnabled() && isProviderMomentFailure(err);
+ if (!providerMoment) {
+ // Model-level failure benching: a model failing across keys (or repeatedly
+ // on one key) must sink out of routing instead of being re-picked every
+ // request.
+ noteModelFailure(route, now);
+ }
// Model-level penalty only when no sibling key can still serve (#454).
- if (!hasOtherUsableKey(route.modelDbId, route.keyId, state.skipKeys)) {
+ if (!providerMoment && !hasOtherUsableKey(route.modelDbId, route.keyId, state.skipKeys)) {
// Hard limit signals (429/402) carry the heavier demotion; ordinary
// upstream failures (5xx/timeout/empty stream) get a lighter one so the
// model sinks gradually instead of being banished on a single blip.
diff --git a/server/src/lib/request-log.ts b/server/src/lib/request-log.ts
index ca917ddd..029db673 100644
--- a/server/src/lib/request-log.ts
+++ b/server/src/lib/request-log.ts
@@ -106,6 +106,11 @@ export function logRequest(
// without a migration. NULL for call sites that pass no caller — notably
// the shared fallback loop's 'canceled' row, which is surface-agnostic.
caller: string | null = null,
+ // #1347 (PR 1): 'provider_moment' when a failed attempt is attributed to
+ // the provider's minute (429 / 5xx / timeout / transport) instead of the
+ // model — written only when the failure-attribution setting is on; NULL
+ // everywhere else, including every success row and every historical row.
+ failureAttribution: string | null = null,
) {
try {
const db = getDb();
@@ -114,9 +119,9 @@ export function logRequest(
const client = getClientContext();
const tx = db.transaction(() => {
const insert = db.prepare(`
- INSERT INTO requests (platform, model_id, key_id, status, input_tokens, output_tokens, latency_ms, error, ttfb_ms, requested_model, served_model, client_ip, client_user_agent, client_agent, caller, model_db_id)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- `).run(platform, modelId, keyId, status, inputTokens, outputTokens, latencyMs, error, ttfbMs, requestedModel, servedModel, client.ip, client.userAgent, client.agent, caller, resolveModelDbId(db, platform, modelId, keyId));
+ INSERT INTO requests (platform, model_id, key_id, status, input_tokens, output_tokens, latency_ms, error, ttfb_ms, requested_model, served_model, client_ip, client_user_agent, client_agent, caller, model_db_id, failure_attribution)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ `).run(platform, modelId, keyId, status, inputTokens, outputTokens, latencyMs, error, ttfbMs, requestedModel, servedModel, client.ip, client.userAgent, client.agent, caller, resolveModelDbId(db, platform, modelId, keyId), failureAttribution);
// Report the row id back to the fallback loop's attempt trace (if one is
// active): the LAST id noted during a loop run is the terminal row the
diff --git a/server/src/routes/anthropic.ts b/server/src/routes/anthropic.ts
index 43578f49..8084f03b 100644
--- a/server/src/routes/anthropic.ts
+++ b/server/src/routes/anthropic.ts
@@ -9,7 +9,7 @@ import type {
ChatToolChoice,
ChatContentBlock,
} from '@freellmapi/shared/types.js';
-import { routeRequest, resolveModelGroupCandidates, resolveRoutingChain, resolveStickyPreference, routingReserveTokens, type RouteResult, type ResolvedChain, type ChainRow } from '../services/router.js';
+import { routeRequest, resolveModelGroupCandidates, resolveRoutingChain, resolveStickyPreference, routingReserveTokens, failureAttributionFor, type RouteResult, type ResolvedChain, type ChainRow } from '../services/router.js';
import { getSetting, getUnifiedApiKey } from '../db/index.js';
import { contentToString, estimateInputTokens } from '../lib/content.js';
import { routeOutputBudget } from '../lib/output-cap.js';
@@ -794,7 +794,7 @@ export async function handleMessages(req: Request, res: Response): Promise<void>
return 'done';
},
logFailure: (route, err) => {
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, Date.now() - start, sanitizeProviderErrorMessage(err.message), null, pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, Date.now() - start, sanitizeProviderErrorMessage(err.message), null, pinnedModelId, null, 'http', failureAttributionFor(err));
},
onFatal: (route, err, attempt) => {
setFallbackHeaders(res, attempt, attemptLog);
@@ -936,7 +936,7 @@ async function streamCompletion(
if (!messageStarted) throw new Error(`in-band provider error from ${route.displayName}: ${msg}`);
writeSse(res, 'error', { type: 'error', error: { type: 'api_error', message: `Provider error (${route.displayName}): ${sanitizeProviderErrorMessage(String(msg))}` } });
res.end();
- logRequest(route.platform, route.modelId, route.keyId, 'error', ctx.estimatedInputTokens, outputChars, Date.now() - ctx.start, `in-band error frame: ${sanitizeProviderErrorMessage(String(msg))}`, null, ctx.pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', ctx.estimatedInputTokens, outputChars, Date.now() - ctx.start, `in-band error frame: ${sanitizeProviderErrorMessage(String(msg))}`, null, ctx.pinnedModelId, null, 'http', failureAttributionFor({ message: String(msg) }));
throw new StreamAlreadyStarted();
}
@@ -1104,7 +1104,7 @@ async function streamCompletion(
// honestly instead of leaving Claude Code hanging, and stop the retry loop.
writeSse(res, 'error', { type: 'error', error: { type: 'api_error', message: `Provider error (${route.displayName}): stream interrupted` } });
try { res.end(); } catch { /* socket gone */ }
- logRequest(route.platform, route.modelId, route.keyId, 'error', ctx.estimatedInputTokens, outputChars, Date.now() - ctx.start, sanitizeProviderErrorMessage(err.message), null, ctx.pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', ctx.estimatedInputTokens, outputChars, Date.now() - ctx.start, sanitizeProviderErrorMessage(err.message), null, ctx.pinnedModelId, null, 'http', failureAttributionFor(err));
throw new StreamAlreadyStarted();
}
// Headers never sent — bubble to the outer loop for failover.
diff --git a/server/src/routes/models.ts b/server/src/routes/models.ts
index cf839514..38f5f0dd 100644
--- a/server/src/routes/models.ts
+++ b/server/src/routes/models.ts
@@ -18,7 +18,7 @@ import { getActiveProfileId, ensureModelInProfiles } from '../services/profile-m
import { endpointScopeForBaseUrl, endpointScopeOfKey, qualifiedModelMemberId } from '../lib/endpoint-scope.js';
import { clearCustomModelTombstone, recordCustomModelTombstone } from '../services/custom-model-tombstone.js';
import { customModelSeed } from '../services/custom-model-seed.js';
-import { routePinnedModel } from '../services/router.js';
+import { routePinnedModel, failureAttributionFor } from '../services/router.js';
import { logRequest } from '../lib/request-log.js';
import { withKeyProxy } from '../lib/proxy.js';
import { sanitizeProviderErrorMessage } from '../lib/error-redaction.js';
@@ -418,7 +418,7 @@ modelsRouter.post('/:id/test', async (req: Request, res: Response) => {
const latencyMs = Date.now() - startTime;
const error = sanitizeProviderErrorMessage(err instanceof Error ? err.message : String(err));
logRequest(route.platform, route.modelId, route.keyId, 'error', 0, 0,
- latencyMs, error, null, route.modelId, null, 'model-test');
+ latencyMs, error, null, route.modelId, null, 'model-test', failureAttributionFor(err));
res.json({ success: false, modelId: route.modelId, latencyMs, error });
} finally {
route.release?.();
diff --git a/server/src/routes/proxy.ts b/server/src/routes/proxy.ts
index d06b3520..d9276037 100644
--- a/server/src/routes/proxy.ts
+++ b/server/src/routes/proxy.ts
@@ -3,7 +3,7 @@ import { Router } from 'express';
import type { Request, Response } from 'express';
import { z } from 'zod';
import type { ChatMessage, ChatToolCall, TokenUsage } from '@freellmapi/shared/types.js';
-import { type RouteResult, type ResolvedChain, type ChainRow, routeRequest, resolveRoutingChain, resolveModelGroupCandidates, resolveStickyPreference, hasEnabledVisionModel, hasEnabledToolsModel, routingReserveTokens } from '../services/router.js';
+import { type RouteResult, type ResolvedChain, type ChainRow, routeRequest, resolveRoutingChain, resolveModelGroupCandidates, resolveStickyPreference, hasEnabledVisionModel, hasEnabledToolsModel, routingReserveTokens, failureAttributionFor } from '../services/router.js';
import { secondsUntilNextMonth } from '../services/key-budget.js';
import { runEmbeddings, EmbeddingsError } from '../services/embeddings.js';
import { runRerank, RerankError, rerankRetryAfterSec } from '../services/rerank.js';
@@ -1519,7 +1519,7 @@ proxyRouter.post('/completions', async (req: Request, res: Response) => {
latencyMs: Date.now() - start,
error: sanitizeProviderErrorMessage(streamErr.message),
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, totalOutputTokens, Date.now() - start, sanitizeProviderErrorMessage(streamErr.message), ttfbMs, pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, totalOutputTokens, Date.now() - start, sanitizeProviderErrorMessage(streamErr.message), ttfbMs, pinnedModelId, null, 'http', failureAttributionFor(streamErr));
return 'committed';
}
throw streamErr;
@@ -1614,7 +1614,7 @@ proxyRouter.post('/completions', async (req: Request, res: Response) => {
latencyMs: latency,
error: safeError,
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, latency, safeError, null, pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, latency, safeError, null, pinnedModelId, null, 'http', failureAttributionFor(err));
},
onFatal: (route, err, attempt) => {
setFallbackHeaders(res, attempt, attemptLog);
@@ -2481,7 +2481,7 @@ proxyRouter.post('/chat/completions', async (req: Request, res: Response) => {
latencyMs: Date.now() - start,
error: sanitizeProviderErrorMessage(String(msg)),
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, totalOutputTokens, Date.now() - start, `in-band error frame: ${sanitizeProviderErrorMessage(String(msg))}`, ttfbMs, pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, totalOutputTokens, Date.now() - start, `in-band error frame: ${sanitizeProviderErrorMessage(String(msg))}`, ttfbMs, pinnedModelId, null, 'http', failureAttributionFor({ message: String(msg) }));
return 'committed';
}
@@ -2814,7 +2814,7 @@ proxyRouter.post('/chat/completions', async (req: Request, res: Response) => {
latencyMs: Date.now() - start,
error: sanitizeProviderErrorMessage(streamErr.message),
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, totalOutputTokens, Date.now() - start, sanitizeProviderErrorMessage(streamErr.message), ttfbMs, pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, totalOutputTokens, Date.now() - start, sanitizeProviderErrorMessage(streamErr.message), ttfbMs, pinnedModelId, null, 'http', failureAttributionFor(streamErr));
return 'committed';
}
// Headers never sent — bubble to the shared loop, which cooldowns this
@@ -3061,7 +3061,7 @@ proxyRouter.post('/chat/completions', async (req: Request, res: Response) => {
latencyMs: latency,
error: safeError,
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, latency, safeError, null, pinnedModelId, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, latency, safeError, null, pinnedModelId, null, 'http', failureAttributionFor(err));
},
onFatal: (route, err, attempt) => {
// Non-retryable error (bare 4xx, etc.): don't retry.
diff --git a/server/src/routes/responses.ts b/server/src/routes/responses.ts
index 710dac2f..b15cc2e9 100644
--- a/server/src/routes/responses.ts
+++ b/server/src/routes/responses.ts
@@ -9,7 +9,7 @@ import type {
ChatToolChoice,
Platform,
} from '@freellmapi/shared/types.js';
-import { routeRequest, hasEnabledVisionModel, hasEnabledToolsModel, resolveStickyPreference, routingReserveTokens, resolveModelGroupCandidates, resolveRoutingChain, type RouteResult, type ResolvedChain, type ChainRow } from '../services/router.js';
+import { routeRequest, hasEnabledVisionModel, hasEnabledToolsModel, resolveStickyPreference, routingReserveTokens, resolveModelGroupCandidates, resolveRoutingChain, failureAttributionFor, type RouteResult, type ResolvedChain, type ChainRow } from '../services/router.js';
import { getDb } from '../db/index.js';
import { resolveAuth, prependSystemPrompt } from '../lib/system-prompt.js';
import { isUnifyEnabled, getModelGroups, resolveRequestedIdForDispatch } from '../services/model-groups.js';
@@ -1499,7 +1499,7 @@ export async function handleResponses(req: Request, res: Response): Promise<void
latencyMs: Date.now() - start,
error: safe,
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, Date.now() - start, safe, ttfbMs, null, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, Date.now() - start, safe, ttfbMs, null, null, 'http', failureAttributionFor(streamErr));
sse('response.failed', { response: { id: responseId, object: 'response', status: 'failed', error: { message: `Provider error (${route.displayName}): stream interrupted`, type: 'stream_error' } } });
res.end();
return 'committed';
@@ -1624,7 +1624,7 @@ export async function handleResponses(req: Request, res: Response): Promise<void
latencyMs: latency,
error: safeError,
});
- logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, latency, safeError, null, null, null, 'http');
+ logRequest(route.platform, route.modelId, route.keyId, 'error', estimatedInputTokens, 0, latency, safeError, null, null, null, 'http', failureAttributionFor(err));
},
onFatal: (route, err, attempt) => {
setFallbackHeaders(res, attempt, attemptLog);
diff --git a/server/src/routes/settings.ts b/server/src/routes/settings.ts
index 74b70467..1fd6d88e 100644
--- a/server/src/routes/settings.ts
+++ b/server/src/routes/settings.ts
@@ -24,7 +24,7 @@ import {
getCompressionConfig,
setCompressionConfig,
} from '../services/compression/config.js';
-import { getHeadroomThresholds, setHeadroomThresholds, getTaskWeightShare, setTaskWeightShare, getMinReliabilityFloor, setMinReliabilityFloor } from '../services/router.js';
+import { getHeadroomThresholds, setHeadroomThresholds, getTaskWeightShare, setTaskWeightShare, getMinReliabilityFloor, setMinReliabilityFloor, isProviderMomentAttributionEnabled, setProviderMomentAttribution } from '../services/router.js';
import { MCP_ENABLED_SETTING, isMcpServerEnabled } from './mcp.js';
import { z } from 'zod';
import { getAppVersion } from '../lib/app-version.js';
@@ -428,6 +428,30 @@ settingsRouter.put('/min-reliability-floor', (req: Request, res: Response) => {
}
});
+// Provider-moment failure attribution (opt-in, #1347): tag 429 / 5xx /
+// timeout / transport failures as the provider's bad minute so they steer the
+// key without counting against the model's reliability. Off by default; the
+// ROUTER_PROVIDER_MOMENT_ATTRIBUTION env var pins the behaviour when set.
+settingsRouter.get('/provider-moment-attribution', (_req: Request, res: Response) => {
+ res.json({ enabled: isProviderMomentAttributionEnabled() });
+});
+
+const providerMomentAttributionPutSchema = z.object({
+ enabled: z.boolean(),
+});
+
+// Update the failure-attribution toggle. Takes effect immediately — the
+// setter force-refreshes the stats cache that bakes the filter in.
+settingsRouter.put('/provider-moment-attribution', (req: Request, res: Response) => {
+ const parsed = providerMomentAttributionPutSchema.safeParse(req.body);
+ if (!parsed.success) {
+ res.status(400).json({ error: { message: 'Invalid provider-moment-attribution: send {"enabled": true|false}', type: 'invalid_request_error' } });
+ return;
+ }
+ setProviderMomentAttribution(parsed.data.enabled);
+ res.json({ enabled: isProviderMomentAttributionEnabled() });
+});
+
// Update the guardrails. Partial: send just the knob you want to change.
// Takes effect on the next request — no restart needed. 0 disables a knob.
settingsRouter.put('/guardrails', (req: Request, res: Response) => {
diff --git a/server/src/services/router.ts b/server/src/services/router.ts
index 57581f9f..12b3af60 100644
--- a/server/src/services/router.ts
+++ b/server/src/services/router.ts
@@ -26,7 +26,7 @@ import {
observedSpeedRank, TIMEOUT_LATENCY_CAP_MS,
type HeadroomThresholds,
} from './scoring.js';
-import { TIMEOUT_ERROR_MARKERS } from '../lib/error-classify.js';
+import { TIMEOUT_ERROR_MARKERS, isProviderMomentFailure } from '../lib/error-classify.js';
import { checkMonthlyBudget, reserveMonthlyBudget } from './key-budget.js';
import { applyModelWeightOverride, getModelWeightOverrides } from './model-weight-overrides.js';
import { modelsWithOverriddenField, getCatalogModelTombstone } from './model-state.js';
@@ -435,6 +435,45 @@ export function setMinReliabilityFloor(floor?: number | null): void {
setSetting(MIN_RELIABILITY_FLOOR_KEY, String(floor));
}
+// ── Provider-moment failure attribution (opt-in, #1347) ────────────────────
+// When on, a failed attempt whose cause is a provider moment (429 / 5xx /
+// timeout / transport) is tagged `failure_attribution = 'provider_moment'`
+// instead of being scored as model evidence: it still steers the key (the
+// cooldown ladder is untouched), but it drops out of the reliability stats
+// and the model-level failure penalties. Off by default, so existing
+// installs keep the exact current scoring. The env var wins over the
+// dashboard setting so a self-host can pin the behaviour without the UI.
+export const PROVIDER_MOMENT_ATTRIBUTION_KEY = 'routing_provider_moment_attribution';
+
+export function isProviderMomentAttributionEnabled(): boolean {
+ const env = process.env.ROUTER_PROVIDER_MOMENT_ATTRIBUTION;
+ if (env !== undefined && env.trim() !== '') {
+ const v = env.trim().toLowerCase();
+ if (v === '1' || v === 'true' || v === 'on') return true;
+ if (v === '0' || v === 'false' || v === 'off') return false;
+ }
+ return getSetting(PROVIDER_MOMENT_ATTRIBUTION_KEY) === '1';
+}
+
+export function setProviderMomentAttribution(enabled: boolean): void {
+ if (enabled) {
+ setSetting(PROVIDER_MOMENT_ATTRIBUTION_KEY, '1');
+ } else {
+ getDb().prepare('DELETE FROM settings WHERE key = ?').run(PROVIDER_MOMENT_ATTRIBUTION_KEY);
+ }
+ // The stats cache bakes the attribution filter into its SQL, so a toggle
+ // must not wait for the cache TTL to change routing.
+ refreshStatsCache(getDb(), true);
+}
+
+// The failure_attribution value for one attempt error, or null when the
+// feature is off or the error is not a provider-moment failure. Route call
+// sites pass this straight through to logRequest.
+export function failureAttributionFor(err: any): string | null {
+ if (!isProviderMomentAttributionEnabled()) return null;
+ return isProviderMomentFailure(err) ? 'provider_moment' : null;
+}
+
// ── Task-type weight share (persisted) ─────────────────────────────────────
// #1127 follow-up: the bandit bias applied for a declared/derived task type
// moves `share` of one axis onto the other (code: speed → intelligence; chat:
@@ -805,6 +844,13 @@ export function refreshStatsCache(db: Db, force = false): void {
// count × ≤7 day buckets — so the finer grain keeps the same one-query,
// 60s-cached shape. Aggregated two ways below: rolled up per model (ordering)
// and per key (in-model key selection, #580).
+ // #1347 (PR 1): with provider-moment attribution on, tagged rows are the
+ // provider's bad minute, not the model — keep them out of every aggregate
+ // here (reliability denominator, timeouts, speed) exactly like 'canceled'
+ // rows are kept out today.
+ const pmExcluded = isProviderMomentAttributionEnabled()
+ ? " AND (failure_attribution IS NULL OR failure_attribution <> 'provider_moment')"
+ : '';
const buckets = db.prepare(`
SELECT platform, model_id, key_id,
CAST((julianday('now') - julianday(created_at)) AS INTEGER) AS age_days,
@@ -817,7 +863,7 @@ export function refreshStatsCache(db: Db, force = false): void {
SUM(CASE WHEN ${IS_TIMEOUT_SQL} THEN 1 ELSE 0 END) AS timeouts,
SUM(CASE WHEN ${IS_TIMEOUT_SQL} THEN MIN(MAX(latency_ms, 0), ${TIMEOUT_LATENCY_CAP_MS}) ELSE 0 END) AS timeout_lat
FROM requests
- WHERE created_at >= ? AND status <> 'canceled'
+ WHERE created_at >= ? AND status <> 'canceled'${pmExcluded}
GROUP BY platform, model_id, key_id, age_days
`).all(since) as Array<{
platform: string; model_id: string; key_id: number | null; age_days: number; total: number; successes: number;