Lab / ai-provider-fallback-harness

AI Provider Fallback Harness

A test rig that simulates provider failures — timeouts, rate limits, malformed responses — to verify transparent failover across LLM backends.

Node.jsTypeScriptLLM APIs

What it tests

A single AI provider in the request path is a single point of failure. Failover code written against happy-path traffic is untested code.

How it works

The harness fronts two providers with a fault injector: artificial latency, HTTP 429 bursts, truncated streams and invalid JSON. It asserts the caller always gets an answer, in bounded time, from whichever backend is healthy.

Every failover is logged with the reason, so an outage window reads as a timeline instead of a mystery.

What came out of it

The fallback layer running behind Kilele Archade's AI tutor was hardened here — same prompt, different backend, no student-facing error. The fault-injection pattern generalises to any multi-provider integration.