🤖 AI Hot

OpenSquilla: Cut AI Costs 10x With Smart Model Routing

A
Alex Chen

Most developers I talk to are burning money on LLM API calls without realizing it. They send every prompt to Claude Sonnet or GPT-5 — whether the user is asking about quantum physics or just wants the weather. The model doesn’t care. The billing meter does.

OpenSquilla tackles this with a simple idea: a local model router that picks the cheapest model capable of handling each request. No config files. No manual routing rules. You send a prompt, the router classifies it, and routes it to the right tier.

I spent a few hours with the codebase and the SDK.

The cost problem nobody talks about

Here are some rough numbers. Say your app handles 10,000 user prompts per day. Average response length: 800 tokens output, 200 tokens input.

If everything goes to Claude Sonnet 4 at $3/$15 per million input/output tokens: roughly $126/day on output alone. That’s $3,780/month. For an app that might be answering “what’s the capital of France” half the time.

Now imagine 60% of those prompts are simple enough for Haiku ($0.80/$4 per million) or GPT-4o-mini ($0.15/$0.60 per million). Your bill drops by 70-90% for those queries. That’s not pocket change — it’s the difference between a sustainable product and one that bleeds cash before finding PMF.

The problem is that most developers don’t want to build and maintain a routing layer. It’s tedious infrastructure work that has nothing to do with their product. Enter OpenSquilla.

How the local model router works

The router runs through four steps per turn:

  1. Task classification. The router analyzes the prompt and bins it into categories: simple Q&A, factual lookup, code generation, complex reasoning, creative writing, math, etc.
  2. Capability mapping. Each configured model gets tagged with which task types it handles well. Haiku can do Q&A. It shouldn’t be doing research-level math.
  3. Cost ranking. Within each capability tier, models get sorted by cost per token.
  4. Selection. The cheapest model that can handle the task gets the prompt.

The router runs locally — it’s not making an extra API call to decide which API to call. That would defeat the purpose.

The default behavior requires zero configuration. You point it at a provider and set model: "auto". The rest happens invisibly:

from opensquilla_wrap import OpenSquillaAgent

agent = OpenSquillaAgent(
    provider="openrouter",
    model="auto",  # local router picks cheapest capable model
    web_search=True,
)

result = agent.run("What's the latest news about AI coding agents?")

Simple query → cheap model. Done.

You can also pin specific models when you know what you need:

agent = OpenSquillaAgent(
    provider="openrouter",
    model="anthropic/claude-sonnet-4-20250514",
    memory_type="layered_sandbox",
)

The architecture: microkernel + sandbox

OpenSquilla isn’t just a router. It’s a full AI agent framework built around a microkernel architecture:

  • Thin core. The central turn loop handles tool dispatch, retries, and decision logging. Every entry point — Web UI, CLI, chat channels — goes through the same loop. This means behavior is consistent regardless of how you interact with it.
  • Layered sandbox. Persistent memory across sessions. Context doesn’t reset every time you switch from CLI to Web UI.
  • Built-in web search. Integrated search without depending on external APIs like SerpAPI or Bing.
  • On-device embeddings. For semantic search and retrieval, running locally.

The pluggable provider layer supports 20+ LLM providers out of the box: OpenRouter, OpenAI, Anthropic, Ollama, DeepSeek, Gemini, Qwen/DashScope, and more. Adding a new provider doesn’t require schema changes.

Who should use this

Developers building AI-powered products on a budget. If you’re running an app that handles a mix of simple and complex queries, the router alone can cut your API costs by 5-10x without degrading user experience.

Teams running internal AI tools. Internal chatbots, documentation search, code review assistants — these workloads have massive variance in complexity. A router means you’re not paying Claude Sonnet prices for “where’s the PTO request form?”

Developers who want a batteries-included agent framework. The microkernel architecture with built-in memory, web search, and embeddings means less time wiring together LangChain components.

Anyone evaluating multiple LLM providers. The pluggable provider layer makes A/B testing providers trivial. Swap from OpenAI to DeepSeek by changing one config field.

Who should NOT use this

Teams with compliance requirements that mandate a single provider. If your SOC 2 or HIPAA requirements lock you into a specific model, the routing benefit is limited. You can still use the agent framework, but the cost savings won’t materialize.

Low-volume users. If you’re making 50 API calls a day, the savings from routing might be $2-3/month. Not worth adding another dependency.

Teams that need fine-grained prompt control per model. The router abstracts away which model handles which request. If you need to craft model-specific system prompts for every interaction, this abstraction works against you.

Comparison with alternatives

OpenSquilla isn’t the only game in town for LLM routing. Here’s how it stacks up:

SolutionRouting StrategySelf-HostedProvider SupportBuilt-in Agent Framework
OpenSquillaLocal model router (cost-optimized)Yes20+Yes (microkernel)
LiteLLMConfig-based routing + load balancingYes100+No (proxy only)
PortkeyCloud gateway with routing rulesNo (SaaS)200+Limited (guardrails)
OpenRouter (direct)Manual model selectionNo (SaaS)250+No
MartianModel router as a serviceNo (SaaS)~15No

LiteLLM is the closest competitor. It’s more mature, supports more providers, and has extensive load-balancing features. But it’s a proxy — you need to run it as a separate service. OpenSquilla embeds the router directly in your process.

