Per-developer quotas and rate limits for AI coding tools
A team that rolls out Claude Code or Codex often shares one provider key, or a handful of them, and finds out who used what when the invoice arrives. By then the model has already run. A cap that fires after the upstream call is only a record of spend that already happened.
If you issue a client key per developer, and you enforce the ceiling before the provider is called, the cap is a control rather than a post-mortem. That is what Qosway does. It is a self-hosted LLM gateway for Claude Code, Codex, and any OpenAI-compatible client. Every client key has a ceiling, and the ceiling is enforced before the provider is called.
Why a limit after the invoice is too late
Coding agents do not complete one function and stop. They read files, call tools, retry, and carry conversation history forward. Token use is not "one prompt, one completion." A desk full of developers, each with a long-running session, is a different traffic shape from one person experimenting.
If those sessions all talk to the provider directly, there is no shared place to apply a per-person cap. You can ask people to be careful. You cannot see, at the time of the request, that one key has already used its daily tokens, or that a loop is sending hundreds of requests a minute. A provider 429, when you get one, arrives after some of the work has already been done, and it is not tied to a person or a team key you issued.
The useful moment is before the upstream call. After that, you are only counting.
A key per developer
Qosway is closed by default. With no client key created, every request is rejected. The unit of control is the client key, not a vague notion of "the team." If you create one key per developer, daily and monthly token caps, and the rate limit, apply to that person. If you share a key across a squad, they share a ceiling. If you issue a key per environment or per project, the ceiling follows that key instead.
The product does not invent a separate "developer" object. It enforces limits per client key. How you map keys to people is yours to decide. The panel is built into the binary, and that is where usage against those keys shows up.
Defaults apply to every key. Per-key overrides take effect immediately, and you can change them in the panel without a redeploy.
LLM rate limiting per API key
The first stop in the path is Identify: the gateway checks the client key and applies its rate limit. A bad key is 401 invalid_api_key. A key over its rate limit is 429 rate_limit_error.
The rate limit is a fixed window per key, 600 requests a minute by default, counted in Redis. That is LLM rate limiting per API key, on the gateway, before a provider is called and before tokens are reserved against the daily or monthly cap.
The default is a request count, not a token count. A burst of short prompts and a burst of long ones are limited the same way at this stop. Token ceilings are the next stop. The two are complementary: the rate limit bounds how hard a key can hit the gateway in a minute; the caps bound how many tokens that key can spend in a day or a month.
Bodies above 10 MiB are refused with 413. That is a request-size cap, not a rate limit, but it sits in the same set of controls, and it also fires before the upstream call.
Daily and monthly token caps
The order of the path is the order in the code. After Identify, the prompt is inspected for secrets, and then the gateway reserves tokens against the key's daily and monthly caps. Over the cap is HTTP 429 quota_exceeded, returned before the upstream call. The request does not go on to routing, cache, or the provider.
The site does not publish the numeric default for those token caps. It says that defaults apply to every key, and that they are meant to suit most companies on first start. Whatever those defaults are, you can override them per key, immediately, without a redeploy.
Because reservation happens before the later stops, a key that is already over its cap does not get a cache write, a routing decision, or an upstream request out of that call. The client gets a named error and can try later, or you can raise the cap in the panel.
What the client sees
Each exit has a name:
- 401
invalid_api_key— the client key was not accepted - 429
rate_limit_error— the key exceeded its request-rate window - 429
quota_exceeded— the key exceeded a daily or monthly token cap - 413 — the request body was above 10 MiB
An engineer who is blocked can see why. A platform team can see which key hit which limit in the panel. That is more useful than a generic 429 from a provider, arriving after the model has already run, with no link back to a person or a team key.
Seeing usage: the panel and Prometheus metrics
Controls without visibility turn into arguments about what happened last week. The admin panel is built into the binary. It shows per-key usage, cost, cache results, and request history. Usage, cost, cache result, and latency are written off the response path, so recording is not sitting on the hot return.
The same process exposes counters at a Prometheus /metrics endpoint. The site does not list the metric names. What it states is that the counters are there, alongside the per-key view in the panel.
The records reference a key id, never the key. Events are kept 90 days, daily buckets 35 days, monthly buckets 14 months, then pruned. That is the retention the product states, not a compliance claim.
What happens if Redis is down
The rate limit is counted in Redis. The exact cache is held there too. If Redis goes down, the exact cache and the rate limit switch off, and traffic keeps flowing to the providers. The process is built to degrade rather than stop.
That is worth planning for. While Redis is down, LLM rate limiting per API key is not enforced. Daily and monthly token-cap records live in SQLite, not in Redis. The site does not spell out token-cap behaviour in that failure mode beyond the sentence above: the exact cache and the rate limit switch off, and traffic keeps flowing. Do not assume more than that.
Redis is optional. If you never run it, you do not get the exact cache or the rate limit. Traffic can still flow, and the other controls in the binary still sit in front of the provider. If you do run Redis, the site tells you to give it a password or TLS on a private network; that advice is about cached answers, which are not encrypted, but it is the same Redis the rate limiter uses.
What you can change without a redeploy
Defaults apply on first start. Everything in the four controls — including quotas and limits — can be changed in the panel without a redeploy. Per-key overrides take effect immediately.
That is the operational difference between a gateway in front of Claude Code and Codex, and a policy you ask people to remember. The ceiling is on the key, it is enforced before the provider is called, and you can see what happened.
The product page is at qosway.com.
Request a demo – hello@qosway.com