Skip to main content
Because MetrixLLM acts as the central choke point for all LLM traffic in your organization, it is the best place to enforce limits. If a rogue script or malicious user hits your application, the gateway will block the traffic before it ever reaches OpenAI or Anthropic, saving you from a massive bill.

Rate Limits

You can configure two types of rate limits:
  • RPM (Requests Per Minute): The maximum number of HTTP calls allowed.
  • TPM (Tokens Per Minute): The maximum number of estimated tokens allowed.
  • Cost (USD): The maximum spend allowed within the window.
When a rate limit is exceeded, the gateway immediately returns a 429 Too Many Requests status code. You can apply rate limits at two scopes:
  1. Workspace scope: Applies globally to all traffic in the workspace.
  2. Route scope: Configured within a Routing Rule to limit traffic to a specific endpoint (e.g. /v1/chat/completions).

Rate Limit Response Headers

Every response from the gateway includes rate limit headers so you can track usage in real-time: The {type} suffix corresponds to the limit type: requests, tokens, or cost. Example response headers:

429 Response Format

When a rate limit is exceeded, the gateway returns a JSON error body:

Budget Caps

A budget cap is a hard limit on USD spend over a specific time period.
  1. Navigate to Settings → Budgets.
  2. Set a monthly limit (e.g. $500.00).
  3. Set an alert threshold (e.g. 80%).
When the workspace spend hits the alert threshold, the gateway fires the budget.threshold webhook (see Alerts). When the total spend hits the hard limit ($500.00), the gateway completely stops processing requests. All new traffic will receive a 402 Payment Required response until the budget resets or is increased.

Rate Limit Actions

When a rate limit is hit, the gateway can take different actions based on your configuration: