> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate Limits & Quotas

> Understanding PromptGuard rate limiting and monthly quotas

## Overview

PromptGuard implements two types of limits to ensure fair usage and system stability:

1. **Monthly Request Quotas** - Based on your subscription plan
2. **Rate Limiting** - Maximum requests per minute (anti-abuse)

## Monthly Request Quotas

Your subscription plan determines how much usage you get per month, as usage credit at list prices:

| Plan | Monthly Limit | Over-Quota Behavior |
| - | - | - |
| **Free** | \$5 of usage | Hard block (`429` until you upgrade) |
| **Developer** | \$20 of usage | Continues at list prices to your spend cap (default \$100); `429` past the cap |
| **Enterprise** | Custom (per contract) | Soft limit (never blocks, custom alerts) |

These apply to every counted request, on every endpoint: the proxy, [`POST /api/v1/guard`](https://docs.promptguard.co/api-reference/guard) and [`POST /api/v1/security/scan`](https://docs.promptguard.co/api-reference/security-endpoints#scan-endpoint) alike. The full list of what counts is in [Plans & Limits](https://docs.promptguard.co/pricing.md#how-usage-is-calculated). Scans from the Shadow AI [desktop agent](https://docs.promptguard.co/shadow-ai/desktop-agent.md) count against the same quota but are never refused for it.

### Hard vs Soft Limits

**Free plan** uses a **hard limit**:

* When you have spent your \$5 of usage for the month, requests return `429 Too Many Requests`
* Upgrade to Developer (\$20 of usage a month) to continue

**Developer plan** uses a **soft quota with a hard spend cap**:

* When you have spent your \$20 of usage credit, requests continue processing
* Past the credit, Requests are billed at the same list prices, on by default
* You receive email alerts at 80%, 90% and 100% of the credit ([how quota warnings work](https://docs.promptguard.co/pricing.md#reaching-your-limit))
* Spending is bounded by your cap (default \*\*$100**, up to $10,000); past it requests return `429 spending_limit_exceeded` until you raise it
* Set the cap to **\$0** to stop at the credit instead of paying overage

Example (Developer plan):

```bash theme={"system"}
# You're on Developer ($20 of usage credit a month), spend cap left at the $100 default
# The $20 credit is spent, and Requests past it are billed at list prices

# Request still works, and is metered:
curl https://api.promptguard.co/api/v1/chat/completions \
  -H "X-API-Key: your_api_key" \
  -H "Authorization: Bearer YOUR_OPENAI_KEY" \
  -d '{"model": "gpt-5-nano", "messages": [...]}'

# Returns: 200 OK (not 429)
# Once the next Request would take spending past $100: 429 spending_limit_exceeded
```

### Checking Your Usage

View current usage in the dashboard:

```
Dashboard → Billing → Usage
- Credit used and remaining for the month
- Next Reset: January 15, 2025
```

Or via API:

```bash theme={"system"}
curl https://api.promptguard.co/api/v1/usage/stats \
  -H "X-API-Key: your_api_key"

{
  "plan": "pro",
  "credit_usd": 20.0,
  "credit_used_usd": 12.5,
  "credit_remaining_usd": 7.5,
  "reset_date": "2025-01-15T00:00:00Z",
  ...
}
```

## Rate Limiting

PromptGuard enforces per-plan, **per-account** rate limits on all `/api/v1/*` endpoints:

| Plan | Rate Limit |
| - | - |
| **Free** | 60 requests/minute |
| **Developer** | 600 requests/minute |
| **Enterprise** | 1,000 requests/minute |

These limits apply to your whole account; adding more API keys does not increase them, and neither does creating more organizations. The account is the one that pays: every organization you own shares your plan's limit, and a teammate's keys in your organization get your plan's limit, whatever plan they are on themselves. The one exception is a [client organization a managed service provider created](https://docs.promptguard.co/platform/msp.md) (a Managed Organization, which has no owner of its own): each one gets **its own** budget, at its provider's plan limit, so one client cannot spend the minute of the provider's other clients or of the provider's own keys. Once the client has an owner of its own, its keys spend that owner's budget like any other organization's. The budget refills at the start of each minute. Scans from an enrolled Shadow AI device neither count toward it nor are refused by it. Separately, a Cloud Armor anti-abuse layer enforces a per-IP request limit at the network edge. The per-IP limit is independent of your plan and exists to block abusive traffic.

### Per-key limits

Because the plan's limit is shared by every key in the account, one key that leaks or runs away can spend the whole minute and leave your other keys refused. To contain that, give a key a requests-per-minute limit of its own: **Dashboard → API Keys → ⋯ → Rate limit**. In a team organization only its admins can set or remove it, including on a key a member created; in your personal organization you can. Every change is recorded in the [audit log](https://docs.promptguard.co/platform/audit-logs.md) as `api_key_rate_limit_changed`, with the limit before and after.

* The key is held to **both** limits, and whichever is lower refuses first. A per-key limit never raises your plan's.
* A request refused by the key's own limit does **not** count toward the account's budget, so your other keys keep theirs.
* It takes a whole number of at least 1; a value above the maximum is refused with a message that names it. Leave the field empty to remove the limit, and the key is held to the plan's alone.
* It counts in the same one-minute window as the plan's limit and refills at the same moment. It is enforced on self-hosted installs as well, where the plan limits are not.
* Rotating the key carries its limit to the new key.
* A key created over the API can be given one with `rate_limit_per_minute` ([Create API key](https://docs.promptguard.co/api-reference/api-keys.md#create-api-key)), and must be when the calling key has one.
* An enrolled Shadow AI device's key cannot take one, because device scans are never rate limited (`409 device_credential_rate_limit`). A teammate who is not an admin is refused with `403 api_key_rate_limit_admin_only`.

### Rate Limit Headers

Every `/api/v1/*` response carries the limit the key is held to and the window reset:

```bash theme={"system"}
HTTP/1.1 200 OK
X-RateLimit-Limit: 600
X-RateLimit-Reset: 1708128060
```

| Header | Always present | Description |
| - | - | - |
| `X-RateLimit-Limit` | Yes | Max requests per minute for this key: your plan's limit, or the key's own where that is lower |
| `X-RateLimit-Reset` | Yes | Unix timestamp when the plan window resets |
| `X-RateLimit-Remaining` | **No** | Budget left in the **per-IP anti-abuse** window, a different counter from `X-RateLimit-Limit` |

> [!WARNING]
>
> `X-RateLimit-Remaining` does **not** count down against `X-RateLimit-Limit`. It
> is emitted by the network-edge anti-abuse layer, tracks a per-IP window rather
> than your plan, and is absent on many responses. Do not build backoff logic that
> requires it, use `X-RateLimit-Limit` with `X-RateLimit-Reset`, and treat a `429`
> plus `Retry-After` as the authoritative signal.

### Handling Rate Limits

If you exceed your plan's per-minute rate limit, or a key's own, you'll receive a `429 Too Many Requests` response:

```json theme={"system"}
{
  "error": {
    "message": "Rate limit exceeded: your plan allows 600 requests per minute. Please retry later.",
    "type": "rate_limit_exceeded",
    "code": "rate_limit_exceeded",
    "retry_after": 42
  }
}
```

The `type` and `code` are the same whichever limit refused; the message says which (`your plan allows …` or `this API key allows …`). `retry_after` (and the `Retry-After` header) is the number of seconds until the minute ends and your budget refills.

**Recommended handling**:

```python theme={"system"}
import time
import openai

def make_request_with_retry(prompt, max_retries=3):
    for attempt in range(max_retries):
        try:
            response = openai.ChatCompletion.create(
                model="gpt-5-nano",
                messages=[{"role": "user", "content": prompt}]
            )
            return response
        except openai.RateLimitError as e:
            if attempt < max_retries - 1:
                # Exponential backoff
                time.sleep(2 ** attempt)
            else:
                raise
```

## Idempotency Keys

For safe retries of POST/PUT/PATCH requests, include an `Idempotency-Key` header:

```bash theme={"system"}
curl -X POST https://api.promptguard.co/api/v1/chat/completions \
  -H "X-API-Key: your_api_key" \
  -H "Idempotency-Key: unique-request-id-12345" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5-nano", "messages": [...]}'
```

If you retry the same request with the same idempotency key within 24 hours, you'll get back the cached response with an `X-Idempotency-Replayed: true` header. This prevents duplicate operations.

> [!NOTE]
>
> Idempotency keys are scoped to your API key and expire after 24 hours.

## Best Practices

### 1. Implement Exponential Backoff

```javascript theme={"system"}
async function makeRequestWithBackoff(prompt, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try:
      return await openai.chat.completions.create({
        model: "gpt-5-nano",
        messages: [{ role: "user", content: prompt }]
      });
    } catch (error) {
      if (error.status === 429 && i < maxRetries - 1) {
        await new Promise(resolve =>
          setTimeout(resolve, Math.pow(2, i) * 1000)
        );
      } else {
        throw error;
      }
    }
  }
}
```

### 2. Monitor Usage Proactively

Set up monitoring to alert before you hit limits:

```python theme={"system"}
# Check usage before making request
usage = client.get_usage()
if usage['requests_used'] > usage['requests_limit'] * 0.9:
    send_alert("Approaching monthly quota limit")
```

### 3. Batch Requests When Possible

Instead of:

```python theme={"system"}
for prompt in prompts:
    response = openai.ChatCompletion.create(...)  # 100 API calls
```

Use batch processing:

```python theme={"system"}
# Combine prompts where appropriate
combined_prompt = "\n".join(prompts)
response = openai.ChatCompletion.create(
    messages=[{"role": "user", "content": combined_prompt}]
)  # 1 API call
```

### 4. Cache Responses

Cache frequently requested results:

```python theme={"system"}
import hashlib
import redis

cache = redis.Redis()

def get_cached_response(prompt):
    cache_key = hashlib.sha256(prompt.encode()).hexdigest()
    cached = cache.get(cache_key)

    if cached:
        return json.loads(cached)

    response = openai.ChatCompletion.create(...)
    cache.setex(cache_key, 3600, json.dumps(response))  # 1 hour TTL
    return response
```

## Upgrading for Higher Limits

Need higher rate limits or custom quotas?

**Enterprise plans** offer:

* The highest per-minute limit (1,000/min)
* Custom monthly request quotas
* IP allowlisting for API access control
* Idempotency keys for safe retries
* Support and availability terms agreed in your contract

Contact us at [sales@promptguard.co](mailto:sales@promptguard.co) for Enterprise pricing.

## Frequently Asked Questions

### Why do different plans have different rate limits?

Rate limits scale with your plan tier (Free: 60/min, Developer: 600/min, Enterprise: 1,000/min). These are per-account limits, except that each client organization a managed service provider created has its own budget at the provider's limit (see [Rate Limiting](#rate-limiting)). The Cloud Armor per-IP limit is a separate anti-abuse layer at the network edge.

### What happens if I consistently go over my monthly quota?

On Free, requests are blocked with 429 errors until you upgrade. Developer keeps processing past its credit at list prices, up to your spend cap; past the cap requests return 429 until you raise it. Enterprise continues processing per contract. On every plan you are emailed at 80%, 90% and 100% of the quota, subject to your **Email Alerts** setting, and on a paid plan the dashboard shows a banner from 90%; [Reaching your limit](https://docs.promptguard.co/pricing.md#reaching-your-limit) has the details.

### Can I increase my rate limit?

By moving to a plan with a higher limit. Each plan's per-minute limit is fixed, and there is no per-organization override. You can set a **lower** limit on a single key (see above) to stop one key spending the whole budget.

### Do retries count against my quota?

Yes. Every request to our API counts, including retries. Implement smart retry logic with exponential backoff to minimize wasted quota.

### How is usage calculated?

One request = one call to a counted endpoint (the proxy, `/api/v1/guard`, `/api/v1/security/scan` or `/api/v1/security/redact` -- the full list is in [Plans & Limits](https://docs.promptguard.co/pricing.md#how-usage-is-calculated)), regardless of:

* Number of tokens
* Response length
* Model used

## Monitoring Tools

### Dashboard Analytics

Track usage in real-time:

* Current period usage
* Daily/weekly/monthly trends
* Over-quota events
* Rate limit hits

### Usage API

Programmatically monitor usage:

```bash theme={"system"}
curl https://api.promptguard.co/api/v1/usage/stats \
  -H "X-API-Key: your_api_key"
```

Returns:

```json theme={"system"}
{
  "daily_usage": [
    {"date": "2025-10-11", "requests": 5234},
    {"date": "2025-10-10", "requests": 4892},
    ...
  ],
  "total": 35789,
  "limit": 100000,
  "remaining": 64211
}
```

## Need Help?

* **Questions**: [support@promptguard.co](mailto:support@promptguard.co)
* **Enterprise Limits**: [sales@promptguard.co](mailto:sales@promptguard.co)
* **Technical Issues**: [support@promptguard.co](mailto:support@promptguard.co)

***

## Next steps

> [card] [Error handling](https://docs.promptguard.co/production/error-handling.md)
>
> Every error code the API returns and how to handle it

> [card] [Usage tracking](https://docs.promptguard.co/platform/usage-tracking.md)
>
> Allowance used, spend this cycle, tokens per model

> [card] [Pricing](https://docs.promptguard.co/pricing.md)
>
> Plan limits, quotas and how usage is counted


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.