Maestro AI: A Router That Stops Overpaying for LLM Calls
Maestro AI routes each LLM call in Cursor and Claude Code to the cheapest capable model, escalating to premium tiers only when task complexity demands it.
Maestro AI is a harness-agnostic routing layer built to sit between coding agents like Cursor and Claude Code and the mix of local and hosted LLMs they call. Instead of pinning an entire session to one premium model, it classifies each subtask with deterministic heuristics — keywords, context size, tool presence — and sends simple jobs (HTML demos, summaries) to local models like Llama, mid-complexity refactors to hosted Qwen Coder, and genuine architecture or multi-step reasoning to Claude Sonnet.
The more interesting engineering is what happens after a call: a quality-check loop verifies the response isn't empty, isn't a refusal, matches requested JSON schemas, and actually contains visible content (catching subtle failures like whitespace-only or unparsed reasoning fields) before deciding whether to retry or escalate to a stronger tier. Fallbacks are infrastructure-aware too — if a hosted proxy dies, routing drops to a local model within the same quality tier rather than jumping to premium or degrading to a weaker tier. Session-level budgets and max-tier caps prevent long agent conversations from silently accumulating premium-model costs.
Shipped as the maestro-ai npm package with a CLI, MCP server, and programmatic API, the project's core lesson for engineers is that per-call model routing — not per-chat model picking — is what actually controls both cost and quality in agentic coding workflows.