· ModelPlane Team · engineering, product
Model groups: the one abstraction that decouples your app from providers
A developer guide to OpenAI compatible gateway, ModelPlane model groups, and production LLM routing.
title: "Model Groups: The One Abstraction That Decouples Your App from Providers" description: "Stop hard-coding model IDs. Model groups let you swap LLM providers, add fallbacks, and change routing without touching app code." date: "2026-08-07" author: "ModelPlane Team" tags: ["engineering", "product"]
Your app should not know what model answered its last request. It shouldn't care whether that request was served by OpenAI, Anthropic, or a model you haven't heard of yet. And it definitely shouldn't require a deploy to change its mind.
That's the promise of the model group: the single abstraction that turns request.model from a hard-coded provider ID into a name you control. It's the difference between an app that's coupled to a vendor and one that's decoupled from the entire concept of a vendor.
The pain of model="gpt-4o" baked into code
Every AI engineer has been here. You ship a feature with model="gpt-4o" in the client. It works. Then:
- A new model ships that's better and cheaper. You want to try it, but it's in 47 places across your codebase.
- Your primary provider has an outage. Your app is down, and your only fallback is hoping the provider recovers.
- You want to A/B test models. But that requires a config change, a deploy, and a prayer.
- A teammate hard-codes a different model in a new service, and now you're running two different models in production without realizing it.
The root cause is the same in every case: you've made the provider model ID part of your application's interface. Your app doesn't just send user messages; it encodes a specific business decision about which model should answer. That decision doesn't belong in your app. It belongs at the routing layer.
The model group: request.model is a name you control
A model group is a routing configuration owned by your workspace. When your client sends a request, the model field in your payload is the group name — not a provider model ID. The gateway expands that name into a routing strategy and a list of backend targets, then executes the request.
Here's the mental shift: model="prod-chat" is not a model. It's a route. Your app says "I want the production chat model," and the gateway decides what that means — today, next week, or next year.
The resolution priority is straightforward:
- An explicit per-request routing config (legacy, for special cases)
request.modelas a model group name — this is the path you'll use 99% of the time- A direct single-provider call
When the gateway resolves a model group, it hydrates the target credentials — your provider API keys are stored encrypted per-tenant and decrypted only at request time — and hands the resolved targets to the routing engine.
What a model group actually looks like
Under the hood, a model group is a JSON configuration with two parts: a strategy and a list of targets. Each target references a backend credential and can override the model ID sent upstream.
Here's a simple fallback group:
{
"strategy": { "mode": "fallback" },
"targets": [
{ "kv_ref": "cred:user:123:cred1", "override_params": { "model": "gpt-4o" } },
{ "kv_ref": "cred:user:123:cred2", "override_params": { "model": "claude-3-5-sonnet-20241022" } }
]
}
That's it. A name, a strategy, and a list of targets. The gateway takes it from there.
But the real power is in the strategy modes:
- Single — always route to one target. Simple, but you're back to hard-coding.
- Fallback — try the first target; on a 5xx, timeout, or rate limit, try the next. This is the minimum viable LLM stack for anything production-bound.
- Load balance — split traffic across targets by weight. Use it for A/B tests, gradual rollouts, or cost optimization.
- Conditional — route based on request metadata like customer tier, region, or a feature flag.
You manage these groups through the ModelPlane API (POST/GET/PUT/DELETE /api/model-groups) or the portal UI. No deploys required.
The payoff: swap backends without touching code
Let's make this concrete. Here's a standard OpenAI client call — the only code your app needs:
from openai import OpenAI
client = OpenAI(
base_url="https://modelplane.dev/v1",
api_key="gw-your-gateway-key"
)
response = client.chat.completions.create(
model="prod-chat", # a model group, not a provider model ID
messages=[
{"role": "user", "content": "Explain model groups in one paragraph."}
]
)
print(response.choices[0].message.content)
Notice what's missing: any mention of a specific provider. Your app sends model="prod-chat". The gateway does the rest.
Now, the scenarios that used to require a deploy:
- A new model ships that's better and cheaper. Update the model group's targets in the portal. Done. Your app is now using the new model.
- Your primary provider has an outage. If you configured a fallback group, the gateway automatically tries the next target. Your app never knows there was a problem.
- You want to A/B test models. Set up a load-balance group with a 50/50 split. Watch the results. Adjust the weights. No code changes.
- You want to enforce a system prompt or thinking behavior. Model groups carry that configuration too — the gateway injects it server-side, so clients can't forget it or bypass it.
This is the core of what makes an OpenAI-compatible gateway worth using. The compatibility is table stakes — you get to keep your existing client code. The model group is the actual product: it's the abstraction that makes your LLM stack operationally manageable.
Why the provider is the wrong unit of integration
The entire ModelPlane position is that the provider is the wrong unit of integration. Here's why.
When you integrate with a provider directly, you're signing up for their API quirks, their rate limits, their outages, and their pricing changes. You're also signing up for their model IDs — which means every model upgrade is a code change.
When you integrate with a model group, you're signing up for a capability. "I need a fast, cheap model for classification." "I need a high-reasoning model for complex code generation." "I need a model that's available in China." The group encapsulates that capability, and the gateway handles the messy details of which provider actually delivers it.
This is the same evolution every infrastructure layer goes through. You don't hard-code a database IP address in your app; you use a connection string that points to a logical name. You don't hard-code a service's instance ID; you use a load balancer. Model groups are the LLM equivalent: a logical name in front of a pool of interchangeable backends.
Migrating a model ID with zero deploys
Here's a concrete migration scenario. You're running model="gpt-4o" in production, and you want to move to a newer model.
Without model groups: You search your codebase, update every client, run a full regression, and deploy. If the new model has issues in production, you have to revert the deploy.
With model groups: You create a group called prod-chat with a single target pointing at gpt-4o. You update your clients to send model="prod-chat" — one change, one deploy. Then you add the new model as a second target with a small load-balance weight, say 5%. You monitor. If it looks good, you increase the weight. If it doesn't, you remove the target. The whole process is a config change, not a code change.
And when you're confident, you can set up a fallback: new model first, old model second. If the new model has a bad day, the gateway automatically routes to the old one. Your users never see a 5xx.
The model group is your contract with the LLM ecosystem
The model group is more than a routing config. It's a contract between your application and the LLM ecosystem. Your app declares what it needs; the model group declares how that need is met.
This contract is what enables the rest of the ModelPlane feature set:
- Coding-plan routing — fold your existing subscription quota into the same routing fabric. Put a coding-plan backend first in a fallback group, and production traffic uses that quota before falling back to pay-per-token.
- Unified thinking — one
thinkingparameter for every reasoning model. The gateway adapts it per provider, and the model group can enforce a default or a minimum effort level. - System-prompt injection — the group carries a system prompt that the gateway injects into every request. Behavior lives with the route, not copy-pasted into every client.
None of this is possible if your app is hard-coded to a provider. All of it is possible with a model group.
Start with one group
The migration path is simple. Point your OpenAI client at https://modelplane.dev/v1, create a model group, and send model="prod-chat" instead of model="gpt-4o". You'll get the same responses, but now you have a lever you can pull at any time — without a deploy.
That's the whole pitch. One endpoint, one abstraction, and a routing layer that makes your LLM stack resilient, cost-effective, and future-proof.
Point your OpenAI client at ModelPlane in 60 seconds. Your future self — the one who doesn't have to do a 2 AM deploy during a provider outage — will thank you.
This is part of a series on building production-grade LLM applications with ModelPlane. Check out the rest:
- One endpoint, every model: why we built ModelPlane
- Routing strategies, explained: fallback, load-balance, conditional — coming soon
- Model groups: the one abstraction that decouples your app from providers — you are here
- Bring your own keys, safely — coming soon
- High availability for LLM apps: a fallback playbook — coming soon
- Stop paying twice: route your coding-plan quota into production — coming soon
- Price-aware routing: cut your LLM bill without changing models — coming soon
- Credits, usage & billing, explained — coming soon
- 1600+ models, one API: the ModelPlane provider catalog — coming soon
- One gateway, two regions: routing to global and China models — coming soon
- ModelPlane for teams: orgs, workspaces & shared keys — coming soon
- Meet the assistant: an AI helper that lives in your gateway dashboard — coming soon
- Inside the ModelPlane routing engine — coming soon
- One thinking parameter, every model — coming soon
- The system prompt belongs at the router, not in your app — coming soon