Reserved versus spent: how output caps meet usage quotas

APIKeyClaudeFree · Updated 2026-11-22 · 8 min read

Reserved restaurant table with empty plates
Some limiters reserve capacity for the cap before the answer exists.

A familiar puzzle for heavy users of AI apps: the usage meter shows a quarter of the allowance remaining, ordinary messages still go through, yet a heavier feature such as a deep research mode refuses to start until the window resets. It looks like the service is predicting how much the task will cost and saying no in advance. Developers hit a similar wall with APIs, where a request with a large max_tokens is throttled while smaller ones pass.

This article explains the mechanics behind that behaviour in general terms: what max_tokens actually controls, why rate limiters and quota systems may look at it before generation starts, and how to choose values that give long answers room without tripping limits or wasting budget. It applies to most hosted model APIs and apps; always confirm specifics in your own provider's documentation.

Frequently asked questions

What does max_tokens do?

It sets the maximum number of tokens the model may generate in its reply. Generation stops when the model finishes naturally or reaches this cap, whichever comes first. It does not force the model to write that much.

Am I billed for max_tokens or for actual output?

On typical metered APIs, you are billed for tokens actually generated, not for the cap. Check your provider's pricing page to confirm how it counts, especially for reasoning tokens.

Why would a limit check use max_tokens before generation?

A rate limiter has to decide whether to admit a request before knowing how long the answer will be. Some systems use the requested cap as a worst-case estimate, then correct the count after the response finishes.

How does a usage window in an app differ from API rate limits?

App windows are usually measured in a provider-defined unit over a rolling period and may weigh features differently. API limits are typically requests and tokens per minute or day. The two systems are separate even when the same company runs both.

Why can a heavy feature be blocked while normal chat works?

Heavy features like research modes may run many steps and long outputs. If the service estimates the whole job's cost up front and your remaining allowance is below that estimate, it can refuse to start even though smaller messages still fit.

Does reasoning mode change how I should set max_tokens?

Yes. Reasoning output counts toward generated tokens on many APIs. On the free-ai endpoint, for example, you should set max_tokens to 2000 or more when enabling reasoning, or the answer may be cut short.

Which is better, a high cap on every request or a tuned cap per task?

A tuned cap. High caps everywhere can trigger throttling on systems that reserve capacity up front and allow runaway outputs. Set caps that comfortably fit each task's expected answer.

What max_tokens controls, and what it does not

The parameter is a ceiling on output length. When the model reaches it, generation stops mid-thought, and the API usually signals this with a finish reason such as length. If the model finishes earlier, the cap has no effect on the answer at all.

It does not make answers longer or more detailed. Asking for a 300-word reply with a cap of 8,000 tokens still yields about 300 words. What it changes is the worst case: how much the model is permitted to produce if it keeps going.

Truncation is silent unless you check

Many applications never look at the finish reason. A response cut off at the cap looks like a complete but oddly abrupt answer. Always check whether the reply ended naturally before using it.

Input and output share the window

The cap must fit within what remains of the context window after the input. A long prompt plus a high cap can exceed the window, and some APIs reject such requests outright.

Why limiters look at the cap up front

A rate limiter admits or rejects a request at the moment it arrives. At that moment, nobody knows how long the answer will be. The system knows the input size and the requested cap, and nothing else. To avoid admitting more work than capacity allows, some limiters count the cap as a provisional cost, then adjust once the real output size is known.

The practical effect is that a request asking for a very large cap can be throttled even if it would have produced a short answer. Lowering the cap to something realistic often makes the same request go through immediately. Providers document this differently, so read your own provider's rate-limit page to see whether and how it applies.

Concurrency multiplies the effect

Ten parallel requests each with a large cap can reserve a large slice of a per-minute budget at once. Even if most finish quickly, the burst may trigger 429 responses for a few seconds.

Car fuel gauge at a quarter tank
Remaining allowance may cover short trips but not a long journey.

Why app features refuse to start

Consumer apps add another layer. Their usage windows often measure something more abstract than raw tokens and may weigh features differently: a research run that performs many searches and writes a long report costs far more than a short chat message. A service may estimate a feature's cost before launching it and decline if your remaining allowance is below that estimate.

From the user's side, this feels like the meter is lying. It is more accurate to think of it as the meter showing your balance while the feature checks whether the balance covers a large expected bill. Short messages still fit; a big job does not.

Lighter modes as a workaround

If a deep research mode is blocked, an ordinary chat with a focused question and a couple of pasted sources often gets you most of the way, at a fraction of the cost.

  • Remaining allowance is enough for small requests but not for a heavy run.
  • The estimate may be conservative, so the run might have fit in practice.
  • Waiting for the window to reset, or using a lighter mode, are the usual options.
  • Exact rules are set by the provider and can change; check their help pages.

Choosing a sensible cap for each task

Estimate the longest reasonable answer for the task, then add a margin. A classification label needs a few tokens. A short email reply needs a few hundred. A long rewrite of a document may need several thousand. Set the cap accordingly rather than using one large value everywhere.

Keep a small table of task types and their caps in your code. It documents your assumptions, makes behaviour predictable and keeps worst-case costs bounded if the model ever runs on.

