Concurrency Limit Exceeded for Account: How to Fix It

Zivv••41 min read
On this page
  1. Concurrency vs RPM/TPM vs Quotas
  2. Where the Error Comes From
  3. Step 1: Confirm It Is Concurrency, Not Rate
  4. Causes and Fixes
  5. Capping Concurrency in Code
  6. Concurrency in Agents and Coding Tools
  7. What Zivv Limits and What It Returns
  8. Splitting Keys, Raising Limits, Getting Help
  9. Prevention
  10. FAQ

You kick off a batch script, let an agent fan out over a folder of files, or open a few coding-assistant windows at once, and the calls start failing with "concurrency limit exceeded for account, please retry later." It usually arrives as a 429, but it is not the familiar too-many-requests-per-minute error. You might be sending only twenty or thirty requests a minute and still get rejected, because those requests are slow and too many of them are still running on the server at the same time.

The exact wording is not part of any shared standard; providers and relay platforms each phrase their concurrency errors differently. The meaning and the fix carry over, though. This guide covers direct API calls, calls through a relay or gateway, and concurrency errors inside Claude Code, Codex, Cursor, and similar tools. For general 429 backoff, see fixing 429 errors; for Claude Code specifically, see Claude Code rate limits. This article is only about concurrency.

Concurrency vs RPM/TPM vs Quotas

LimitWhat it countsWhen it frees upTypical triggerFix
ConcurrencyRequests that have started but not finishedAs soon as any in-flight request completesasyncio.gather over a big batch, parallel agents, long outputsCap parallelism, queue
RPMRequests sent per time windowWhen the window rolls overBursts of small callsSlow down, back off
TPMTokens consumed per time windowWhen the window rolls overLong context, long outputsTrim context, split work
Quota or balanceTotal usage over a period, or account fundsWindow reset or top-upUsage accumulates to the capWait, top up, or raise the cap; see 402 balance and quota errors

A quick estimate links concurrency to request rate:

requests in flight ≈ requests per second × average request duration (seconds)

Send 60 requests a minute, one per second, where each takes 20 seconds on average, and about 20 requests are in flight at any moment. With a concurrency limit of 10, you get rejected while your RPM is nowhere near its ceiling. That explains a few patterns people run into:

  • Long outputs and reasoning models hit concurrency limits sooner: the longer each call runs, the more slots the same request rate occupies
  • Streaming holds a slot for the whole generation: from the first token to the last, the request counts as in flight
  • "It worked a minute ago": when the upstream slows down, average duration rises, in-flight count rises with it, and an unchanged request rate suddenly crosses the line

Rate limits are not always enforced per whole minute either. Anthropic's rate limit documentation notes that a 60 RPM limit might be enforced as one request per second, so short bursts can trigger errors. Firing a large batch all at once can therefore trip both the concurrency and the rate limit, even when the total volume is modest.

Where the Error Comes From

Which "account" the message refers to depends on who generated it:

  1. The provider you call directly: it caps simultaneous requests per account or organization, and "account" is yours
  2. A relay that passes the upstream error through: some relays forward the upstream's raw error text. In that case "account" is probably the relay's own account with the upstream, not yours. Many users may share that upstream account, so dropping your own concurrency to one may not help
  3. The gateway's own limit: some gateways cap in-flight requests per key or per user and generate the error themselves

Symptoms narrow it down:

What you observeMost likely source
Fails only when calls run in parallel; serial calls all succeedYour own account or key concurrency cap
Fails intermittently even at low concurrency or with a single requestA shared upstream account is saturated (passed through by a relay), or you still have unfinished requests hanging
The error body does not match the protocol you called and includes another platform's fieldsA relay forwarded the upstream's raw error
Another key on the same account fails the same wayThe limit is per account
Switching keys makes it go awayThe limit is per key

Step 1: Confirm It Is Concurrency, Not Rate

The fastest test is to send the same request a few times serially and then in parallel. The example below uses Zivv's endpoint; for a direct provider, swap in its URL and key. It spends a handful of tokens:

export ZIVV_API_KEY=sk-your-key
BODY='{"model":"gpt-6.1-terra","messages":[{"role":"user","content":"ping"}]}'

# Serial: six requests, one after another
for i in 1 2 3 4 5 6; do
  curl -s -o /dev/null -w "%{http_code}\n" https://zivv.pro/v1/chat/completions \
    -H "Authorization: Bearer $ZIVV_API_KEY" -H "Content-Type: application/json" -d "$BODY"
done

# Parallel: six requests in flight at once
seq 6 | xargs -P 6 -I{} curl -s -o /dev/null -w "%{http_code}\n" https://zivv.pro/v1/chat/completions \
  -H "Authorization: Bearer $ZIVV_API_KEY" -H "Content-Type: application/json" -d "$BODY"

All 200s serially and some 429s in parallel point squarely at a concurrency limit. If the serial run also fails broadly, you are looking at a rate limit, a quota, or the upstream itself; go back to the 429 guide and check each dimension. When a call fails, repeat it with curl -i and keep the full headers and body: the Retry-After header and the exact wording of the error are the most reliable clues to which limit you hit.

Causes and Fixes

CauseSymptomFix
A batch script fires every request at onceThe first wave succeeds, then errors pile upCap in-flight requests with a semaphore or job queue
Several agents, subtasks, or terminals run in parallelOne session is fine; several at once failRun fewer sessions in parallel; give automation its own rate-limited key
Long outputs or reasoning models hold slotsErrors even at a low request rateLower the concurrency cap, bound output length, move light tasks to faster models
Stacked retries: SDK retries plus your ownRequest volume grows after the first errorKeep one retry layer, with backoff and jitter
The client timed out, but the server may still be generatingYou think nothing is running, yet slots stay occupiedUse generous timeouts and wait before retrying after one
A shared upstream account is saturated (passed through by a relay)Errors at low concurrency, on and offContact the platform, or use a gateway that schedules across an account pool
Real demand exceeds the account's limitThroughput plateaus even with a cap in placeRequest a higher limit, or split workloads where the terms allow

Capping Concurrency in Code

One idea does all the work: take a slot before sending, give it back the moment the request ends, and when a call is rejected, release the slot before you sleep. Holding a slot while backing off means blocking yourself.

Python: asyncio Semaphore with Backoff

import asyncio
import random

from openai import AsyncOpenAI, APIStatusError

client = AsyncOpenAI(
    base_url="https://zivv.pro/v1",
    api_key="sk-your-key",
    max_retries=0,  # retries are handled below, so they do not stack with the SDK's
)

MAX_IN_FLIGHT = 4  # stay below the provider's concurrency cap
sem = asyncio.Semaphore(MAX_IN_FLIGHT)


def is_limit_error(err: APIStatusError) -> bool:
    # Most providers use 429; some use other codes, so check the wording too
    return err.status_code == 429 or "concurrency" in str(err.message).lower()


def backoff_seconds(err: APIStatusError, attempt: int) -> float:
    retry_after = err.response.headers.get("retry-after", "")
    if retry_after.isdigit():
        return float(retry_after)
    return min(2 ** attempt, 30) + random.uniform(0, 1)


async def ask(prompt: str, max_attempts: int = 6) -> str:
    for attempt in range(max_attempts):
        async with sem:  # hold a slot only while the request is actually running
            try:
                resp = await client.chat.completions.create(
                    model="gpt-6.1-terra",
                    messages=[{"role": "user", "content": prompt}],
                )
                return resp.choices[0].message.content
            except APIStatusError as err:
                if not is_limit_error(err) or attempt == max_attempts - 1:
                    raise
                wait = backoff_seconds(err, attempt)
        await asyncio.sleep(wait)  # slot already released, so other tasks can run
    raise RuntimeError("retries exhausted")


async def main():
    prompts = [f"Explain concept #{i} in one sentence" for i in range(50)]
    answers = await asyncio.gather(*(ask(p) for p in prompts))
    print(len(answers))


asyncio.run(main())

asyncio.gather does no throttling on its own: all 50 coroutines start immediately, and the semaphore is what bounds the number in flight. Make MAX_IN_FLIGHT a config value, start at roughly 60 to 70 percent of the provider's cap, and adjust after watching the error rate for a few days.

Node.js: A Dependency-Free Semaphore

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://zivv.pro/v1",
  apiKey: process.env.ZIVV_API_KEY,
  maxRetries: 0, // retries are handled below
});

// Minimal semaphore: at most `max` requests in flight, the rest wait in line
function createSemaphore(max) {
  let active = 0;
  const waiters = [];
  return {
    async acquire() {
      if (active < max) {
        active++;
        return;
      }
      await new Promise((resolve) => waiters.push(resolve));
    },
    release() {
      const next = waiters.shift();
      if (next) next(); // hand the slot straight to the next waiter
      else active--;
    },
  };
}

const sem = createSemaphore(4);
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

function isLimitError(err) {
  return err?.status === 429 || /concurrency/i.test(String(err?.message ?? ""));
}

function backoffMs(err, attempt) {
  const h = err?.headers;
  const value = typeof h?.get === "function" ? h.get("retry-after") : h?.["retry-after"];
  const seconds = Number(value);
  if (Number.isFinite(seconds) && seconds > 0) return seconds * 1000;
  return Math.min(2 ** attempt * 1000, 30_000) + Math.random() * 1000;
}

async function ask(prompt, maxAttempts = 6) {
  for (let attempt = 0; ; attempt++) {
    let wait = 0;
    await sem.acquire();
    try {
      const resp = await client.chat.completions.create({
        model: "gpt-6.1-terra",
        messages: [{ role: "user", content: prompt }],
      });
      return resp.choices[0].message.content;
    } catch (err) {
      if (!isLimitError(err) || attempt + 1 >= maxAttempts) throw err;
      wait = backoffMs(err, attempt);
    } finally {
      sem.release(); // release before backing off
    }
    await sleep(wait);
  }
}

const prompts = Array.from({ length: 50 }, (_, i) => `Explain concept #${i} in one sentence`);
const answers = await Promise.all(prompts.map((p) => ask(p)));
console.log(answers.length);

Save it as an .mjs file, since it uses top-level await. Both examples switch off the SDK's built-in retries: the official OpenAI and Anthropic SDKs retry 429s automatically, and wrapping another retry loop around them multiplies the real request count, which is exactly what makes a concurrency problem worse.

Concurrency in Agents and Coding Tools

Coding agents are where concurrency errors show up most, because one "task" often turns into many model calls fired at the same time:

  • Claude Code: multiple terminals or worktrees running at once, or subagents working in parallel, each occupy slots. Requests on the same key add up, so keep interactive sessions and batch jobs on separate keys
  • Codex, Cursor, and similar tools: a background agent and a foreground chat may be calling the model simultaneously, and extra windows add more
  • Agents you build yourself: parallel tool calls and parallel file processing all become concurrent model requests. Put a ceiling on the worker or coroutine pool; it is the same semaphore idea as above

Moving light tasks (classification, summaries, rewrites) to a faster model such as gemini-4-hydrogen or claude-haiku-5-5 shortens each call, so the same volume holds fewer slots, and usually costs less too.

What Zivv Limits and What It Returns

Zivv does not cap the number of in-flight HTTP requests per key. It does enforce the limits below, and each returns fixed wording you can branch on in code:

LimitScopeResponse when exceeded
Key RPM and RPHPer key, counted per minute and per hour; you can set lower values in a key's advanced options, but not above the platform default429, rate limit exceeded, type rate_limit_error, with a Retry-After header
Shared team RPMOne counter shared by every key in the teamSame as above
Responses WebSocket connectionsUp to 16 open at once per user429, too many concurrent websocket connections
In-flight cap per upstream channelEach upstream channel on the platform sideFull channels are skipped automatically; if all are full, 429 with quota exhausted, please retry later
Stream cancellation ratioPer key, over the last 10 minutes429, type abort_rate_limited
Image edits endpointShared site-wide503, server busy processing image edits, please retry

