Smart Router Configuration & Cost Failover: Claude Haiku 5.5 (anthropic/claude-haiku-5.5) to Microsoft MAI Code 2 Flash (microsoft/mai-code-2-flash)
Production LLM API routing configuration, TTFT latency SLA (<400ms), and contribution margin failover benchmark generated by TokenMargin.dev.
1. Pricing & Latency Benchmark Summary
- Primary Model (Claude Haiku 5.5 — anthropic/claude-haiku-5.5): $0.10 / 1M input tokens, $0.50 / 1M output tokens | TTFT: 210ms | Throughput: 155 tok/s
- Fallback Model (Microsoft MAI Code 2 Flash — microsoft/mai-code-2-flash): $0.05 / 1M input tokens, $0.25 / 1M output tokens | TTFT: 95ms | Throughput: 260 tok/s
2. Zero-Dependency TypeScript / Node.js Smart Router Configuration
export const SMART_ROUTER_CONFIG = {
slaMaxTtftMs: 400,
primary: { model: "anthropic/claude-haiku-5.5", inputPer1M: 0.10, outputPer1M: 0.50 },
fallback: { model: "microsoft/mai-code-2-flash", inputPer1M: 0.05, outputPer1M: 0.25 },
retryOnStatus: [429, 500, 502, 503, 529]
};
3. LiteLLM / OpenRouter YAML Router Configuration (config.yaml)
model_list:
- model_name: production-primary
litellm_params:
model: openrouter/anthropic/claude-haiku-5.5
timeout: 15
- model_name: cost-fallback
litellm_params:
model: openrouter/microsoft/mai-code-2-flash
router_settings:
routing_strategy: latency-based-routing
fallbacks: [{"production-primary": ["cost-fallback"]}]
⚡ Ready for Production Deployment?
Download Full Production TypeScript Failover Gateway + CI Token Guardrails
Includes zero-dependency circuit-breaker router, Redis semantic cache docker-compose & CFO board audit spreadsheet.