Treat a length stop as a signal

If a task regularly hits its cap, either the cap is too low or the prompt invites overly long answers. Adjust one or the other instead of silently accepting truncated output.

from openai import OpenAI

client = OpenAI(base_url="https://api.apikeyclaudefree.com/v1", api_key="not-needed")

CAPS = {"label": 20, "reply": 600, "summary": 1200, "rewrite": 6000, "reasoning": 3000}

def ask(task: str, prompt: str, reasoning: bool = False) -> str:
    kwargs = {}
    if reasoning:
        kwargs["extra_body"] = {"reasoning": True}
    resp = client.chat.completions.create(
        model="free-ai",
        messages=[{"role": "user", "content": prompt}],
        max_tokens=CAPS["reasoning"] if reasoning else CAPS[task],
        **kwargs,
    )
    choice = resp.choices[0]
    if choice.finish_reason == "length":
        raise RuntimeError(f"{task}: answer hit the cap of {resp.usage.completion_tokens} tokens")
    return choice.message.content

print(ask("reply", "Write a two-sentence reply declining a meeting politely."))
Measuring jugs of different sizes
Match the output cap to each task's expected length.

Reasoning tokens and caps

Models with a reasoning or thinking mode generate internal steps before the visible answer. On many APIs, those steps count as output tokens and draw from the same cap. A cap that suits a direct answer may be exhausted by reasoning alone, leaving an empty or truncated reply.

When you enable reasoning, raise the cap. The free-ai endpoint on this site, for instance, accepts "reasoning": true and needs max_tokens of 2000 or more in that mode. Commercial providers have their own rules for thinking budgets; check their documentation for current parameters.

Reasoning is not always worth it

For simple formatting or extraction, reasoning adds cost and latency with little benefit. Enable it for multi-step problems and leave it off for routine calls.

Budget the visible answer separately

Think of the cap as reasoning plus answer. If you expect 500 tokens of answer and up to 2,000 of reasoning, set the cap above 2,500 to be safe.

Planning around daily token budgets

Daily limits count actual usage, input plus output, so caps matter mainly for bursts and worst cases. A batch job of thousands of requests with generous caps can still finish well under budget if answers are short. The risk is a prompt that accidentally invites long outputs, multiplying spend across the batch.

Run a small sample first, look at the average and maximum completion tokens, and set caps just above the observed maximum. Then estimate the full batch: requests times average input plus output. Compare that with your daily allowance before starting.

Free endpoint limits as an example

The keyless API here allows, per IP, about 10,000 requests or 10 million tokens per day, resetting at 00:00 UTC, with one request per second and two in parallel. A batch planned around those figures runs smoothly; one that ignores them meets 429 responses with a Retry-After header.

Hourglass beside a notebook
Respect Retry-After instead of retrying in a tight loop.

Handling rejections gracefully

When a request is rejected for rate or quota reasons, the response usually says so with a status such as 429 and often a hint about when to retry. Respect it. Retrying immediately in a loop makes things worse and can extend the throttling.

For quota exhaustion rather than short-term rate limits, retrying will not help until the window resets. Distinguish the two in your error handling: back off and retry for rate limits, pause or switch to a fallback for exhausted quotas.

Log usage per request

Record prompt and completion tokens from every response. A simple log shows which task types consume your budget and where a lower cap or shorter prompt would help most.

import time
import requests

URL = "https://api.apikeyclaudefree.com/v1/chat/completions"
payload = {"model": "free-ai", "max_tokens": 300,
           "messages": [{"role": "user", "content": "Name three uses of a context window."}]}

for attempt in range(5):
    r = requests.post(URL, json=payload, timeout=120)
    if r.status_code == 429:
        time.sleep(float(r.headers.get("Retry-After", "2")))
        continue
    if r.status_code == 503:
        time.sleep(3)
        continue
    r.raise_for_status()
    print(r.json()["choices"][0]["message"]["content"])
    break

Free model or paid provider for heavy jobs

Long research runs and big batch rewrites are where quotas bite hardest. Paid commercial APIs, including Anthropic's for Claude, offer higher limits as your account grows and models that produce better long-form output; check their current pricing and rate-limit pages. This site is not affiliated with Anthropic, and the free-ai model it serves is not Claude. It is an independent open-weight model of about 35B parameters, useful for prototyping and routine volume.

Whichever you use, the same habits apply: realistic caps, a check on finish reasons, backoff on 429 and a budget estimate before large runs. For more on reducing input size, which is usually the larger share of usage, see why token counts differ and sizing the context a task needs.

Split heavy jobs into smaller runs

A long research or rewrite job broken into several focused requests is easier to admit under any limiter, recovers better from a single failure and lets you stop early if the first results show the approach is not working.

Avoid shared-key shortcuts

Hitting limits tempts people toward keys posted online or cheap resold access. Those keys are someone else's account, get revoked without warning and expose your prompts to strangers. Waiting for a reset or using a free keyless model is the safer path.

Open ledger with a calculator
Logging usage per request shows where the budget goes.
Try the free API

Send a test prompt to the keyless free-ai endpoint from the chat box on the home page, no sign-up or key required.

Read also