A few notes:

  • Upstream concurrency limits are absorbed first: when an upstream channel answers 429, concurrency-style ones included, Zivv moves on to the next channel for the same model and pushes that channel back in line for a short while. You only receive a 429 when every candidate channel is rate limited, with the message quota exhausted, please retry later and error.code rate_limit_exceeded
  • No upstream text is passed through: errors from Zivv's chat endpoints always use Zivv's own wording, so "concurrency limit exceeded for account" will not appear verbatim in a Zivv response. If you think you are on Zivv and see it anyway, check which provider and base URL your client is actually using
  • Do not race requests and cancel the losers: if a key cancels a large share of its streaming responses mid-output in a short period, Zivv responds with too many canceled streams from this API key, please let responses finish before retrying; it clears on its own as the window moves on
  • Split keys for isolation: give your interactive app, batch jobs, and CI separate keys with their own RPM and budgets, so one runaway job cannot starve the others and usage stays separable; see API key and budget practices for teams

Splitting Keys, Raising Limits, Getting Help

  • Split only where the terms allow it: many providers count limits per account or organization, so extra keys on the same account add no concurrency. Spreading load across multiple accounts is something to check against the provider's terms first, and to skip if they forbid it
  • Ask for a higher limit: if real demand exceeds the account's ceiling, follow the provider's process for a higher tier; Anthropic's rate limit documentation describes how to request one
  • Contact the relay: if you call through a relay and see frequent errors even at low concurrency, the bottleneck is most likely the platform's upstream account. Send them the timestamps, request IDs, and full error text; it beats tuning your own settings blindly

Prevention

  1. Make the concurrency cap configurable: start at 60 to 70 percent of the provider's limit to leave room for retries and bursts
  2. Queue at the entry point: push bursts into a queue drained by a fixed number of workers, turning random errors into predictable wait times
  3. Monitor the 429 rate and in-flight count: a rising 429 rate means you are nearing the ceiling; lower concurrency or split work before it tips over
  4. Log the details: on every rejection, record the status code, Retry-After, the full error body, and how many requests were in flight
  5. Run heavy jobs off-peak: a less busy upstream answers each call faster, so the same work holds fewer slots

If your concurrency ceiling comes from a single upstream account, create a Zivv account: one key for models from several vendors, automatic channel failover when one upstream is rate limited, no charge for rate-limited rejections, and per-key RPM and budget controls.

FAQ

What is the difference between a concurrency limit and an RPM limit?

RPM caps how many requests you send per minute; a concurrency limit caps how many requests are unfinished at the same moment. The longer each request runs, the more concurrency slots the same RPM consumes: one request per second at 20 seconds each keeps about 20 in flight. That is why you can hit a concurrency limit at a modest RPM, and why the fix is to cap requests in flight rather than only slowing down.

Why do I get a concurrency error with only one session open?

Four common reasons: the tool sends several requests in parallel behind the scenes (subagents, parallel tool calls); a request you abandoned after a client timeout may still be running on the server; SDK retries and your own retries are stacking and multiplying traffic; or a relay is forwarding an error from an upstream account it shares with other users. Run the serial-versus-parallel test to confirm, then work through the causes table above.

Am I charged for requests rejected by a concurrency limit?

Usually not. A rejected request never reaches inference, so it consumes no tokens, and only the retry that succeeds is billed normally. On Zivv, rate-limited rejections are not billed, and failed attempts the gateway routed away from are recorded at zero cost.

Will creating more API keys fix the error?

It depends on what the limit counts. A per-key limit can be spread across several keys; a per-account or per-organization limit cannot, no matter how many keys you create under the same account. Check the provider's terms before spreading load across multiple accounts. The more reliable approach is to control concurrency in your client first and split keys by workload for isolation.

Will I see "concurrency limit exceeded for account" on Zivv?

Not verbatim. Zivv does not forward upstream error text to clients. When one upstream channel is at capacity, the gateway switches channels first and returns a 429 with quota exhausted, please retry later only if every candidate channel is rate limited; a key that exceeds its own RPM gets rate limit exceeded. Both can be retried using Retry-After or exponential backoff.