Skip to content
All writing

LLM orchestration · October 5, 2026 · 6 min

The model is a dependency, not the architecture

Models change every quarter. If swapping one means rewriting your workflows, you built a demo. How I think about routing layers.

There is a particular kind of codebase I have learned to recognize on sight. The model name is hard-coded in forty places. The prompts assume one provider's quirks. The tool-calling format is that provider's format. The retry logic knows about that provider's rate limits. It works, often impressively, right up until the quarter when a better, cheaper model ships from somewhere else, and the team discovers that "switching" means a rewrite.

That codebase is a demo. It may be a demo with paying customers, but architecturally it is a demo, because the thing it is built around is the thing most likely to change.

Models are the fastest-moving dependency you have

Think about how you treat other dependencies. You do not scatter raw SQL strings for one database vendor across every file; you put a data layer in front of it. You do not call a payment processor's HTTP endpoints directly from your checkout page; you wrap it in an interface so you can swap or add providers.

Models deserve the same treatment, and arguably more of it, because the churn is worse. Databases change on a scale of years. Frontier models change on a scale of months, and the economics change faster than that. The model that was clearly best for your workload in January is a line item you are overpaying for by June.

When I built Vezra, this was the first architectural decision, before any worker existed. The platform has named AI workers (Finance, Support, Compliance) that execute real tasks across business tools. The model each worker uses is a routing decision, per organization, made in configuration. An org can run everything on one provider, split by task type, or blend models for cost. Nothing about the worker's workflow changes when the routing does.

What a routing layer actually has to do

"Just abstract the model" sounds like a weekend of work. The abstraction is easy. The hard part is everything that leaks through it.

Tool calling. Providers disagree on how tools are declared, how calls come back, and how results go in. Your routing layer needs one canonical tool schema and adapters that translate in both directions. If you get this wrong, every tool you add has to be written N times.

Structured output. Some models honor a JSON schema natively; some need it in the prompt and a validator afterward. The layer should guarantee the shape to the caller and absorb the difference.

Context limits and cost. Different models, different windows, different prices per token. Routing should be able to say "this task is long and low-stakes, use the cheap big-window model" without the caller knowing which model that is.

Failure semantics. Rate limits, outages, and content filters look different per provider. The layer should normalize them into a small set of outcomes the caller can reason about (retryable, fallback-eligible, terminal) and apply fallbacks automatically when policy allows.

Observability. Every call should be logged with the model that actually served it, the tokens, the latency, and the cost. Otherwise you cannot make routing decisions with evidence.

In Nexvest, the financial-intelligence workspace I built, this layer sits on the Vercel AI SDK with both OpenAI and Anthropic providers behind a model catalog the user can choose from. Forty-plus financial data tools are declared once, in one schema, and run through one tool runner regardless of which model is on the other end. Adding a model is a catalog entry.

The payoff is not just switching

The obvious benefit is being able to change models. The less obvious ones turned out to matter more.

You can evaluate honestly. When the same task can be run through three models with one flag, you stop arguing about which model is "better" and start measuring it on your own workload.

You can degrade gracefully. When a provider has an incident at 2 a.m., a routing layer with fallbacks means your product gets slower or slightly worse, not down.

Trust can live above the model. This is the one I care about most. If you want to verify, monitor, and constrain an AI worker, the whole agent-security posture, you cannot put that logic inside the model call. It has to be a layer that sees every call regardless of where it goes. A routing layer is exactly that seam.

Where the line is

I am not arguing for maximal abstraction. Prompts are model-specific in practice, and pretending otherwise produces mediocre prompts for everyone. Keep prompts versioned per model where it matters. Let the routing layer pick the right prompt variant along with the right model.

I am also not saying every project needs this on day one. A prototype with one hard-coded model is fine. The mistake is letting the prototype become the product without ever introducing the seam.

The rule I use: the moment a second person depends on your system, the model should be a configuration value, not a line of code. Everything after that is just making the configuration richer.

Written by

Samuel Ojerinde · AI Software Engineer

Next: Reproducibility is a feature, not a chore