Portkey and Martian are SaaS solutions. Convenient but you’re adding another vendor dependency and another point of failure. Also, they see all your prompts.

OpenRouter alone gives you access to 250+ models but leaves routing decisions to you. OpenSquilla layers intelligence on top of it.

Setting it up

Installation is straightforward:

# Python
pip install opensquilla-wrap

# TypeScript
npm install opensquilla-wrap

Multi-provider setup with custom routing strategy:

from opensquilla_wrap import OpenSquillaAgent, ProviderConfig

config = ProviderConfig(
    openrouter={"api_key_env": "OPENROUTER_API_KEY"},
    deepseek={"api_key_env": "DEEPSEEK_API_KEY"},
    ollama={"base_url": "http://localhost:11434"},
)

agent = OpenSquillaAgent(
    providers=config,
    default_provider="openrouter",
    router_strategy="cheapest_capable",
)

# Override routing for specific tasks
result = agent.run(
    "Explain quantum computing",
    provider="deepseek",
    model="deepseek-chat",
)

The TypeScript SDK also supports streaming:

import { OpenSquillaAgent } from 'opensquilla-wrap';

const agent = new OpenSquillaAgent({
  provider: 'openrouter',
  model: 'auto',
});

for await (const chunk of agent.runStream('Explain how transformers work')) {
  process.stdout.write(chunk);
}

Real-world cost impact

Let’s be concrete. Here’s a realistic scenario:

A customer support chatbot handles 50,000 turns per month. Without routing, everything goes to GPT-4o at $2.50/$10 per million tokens. Monthly bill: roughly $450.

With OpenSquilla routing:

  • 40% simple queries (FAQs, order status) → GPT-4o-mini at $0.15/$0.60: ~$12/month
  • 35% moderate queries (product questions) → Claude Haiku at $0.80/$4: ~$84/month
  • 15% complex queries (troubleshooting) → GPT-4o at $2.50/$10: ~$85/month
  • 10% very complex (escalations) → Claude Sonnet at $3/$15: ~$83/month

Total: ~$264/month. That’s a 41% reduction. And the user experience doesn’t change — the complex stuff still gets premium models, the simple stuff doesn’t need them.

If you’re using Claude Opus ($15/$75 per million) for everything and route 70% to cheaper models, savings can exceed 80%.

When the router gets it wrong

The router isn’t magic. It makes classification mistakes. Here are the failure modes I’ve seen:

Under-classification. A prompt that looks simple (“explain quantum entanglement”) gets classified as basic Q&A and routed to Haiku. Haiku gives a Wikipedia-level answer. The user wanted a graduate-level explanation. The quality degrades silently.

Over-classification. “What’s 2+2?” somehow gets classified as complex reasoning and sent to Sonnet. You pay premium prices for trivial work. The cost savings evaporate on that turn. This is less common than under-classification but still happens.

Domain-specific blindness. The classifier’s training data shapes what it considers “complex.” A prompt about a niche programming language might get routed to a cheap model because the classifier doesn’t recognize it as a code generation task. Ditto for specialized scientific domains.

The mitigation for all of these is the same: you can override routing per-request. If you know a prompt is complex, explicitly set the model:

result = agent.run(
    "Explain the implications of the Riemann Hypothesis for modern cryptography",
    provider="openrouter",
    model="anthropic/claude-sonnet-4-20250514",
)

This bypasses the router entirely. The cost optimization kicks in for the 80% of prompts you don’t need to think about, and you maintain control for the 20% where quality matters more than cost.

Task routing for multi-turn conversations. The router classifies each turn independently. If turn 1 is a simple question (→ Haiku) and turn 3 is a complex follow-up (→ Sonnet), the model switches mid-conversation. Context carries over, but the “personality” might shift between models. Some users notice. Most don’t.

Limitations and caveats

Router accuracy is probabilistic, not perfect. The task classifier will occasionally route a complex query to a cheap model that can’t handle it well. The framework includes retry logic, but edge cases exist.

You’re adding a dependency. OpenSquilla is relatively new (the wrapper SDK was published June 2026). The core project has more history, but the ecosystem is smaller than LiteLLM’s. If it stops being maintained, you’re migrating your routing layer.

The cost savings assume usage patterns with high variance. If all your prompts are complex reasoning tasks, the router will send everything to premium models and you save nothing. The savings come from the mix.

Latency overhead. The local classification step adds 50-200ms per turn. For real-time applications, this may matter. For most use cases, it’s negligible compared to the LLM response time.

Not a drop-in replacement for existing agent frameworks. If you’re deep into LangChain or LlamaIndex, migrating to OpenSquilla’s agent framework is a non-trivial refactor. You can use just the router component, but you lose the integrated memory and sandbox features.

The bottom line

OpenSquilla addresses a real pain point. Most teams I’ve worked with don’t think about per-token costs until the bill arrives. By then, they’ve been overpaying for months.

The local model router is the right architectural choice — no extra API calls to decide routing, no vendor lock-in, no third party seeing every prompt. Combined with the microkernel agent architecture, it’s a solid foundation for building cost-efficient AI applications.

Is it production-ready for mission-critical workloads? I’d give it a few more months of community adoption before betting the farm. But for internal tools, side projects, and cost-sensitive applications, it’s worth trying today.

The project is Apache 2.0 licensed. The worst case: you try it, it doesn’t fit, you’re out an afternoon. The best case: you cut your API bill in half without touching your product code.

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen