DEV Community

Cover image for Load-Balancing Coding Agent Subscriptions in Raft Without a Proxy
El
El

Posted on Originally published at 2bab.me

Load-Balancing Coding Agent Subscriptions in Raft Without a Proxy

Lately, the coding agent space is back to a three-way race between OpenAI, Anthropic, and Google, especially with Google's newly released Gemini 4 Carbon and Neon picking up real momentum. Models trade the lead all the time: whichever one feels best for coding today might not be the top pick next month.

That's why I've been leaning heavily on Raft's Agent Team mode. You put coding agents from different providers in one channel and assign tasks based on what each does best. After using it for a while, I realized it also solves another practical problem: when handing out work, you can glance at each subscription's remaining quota and adjust on the fly. For example, I recently kicked off a big task in Raft that ran continuously for roughly 24 hours. Midway through, one agent burned through its quota and went offline, and the rest kept pushing the project forward without stalling.

Raft homepage showing multiple agents collaborating on the right

First, I'll walk through how I split work across multiple subscriptions based on remaining quota. Then I'll show how to wire the same CLI into Raft with separate configs, along with ready-to-use snippets if you want to try it yourself.

Handing Off When a Quota Runs Dry

My main agents all live in the same project channels by default. I set up each agent's role and backup rules ahead of time through channel rules and agent descriptions. Opus usually acts as the admin, breaking down tasks and handling most of the implementation, while Neon works alongside it to review requirements, refine technical plans, and write docs. Once Opus runs out of quota and drops off, Neon can tell from the descriptions and channel context who should step in (which is just Neon itself).

In Raft, channel messages, threads, and task histories are shared across the channel rather than tied to a single agent's local session. An agent that hits its limit usually just stops responding out of nowhere, so it can't always leave a neat handoff summary behind (every now and then an agent will drop a heads-up in the channel when it's almost out, though I honestly can't remember which one lol). Even so, as long as key details from the work so far (PR links, test results, acceptance criteria) are already in the channel or on the task, the backup agent notices its teammate has gone quiet, checks the channel history and current repo state, figures out where things stopped and what comes next, and picks up from there. Of course, there's a trade-off: each agent has its own context window, so taking over means reading through recent PR discussions and code, which does cost some extra tokens.

So how do I track remaining quota across providers in one place? I run Nowdex in my macOS menu bar, which shows each subscription's remaining percentage and reset time at a glance.

Remaining quotas and reset times across subscriptions in Nowdex's menu bar popup

Take the screenshot above: Claude has 30% left and resets in a little over two days. If I have a task that either Opus or Sol can handle and that easily fits within the remaining quota, I'll definitely use up the one that resets sooner rather than let it go to waste. On the flip side, if a task looks like it will take several rounds of back-and-forth revisions, I prefer giving it to an agent with plenty of headroom from the start so we don't have to hand it off midway.

Having multiple subscriptions also brings an awkward crunch: mine all happen to reset around Monday or Tuesday, so by the end of the weekend, all of them tend to run low at the same time. During that window, I split the work a bit more finely: Neon and Opus still own requirements and architectural calls, while well-defined implementation and test writing go to DeepSeek Flash, which I pull into the channel temporarily. For instance, if we're upgrading an existing API with a few new fields, I'll lock down default values and backward-compatibility rules for older clients with Opus or Neon first; then they hand the architecture and acceptance tests to DS Flash, which writes the implementation, runs the tests, opens the PR, and so on.

By default, that DeepSeek agent isn't in my project channels. I only bring in this "mercenary" during the second half of the week when my main quotas get tight. The reason is simple: it's pay-as-you-go and dirt cheap, though it does need clear architectural guidance, making it a great temporary workload buffer. Even when it isn't in the channel, I added a rule to my other agents' memory so they can delegate to DS over DM for niche tasks like reverse engineering. That keeps the project channel clean.

As for my subscription mix, my three main plans are roughly 5x, 5x, and 10x. During the week I check reset timers and task sizes once a day to route work dynamically; before the next billing cycle, I go by how each one felt over the past month to decide which deserves the 10x tier. Once collaboration lives at the Agent Team layer, a new model pulling ahead just means swapping the channel admin in Raft, not rebuilding your entire workflow.

Speaking of keeping work moving when quotas run out, you might think of Magpie, which has gotten a lot of attention lately. If we stick strictly to the question of how to keep working once a subscription runs out, Magpie and Raft solve it at different layers. Magpie handles fallback at the request layer: its local gateway pools multiple subscriptions or API keys into routing groups, and if an upstream hits a limit before starting a reply, the gateway automatically switches to another account or model to finish the request (it also supports bridging a real Claude Code instance or simply switching logins). Raft handles it at the work layer by having another agent take over, using the channel discussion, PRs, and test results as handoff material. Both keep things moving, just from different angles. Another reason I lean toward Raft's setup is that every agent still runs on its own native CLI and official APIs, without a proxy layer translating protocols in between.

