Back to Blog

Magpie's Routing System: A Different Model for Every Task

claude-codemagpiellmroutingagents

One model may not fit an entire workflow

I have access to a GPT model with a generous usage allowance. It is reliable for code, and its style leans cautious: when it sees a possible edge case, it adds defensive checks first. That habit stands out more in copywriting. Before a sentence gets to its point, caveats, exceptions, and disclaimers have already taken over. This is my experience with the model I use, not a claim about every GPT model.

I send copywriting tasks to DeepSeek, then check the tone and facts myself. Looking up a function or changing a phrase does not call for the strongest model. Complex planning, edits across files, and hard-to-find bugs need more reasoning.

Task type and difficulty are separate dimensions. Copy and code call for different styles; a small edit and a refactor call for different levels of capability. A model can be fast and dependable at one kind of work, then cost me time in another.

Most of the time, though, I still pick one model and let it handle a whole session. I can switch models by hand, but when tasks come in quick succession, I forget. Choosing a model becomes another thing competing for my attention.

Claude Code’s automatic switching handles phases

Claude Code’s opusplan uses Opus in Plan Mode, then switches to Sonnet for execution. It switches by phase, matching the different needs of planning and implementation. It does not inspect each new request to decide whether it is a simple question, a writing task, or a cross-file refactor.

Claude Code also falls back when a safety classifier triggers or a service is unavailable. Those switches respond to a marker or an outage, not to task difficulty. The official docs explain that ANTHROPIC_BASE_URL determines where requests go; it does not decide which model answers them.

A third-party gateway can implement its own model selection and routing. Pointing Claude Code at another endpoint does not add that logic by itself. The gateway has to provide it.

Magpie puts model selection in the request path

Magpie runs locally between an agent and model providers. When an agent sends a request, Magpie uses routing groups, rules, and provider status to choose a model and an account or key. The choice happens per request, so you do not have to commit to one model at the start of a session.

You can define separate intents for writing, simple questions, and complex changes, then use rules to choose a preferred model. Other conditions can narrow the match by token count, whether the request includes an image, reasoning level, or agent.

Your configuration needs to answer two questions: which model handles each kind of work, and which candidate should take over if one fails? When the result has the wrong style, routing logs should show where the request actually went.

Intent routing cannot see the full conversation

At the start of a turn, Magpie’s intent classifier reads the current user message and the available intents. It cannot see earlier conversation, project files, images, or the agent’s tool definitions. Once it classifies the turn, tool calls in that turn keep the same route. Magpie does not classify each tool call again.

That keeps a model from changing mid-turn as tool results arrive. The trade-off is that the classifier may lack context it needs. If you say, “Change that too,” the actual task may be in the previous turn. A classifier that sees only the current message can choose the wrong intent.

Write intents so they are clear and distinct. If you combine copywriting and frontend design under one intent, you tie together different styles and output needs. When classification gets muddled, the routing rules cannot help much. If the classifier fails, Magpie leaves the intent rule unmatched and moves on to the other rules and model order in the group. It does not drop the request.

Classification also costs something. It makes an extra model call, adds latency to the first request, and sends the current user message to the selected classifier provider. For sensitive content, you can use a local model as the classifier; whether that fits depends on your data boundaries.

Account and provider routing give model selection a fallback

After Magpie selects a model, the request still needs an account and provider. One model may be available through several providers, and a provider may offer multiple accounts or keys. Magpie chooses among the configured candidates. If one runs out of quota, hits a rate limit, or fails, Magpie skips that route and tries the next.

Sequential fallback, round-robin allocation, choosing the account with the most remaining quota, or preferring the most responsive endpoint each make a different trade-off. Smart routing also considers quota resets and rate-limit status. The result depends on provider signals, routing rules, and the candidates you configured. It cannot create more quota.

Choosing a model by task decides who does the work. Choosing an account by status decides which route carries the request. Account routing gives model selection room to recover when a provider is unavailable.

Plugins and free quotas help, but need maintenance

Magpie’s plugins and provider integrations broaden the range of models you can connect. Free quotas from services such as WorkBuddy appeal to me: lighter tasks can use them instead of competing for paid model capacity.

Providers set the limits on free quotas. They may restrict request rates, model access, and permitted use, and those terms can change. Treat free access as one candidate in a workflow, not an unlimited resource or a way around rate limits. Before relying on an integration, check that it still works, that its plugin is maintained, and that the service terms have not changed.

Plugins also require trust. Magpie’s docs say plugins can access the requests, tools, and results it handles, and can access files with the host process’s permissions. Before installing a community plugin, I check where it came from and whether it is maintained.

Routing helps, but rules can multiply

Routing lets you assign different tasks to different models and recover when an account or service becomes unreliable. The costs are just as concrete: classification can be wrong, the first request takes longer, messages go to the classifier provider, and rules and plugins need ongoing maintenance.

I would start with a few clearly separated tasks. Split simple requests from complex engineering work, and give copy its own route. Then review which rules matched and how the results turned out. Add more detail only when the rules reduce switching, rework, or interruptions.

I think of models as people in different roles: some are fast, some handle complex reasoning well, and some suit my writing preferences for particular tasks. Magpie’s routing system lets me turn those judgments into rules and adjust them when my needs change.

Sources