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

# Rate Limits

> Per-endpoint rate limits, per-org quotas, trial vs paid tier limits, and how to check your usage.

## API Rate Limit

All API endpoints share a global rate limit based on your API key.

| Parameter               | Value       |
| ----------------------- | ----------- |
| **Requests per window** | 50          |
| **Window duration**     | 60 seconds  |
| **Scope**               | Per API key |

When the limit is exceeded the backend returns **HTTP 429** with these headers:

| Header                  | Description                              |
| ----------------------- | ---------------------------------------- |
| `X-RateLimit-Limit`     | Maximum requests allowed in the window   |
| `X-RateLimit-Remaining` | Requests remaining in the current window |
| `X-RateLimit-Reset`     | Seconds until the window resets          |
| `Retry-After`           | Seconds to wait before retrying          |

The SDK raises `RateLimitError` with a `retry_after` attribute you can use to sleep and retry.

```python theme={"system"}
from valiqor import RateLimitError
import time

try:
    result = client.eval.evaluate(dataset=data, metrics=["coherence"])
except RateLimitError as e:
    time.sleep(e.retry_after or 5)
    result = client.eval.evaluate(dataset=data, metrics=["coherence"])
```

***

## Monthly Quotas

### API Call Quotas

Each organisation has a monthly API call quota that resets automatically.

| Tier           | Monthly API Calls |
| -------------- | ----------------- |
| **Free**       | 100               |
| **Pro**        | 1,000             |
| **Enterprise** | 10,000            |

### Token Quotas

A separate token-based quota tracks LLM token consumption across all services.

| Tier        | Monthly Token Quota |
| ----------- | ------------------- |
| **Default** | 1,000,000 tokens    |

When either quota is exceeded the backend returns **HTTP 429**. The SDK raises `QuotaExceededError` (for API call quotas) or `TokenQuotaExceededError` (for token quotas).

```python theme={"system"}
from valiqor import QuotaExceededError, TokenQuotaExceededError

try:
    result = client.failure_analysis.run(dataset=data)
except TokenQuotaExceededError as e:
    print(f"Token quota exceeded: {e.current_tokens}/{e.token_limit}")
except QuotaExceededError as e:
    print(f"API quota exceeded: {e.current_usage}/{e.quota_limit}")
```

***

## Trial Limits

Users who have **not verified their email** operate in trial mode.

| Limit                | Value                              |
| -------------------- | ---------------------------------- |
| **Rows per run**     | 25 (dataset is silently truncated) |
| **Total trial runs** | 3                                  |
| **After 3 runs**     | Blocked until email is verified    |

Trial limits apply equally to Evaluation, Security Audit, and Failure Analysis.

<Tip>
  Run `valiqor verify` to verify your email and unlock 50 free runs on the free tier.
</Tip>

***

## Dataset Size Limits

| Limit                         | Value |
| ----------------------------- | ----- |
| **Maximum items per request** | 1,000 |

Applies to `evaluate()`, `audit()`, and `failure_analysis.run()`. The SDK raises `DatasetTooLargeError` if the limit is exceeded.

```python theme={"system"}
from valiqor import DatasetTooLargeError

try:
    result = client.eval.evaluate(dataset=large_dataset, metrics=["coherence"])
except DatasetTooLargeError as e:
    print(f"Dataset has {e.dataset_size} items, max is {e.max_allowed}")
```

***

## Playground Limits

The Failure Analysis playground (`client.failure_analysis.playground()`) has stricter limits because it is a lightweight, single-item endpoint.

| Limit                        | Value            |
| ---------------------------- | ---------------- |
| **Requests per minute**      | 2                |
| **Analyses per day**         | 10               |
| **Max input tokens**         | 4,000            |
| **Max input field length**   | 2,000 characters |
| **Max output field length**  | 5,000 characters |
| **Max context field length** | 5,000 characters |
| **Max tool calls**           | 5                |

***

## Other Limits

| Resource              | Limit                   |
| --------------------- | ----------------------- |
| **API keys per user** | 5                       |
| **Request timeout**   | 300 seconds (5 minutes) |

***

## Checking Your Usage

### SDK

```python theme={"system"}
from valiqor import ValiqorClient

client = ValiqorClient(api_key="vq_...")
usage = client.get_usage()

print(usage)
# Returns per-service API call counts, per-service token usage,
# quota limits, remaining quota, period start/end, and reset date.
```

### API

```bash theme={"system"}
curl -H "Authorization: Bearer vq_..." \
     https://api.valiqor.com/v2/auth/usage
```

The response includes:

| Field                     | Description                                     |
| ------------------------- | ----------------------------------------------- |
| `total_api_usage`         | Total API calls this period                     |
| `evaluation_usage`        | Eval API call count                             |
| `security_audit_usage`    | Security audit call count                       |
| `security_redteam_usage`  | Red team simulation call count                  |
| `tracing_usage`           | Trace upload call count                         |
| `scanner_usage`           | Scan upload call count                          |
| `failure_analysis_usage`  | FA API call count                               |
| `total_token_usage`       | Total tokens consumed this period               |
| `evaluation_tokens`       | Tokens used by evaluations                      |
| `security_audit_tokens`   | Tokens used by security audits                  |
| `security_redteam_tokens` | Tokens used by red team runs                    |
| `tracing_tokens`          | Tokens used by tracing                          |
| `scanner_tokens`          | Tokens used by scanner                          |
| `failure_analysis_tokens` | Tokens used by failure analysis                 |
| `api_quota_limit`         | Your plan's API call quota                      |
| `api_quota_remaining`     | API calls remaining this period                 |
| `token_quota_limit`       | Your plan's token quota                         |
| `token_quota_remaining`   | Tokens remaining this period                    |
| `period_start`            | Start of the current billing period             |
| `period_end`              | End of the current billing period               |
| `reset_date`              | When quotas reset (monthly)                     |
| `org_id`                  | Your organisation ID                            |
| `org_name`                | Your organisation name                          |
| `plan`                    | Your current plan (`free`, `pro`, `enterprise`) |

### CLI

```bash theme={"system"}
valiqor status
```

Shows authentication status, current configuration, cloud connection, and module availability.
