Skip to main content
Two kinds of limits apply to API keys:
  • Spend limits cap how much money can be spent in a period. They are the main control for Model Gateway keys.
  • Rate limits cap requests and tokens per minute so one key or workspace cannot crowd out others. They protect fairness, not your budget.
A request has to pass both. When a limit is reached, Langdock refuses the request with 429 before it reaches the model. It never switches an API request to a cheaper model.

Spend limits

Your personal limit is the higher of your seat default and your group limit, unless an admin set a personal limit for you. On BYOK and dedicated deployments a personal limit adds to the seat or group limit instead. Your keys page shows whether your keys can spend right now and, if not, which step is missing and who can fix it.
Model Gateway spend uses the same budget as your chat and agent usage. A busy coding session can use up the budget you also need in chat, so ask your admin for a limit that fits both.

Rate limits

Admins see each model’s limit and its busiest minute in the last 7 days under Model Gateway > Limits > Quotas & limits (or API > Model quotas before the Model Gateway), and can request more there. A higher limit does not change the price per token. For your own models on a BYOK workspace, the token limit caps the estimated size of a single request instead of a per minute total.

Cached tokens

Uncached input, cache writes and output always count toward the token limit. Cache reads count the way the provider that served the request counts them: This is why OpenAI models have a higher default token limit. Cache reads are still billed at the provider’s cache read price.

Agent runs

Running an agent through the API, with POST https://api.langdock.com/agent/v1/chat/completions or the ask_agent tool of the Agent MCP server, goes through the same checks before the run starts: requests and tokens per minute for the agent’s model, the spend limit of the key, and the agent’s budget. Spend limits are checked again between steps, so a run that reaches a limit stops with 429 instead of continuing on another model. An agent run’s cost appears under Agent runs in the key’s spend, not per model.

Response headers

Both hosts send Retry-After (in seconds) on a 429 where waiting helps. A request that is too large for the token limit on its own, or a spend limit, has no Retry-After, because waiting does not help. The classic endpoints also send x-ratelimit-limit-requests, x-ratelimit-remaining-requests, x-ratelimit-limit-tokens and x-ratelimit-remaining-tokens. Retry 429 and 5xx responses with exponential backoff and honor Retry-After. Do not retry 400, 401, 403 or 404, they fail again.

Cost in each response

Responses from gateway.langdock.com carry the request’s estimated cost in US dollars in their final usage object (usage.cost, usage.is_byok, usage.cost_details). See the quickstart. The settled cost, which your spend limit and invoice use, can differ slightly and is billed in your workspace currency.

See your usage

Last used counts every API request of a key on both hosts, not only model calls. Per person figures are hidden when your workspace turns off user level data.