Your AI App Works — Until Your Provider Goes Down. Then What?
You built the agent. You shipped the chatbot. It’s handling thousands of requests. Then at 2 AM, your LLM provider goes down.
Your system doesn’t crash — you have a fallback. OpenAI picks up where Anthropic left off. Nobody notices.
But the next morning, your compliance team asks: “Which provider served which request? Can you prove this log hasn’t been tampered with?”
And you realize — you have log files. Maybe. With no guarantees they haven’t been edited, rotated, or lost.
The Problem Nobody Talks About
Most AI frameworks solve the “make it work” problem. Call an LLM, parse the response, maybe add some tools. That’s the easy part.
The hard part is what happens after launch:
- Provider A goes down — does your system automatically switch to B? Does it switch back?
- A circuit breaker trips — do you know why? Can you trace the exact moment?
- A customer disputes a response — can you prove which model generated it, and that your records haven’t been altered?
- An auditor asks for your AI decision log — is it tamper-proof?
These aren’t hypothetical questions. If you’re running AI in finance, healthcare, legal, or any regulated industry, they’re requirements.
What We Built
ElsiumAI is a TypeScript framework for AI systems you can trust in production. It has three pillars: Reliability, Governance, and Reproducibility.
Here’s what that looks like in practice.
Multi-Provider Failover with Audit Trail
import { createAuditTrail, createProviderMesh } from 'elsium-ai'
// Hash-chained audit trail — every event linked by SHA-256
const audit = createAuditTrail({ hashChain: true })
// Provider mesh — automatic failover across providers
const mesh = createProviderMesh({
providers: [
{ name: 'anthropic', config: { apiKey: ANTHROPIC_KEY }, model: 'claude-haiku-4-5-20251001' },
{ name: 'openai', config: { apiKey: OPENAI_KEY }, model: 'gpt-4o-mini' },
{ name: 'google', config: { apiKey: GOOGLE_KEY }, model: 'gemini-2.0-flash' },
],
strategy: 'fallback',
circuitBreaker: { failureThreshold: 3 },
audit, // <- every failover becomes a tamper-proof audit entry
})
const response = await mesh.complete({
messages: [{ role: 'user', content: 'Analyze this contract...' }],
})
That’s it. Three lines of configuration. When Anthropic fails, the mesh switches to OpenAI automatically. The circuit breaker prevents hammering a dead provider. And every decision — every switch, every trip, every recovery — gets recorded in a hash-chained audit trail.
What the Audit Trail Captures
Event #1: llm_call → anthropic (timeout, 5000ms)
hash: a3f8c2... prev: 000000... (genesis)
Event #2: provider_failover → anthropic → openai (reason: timeout)
hash: 7b21e9... prev: a3f8c2...
Event #3: circuit_breaker_state_change → anthropic (closed → open)
hash: d4f0a1... prev: 7b21e9...
Event #4: llm_call → openai (success, 290ms)
hash: 92c5b8... prev: d4f0a1...
Each event’s SHA-256 hash includes the previous event’s hash. Delete or modify any entry, and every subsequent hash breaks. You can verify the entire chain in one call:
const integrity = await audit.verifyIntegrity()
// { valid: true, totalEvents: 4, chainComplete: true }
“But Does It Scale?”
We benchmarked this on real hardware. Here’s what the audit trail handles:
| Metric | Result |
|---|---|
| Throughput | 1.1M events/sec with SHA-256 hash chain |
| Per-event cost | 0.9 microseconds |
| Batched mode | 1.3x faster hot path (zero hashing on critical path) |
| Memory | Bounded — ring buffer with O(1) FIFO eviction |
| Under pressure | 5K requests at 20% failure rate → 7K audit events, all tamper-proof |
The hash chain adds sub-microsecond overhead. Your LLM call takes 300ms. The audit entry takes 0.0009ms. That’s 0.0003% of the request time.
For even less overhead, batched mode buffers events without hashing on the hot path — the SHA-256 computation happens asynchronously on flush. The critical path never blocks.
Beyond Failover
The audit trail is one piece. Here’s what else ships out of the box:
Reliability
- Circuit breakers, bulkhead isolation, request dedup
- Stream failover — switch providers mid-stream without dropping content
- Graceful shutdown with in-flight request draining
Governance
- Policy engine with model access, token limits, cost caps
- Approval gates — require human sign-off before dangerous tool calls
- PII detection and secret redaction in prompts
- Role-based access control
Reproducibility
- Seed propagation and output pinning
- Determinism assertions for testing
- Record/replay for zero-cost regression testing
- Provenance tracking — trace every output to its inputs
Observability
- Distributed tracing with W3C trace context
- Cost intelligence with budget alerts and model suggestions
- OpenTelemetry export
- A/B experiment framework
All of this in one npm install:
npm install elsium-ai
Who This Is For
ElsiumAI is for teams that are past the prototype phase. You’ve built the AI feature. It works. Now you need it to work reliably, accountably, and reproducibly in production.
- Startups shipping AI features that need to be production-grade from day one
- Enterprise teams with compliance requirements (SOC 2, HIPAA, FedRAMP)
- Platform teams building multi-tenant AI infrastructure
- Anyone tired of gluing together 15 libraries for what should be one framework
Try It
npm install elsium-ai
import { gateway, defineAgent } from 'elsium-ai'
const llm = gateway({
provider: 'anthropic',
model: 'claude-sonnet-4-6',
apiKey: process.env.ANTHROPIC_API_KEY,
})
const agent = defineAgent(
{ name: 'assistant', system: 'You are a helpful assistant.' },
{ complete: (req) => llm.complete(req) },
)
const result = await agent.run('What is TypeScript?')
console.log(result.message.content)
1,494 tests passing. 77 KB bundle. Zero lock-in — swap providers with one line.
GitHub: github.com/elsium-ai/elsium-ai
Every AI framework helps you call an LLM. ElsiumAI helps you trust the result.
Eric Utrera
Creator of ElsiumAI. Building production AI infrastructure.