Running Multiple Configs for the Same CLI in Raft

With task routing covered, let's get into the config side. Plugging the big three into Raft with their default accounts is straightforward through the standard onboarding flow, so I won't repeat that here. Below are two setups beyond the defaults: isolating a second environment for the same CLI so you can connect another model provider or a second subscription without touching your regular terminal config. Both rely purely on officially supported features: Codex's custom providers, DeepSeek's Responses API, and Claude Code's multi-account config directories.

Pointing a Second Codex Config Directly at DeepSeek

Previously, I connected DeepSeek to Raft through Apache/Maka (see my earlier Raft integration post). I've paused using Maka for now because it's going through a major Rust rewrite: the old version is no longer updated, and the new one isn't finished or stable yet. So I went with a more direct route: using Codex's custom provider support, I spun up a dedicated Codex agent in Raft named LP-DS connected directly to DeepSeek V4.1 Flash (model ID deepseek-flash). Meanwhile, running codex in Terminal or opening the Codex desktop app still uses my original ChatGPT subscription, with both setups completely isolated.

LP-DS listed alongside other agents in Raft, running on Codex CLI

The key is the CODEX_HOME environment variable. Create a standalone directory (say, ~/.codex-raft-deepseek) and put two files in it: a models.json from DeepSeek's official Codex integration docs to tell Codex about the model's context window, reasoning levels, and tool capabilities, and your own config.toml specifying the default model, custom provider, and authentication (see the Codex config reference for the full list of fields).

To keep the API key out of plain-text files on disk, I stored it in macOS Keychain under the service name raft-codex-deepseek and used auth.command so Codex fetches it on demand. Here is a trimmed config.toml:

model = "deepseek-flash"
model_provider = "deepseek"
model_catalog_json = "/Users/you/.codex-raft-deepseek/models.json"
model_reasoning_effort = "high"
web_search = "disabled"

[model_providers.deepseek]
name = "DeepSeek"
base_url = "https://api.deepseek.com"
wire_api = "responses"

[model_providers.deepseek.auth]
command = "/usr/bin/security"
args = ["find-generic-password", "-s", "raft-codex-deepseek", "-w"]
Enter fullscreen mode Exit fullscreen mode

This points Codex at DeepSeek's Responses API with its own models.json path and Keychain lookup command. If a background daemon can't find your default keychain, pass -a <username> and the full path to your login keychain in args as well. I also disabled DeepSeek's Alpha Search via web_search = "disabled"; on the rare occasions it needs web search, attaching a Tavily MCP server is more than enough (the free API key includes 1,000 searches a month).

Once the config is ready, run a quick check in Terminal to confirm deepseek-flash responds properly:

CODEX_HOME="$HOME/.codex-raft-deepseek" codex
Enter fullscreen mode Exit fullscreen mode

After confirming it works, go back to Raft, create a new Codex agent, type deepseek-flash manually in the model field, expand Advanced β†’ Environment variables, and add CODEX_HOME=/Users/you/.codex-raft-deepseek. Make sure to use an absolute path on your machine here rather than ~ or $HOME.

The same Codex setup works for other third-party models as well. Since Codex is currently the top-ranked harness overall across benchmarks, it's well worth trying as a base for other models.

Isolating a Second Claude Code Account with CLAUDE_CONFIG_DIR

Claude Code follows the same pattern, and it's even simpler. I created a separate config directory for my new Team Standard account, keeping it isolated from my daily Max account using the officially supported CLAUDE_CONFIG_DIR variable (see the Claude Code multi-account docs). Run the login command once on the machine running Raft:

CLAUDE_CONFIG_DIR="$HOME/.claude-raft" claude auth login
Enter fullscreen mode Exit fullscreen mode

After logging in, run CLAUDE_CONFIG_DIR="$HOME/.claude-raft" claude auth status to confirm the account and subscription type match your Team plan, then add that absolute CLAUDE_CONFIG_DIR path to the new Claude agent's environment variables in Raft.

I ran short parallel CLI tests on the same Mac using my original Max plan and the Team Plan - Standard subscription. Both returned normally without overwriting each other's login state. Right now, I save the Team Plan quota to lead smaller projects (like doing architectural planning for DS), keeping it separate from my primary plan.

Wrap-Up

There's nothing fancy about this setup. On the workflow side, Raft's shared channel context and Nowdex's reset timers help balance the load and get the most out of each subscription. On the config side, CODEX_HOME and CLAUDE_CONFIG_DIR split one CLI into separate isolated configs for extra accounts or providers. Everything here uses official features, with zero proxies or hacky workarounds. You can drop this post straight into your agent and get it configured in under a minute, without installing any third-party tools or plugins. The model race will keep shifting, but once your collaboration rules and config isolation are in place, swapping agents or subscriptions is easy.

Top comments (0)