BroadRouter
Get started

How to run parallel coding agents on a flat-rate LLM API

By the BroadNet Inference team · 5 min read · Published · Updated

Give each agent that works at the same time its own plan session. A session runs one request at a time with no token meter, so an orchestrator with three sub-agents needs four sessions. Cap requests in flight in your own code to match. One key can hold several sessions, and each session on Full Moon costs $60 a month.

Agent frameworks have moved from one assistant to many: an orchestrator that plans, sub-agents that write code, review it and run tests, and batch workers that process a backlog. On a per-token API each of those adds to the bill. On a flat-rate API the question becomes: how many things are calling the model at the same moment?

What does a flat-rate session cover?

BroadNet’s unlimited plans sell sessions. A session runs one request at a time, with unlimited DeepSeek V4.1 Flash tokens and no rolling window or weekly cap. That matches how one agent works: it sends a request, reads the answer, runs a tool, and sends the next request.

Setup Requests in flight at peak Sessions
One coding agent in one terminal 1 1
Orchestrator + 3 sub-agents 4 4
10 batch workers 10 10
2 developers, 1 agent each 2 2 (each on their own account)

Each Full Moon session is $60 a month. One key can hold several sessions, or you can split a plan’s sessions across its keys, for example one key per server or per project, so a leaked or revoked key stops only the agents behind it. Keys and accounts are personal: you can build a plan into your own product, but you cannot share or resell the key. Full session rules.

How many sessions do parallel agents need?

Agents spend a lot of time not calling the model: running tests, reading files, waiting for a build. Four sub-agents that each call the model 40% of the time rarely all need it at once. Before buying four sessions:

  1. Log a start and end time for every model request your framework makes, per agent.
  2. Count the most requests that overlap in each minute.
  3. Buy sessions for the overlap you hit most of the time, not the absolute peak, and queue the rest in your own code (see the semaphore below). BroadNet’s pages don’t say whether a request over the limit waits or is refused, so don’t let agents send it blind.

For example, if your logs show two requests in flight most of the time and four only in short bursts, two sessions plus a client-side queue may be the cheaper setup.

A short script does the counting. Given a list of (start, end) times in seconds from your logs:

from collections import Counter

def overlap_histogram(requests):
    events = sorted([(s, 1) for s, _ in requests] + [(e, -1) for _, e in requests])
    in_flight, last_t, seconds_at = 0, None, Counter()
    for t, delta in events:
        if last_t is not None:
            seconds_at[in_flight] += t - last_t
        in_flight += delta
        last_t = t
    return dict(sorted(seconds_at.items()))   # {requests in flight: seconds}

If the result shows most of the time at one or two requests in flight, buy two sessions. If it sits at four for hours, buy four.

Which agent patterns need how many sessions?

Pattern How it calls the model Sizing rule
Orchestrator + workers Planner calls, then fans out Workers that run together, plus one for the planner if it keeps working
Pipeline (write → review → test) One stage at a time per task One session per task running in parallel
Batch backlog Many identical jobs One session per worker; more workers finish sooner
Several developers’ agents Independent One session per developer, each on their own account

How do you keep parallel agents out of each other’s way?

Model capacity is only half the problem. Two agents editing the same file will undo each other’s work. The usual fix is one git worktree per agent: each gets its own checkout and branch from the same repository.

git worktree add ../agent-auth -b agent/auth
git worktree add ../agent-billing -b agent/billing

Then split tasks by module, so agents rarely touch the same files, and merge through a review step. For running them unattended, see overnight coding agent runs; for what the extra agents cost in tokens, see multi-agent cost.

When is pay-as-you-go better for parallel agents?

A pay-as-you-go key allows 4 requests in flight and 30 requests a minute. That fits short, spiky fan-out: a review step that spawns four checkers for twenty seconds, then goes quiet. Steady load fits sessions, and spiky load fits per-token billing. Many setups use both: plan sessions for the long-running agents and a pay-as-you-go key for bursts and for other models such as GLM 5.3.

When a pay-as-you-go key hits its rate limit or concurrency limit it returns 429. Back off and retry; see error codes and when to retry. The rate limit calculator shows how far a given limit stretches for your request pattern.

How do you wire agents to the plan?

Most agent frameworks accept an OpenAI-compatible base URL. Point every agent at https://inference.broadnet.ai/v1 with model broadnet/deepseek-v4.1-flash and give each a key:

export OPENAI_BASE_URL="https://inference.broadnet.ai/v1"
export OPENAI_API_KEY="$BROADNET_PLAN_KEY"

For one terminal coding agent, the Aider guide has the exact settings; Cline and OpenCode have their own guides. For your own orchestrator, the OpenAI Python SDK guide shows the client setup. In your own code, cap requests in flight to the number of sessions so they queue on your side, where you can see it:

import asyncio
SESSIONS = 4
gate = asyncio.Semaphore(SESSIONS)

async def ask(client, messages):
    async with gate:
        return await client.chat.completions.create(
            model="broadnet/deepseek-v4.1-flash", messages=messages, max_tokens=4000)

What goes wrong with parallel agents?

  • Starting every agent at once. A burst of simultaneous first calls exceeds your sessions at once. Stagger starts by a few seconds.
  • Retry storms. If every agent retries at the same moment, they collide again. Add jitter to backoff.
  • Too little max_tokens. DeepSeek V4.1 Flash reasons before answering; a small limit can return an empty reply. Why.
  • Sharing one key across people. Keys are personal. Give each developer their own account.

How much context can each agent use?

Every request can carry up to 1,048,576 tokens on DeepSeek V4.1 Flash. A sub-agent can read the whole module it is working on rather than a trimmed summary, and on a plan, a long prompt doesn’t cost extra. When a 1M-token window helps.

How do you test the setup cheaply?

Buy one Meteor hour ($1) per session you think you need, and run your real agent workflow. If the agents wait on each other too often, add a session. If one sits idle, drop it. Then move to Full Moon or week-long Orbit sessions ($15 each).

Where BroadNet Inference fits

Plan sessions suit steady, parallel agents on one model, because the bill depends on how many run at once, not on how much they read. If your agents need several different models, or call the model only in short bursts, a pay-as-you-go key or a router may cost less. Compare with the break-even math first.

Questions

What happens if two agents use one session at the same time?

A session runs one request at a time, and BroadNet's pages don't say whether a second request waits or is refused with a 429. Don't rely on either: cap requests in flight to your session count in your own code, retry 429s with backoff, and add a session if agents wait too long.

How many coding agents can I run in parallel?

As many as you have sessions for requests that overlap. Each plan session runs one request at a time, so four agents calling the model at the same moment need four sessions. Agents that mostly run tools can share fewer sessions if your code queues their model calls.

How do I stop parallel agents from editing the same files?

Give each agent its own git worktree and branch, and split work by file or module. Merge through normal pull requests or a final review step.

Can I mix a plan and pay-as-you-go?

Yes. Plan keys and pay-as-you-go keys are separate. A common pattern is plan sessions for steady agents and a pay-as-you-go key for occasional bursts or other models.

Do sessions have to be on separate keys?

No. One key can hold several sessions, or you can split them across keys, for example one key per server or per project.

Do parallel agents cost more on a flat-rate plan?

Only by the number of sessions. Tokens are not metered on a plan, so the bill is sessions times the plan price, whatever each agent reads or writes.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity