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

# Quota & tokens

> Account quota, token quota, expiry and refund mechanics

OpenPAI has **two levels of quota**: account quota and token quota. Every call is constrained by both.

## Account quota

The account quota is the total balance of the whole account, increased by **top-ups** or **redemption codes** and decreased by **API calls**.

* **Currency**: Renminbi (¥).
* **Precision**: 6 decimal places (supports very small charges).
* **Expiry**: none.

## Token quota

Each token can be configured with its own maximum spend.

| Setting | Meaning                                                                                   |
| ------- | ----------------------------------------------------------------------------------------- |
| `-1`    | Unlimited, uses the full account balance                                                  |
| `100`   | This token may spend up to ¥100 in total; once reached, requests return `quota_exhausted` |

<Tip>For team / external collaboration, we strongly recommend setting a concrete quota cap to prevent a single key from spending the whole account balance uncontrollably.</Tip>

## Dual checks

Each call checks, in order:

1. Whether the token is enabled, not expired, and within the model allowlist.
2. Whether the token's remaining quota ≥ the estimated charge (pre-authorization).
3. Whether the account balance ≥ the estimated charge.
4. After the call succeeds, it settles by actual usage (refunding or charging the difference).

If any condition fails, an error is returned immediately and no upstream request is made.

## Token expiry

If you set an **expiry** when creating a token:

* It is disabled from midnight on the expiry day; requests using the key return `401 invalid_api_key`.
* Expired tokens aren't deleted automatically — you can **extend the validity** or **delete/archive** them in the console.

## Redemption codes

A redemption code is a credential for quickly granting credit, supporting:

* Single redemption (one code, one use)
* Multiple redemption (shared by N people)
* Time-limited redemption (voided on expiry)

Credit obtained by redeeming goes to the **account balance**, not a specific token.

## Refunds

Unspent credit can be refunded under these rules:

* **Within 30 days**: refundable to the original payment method, minus payment-channel fees.
* **Over 30 days**: can only be transferred to another account or kept for future use — no original-route refund.
* **Crypto / redemption codes**: no cash refund, but the unspent portion can be voided.

The application method is subject to console announcements.

## Account merge / transfer

To transfer A's balance to account B:

1. Both accounts must be email-verified.
2. Submit a transfer request via a support ticket, subject to manual review (usually 1 business day).
3. For large transfers (>¥5000), use the business channel.

## Monitoring & alerts

* **Balance threshold alerts**: set a low-balance threshold under **Profile settings → Notifications** to trigger an email alert.
* **Daily spend summary**: opt-in subscription that sends yesterday's spend each day.
* **Enterprise account webhook**: lets callers integrate their own alerting system.
