> ## 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.

# Billing

> OpenPAI's charging rules for tokens, multipliers, cache and thinking

OpenPAI uses a **prepaid + token-based billing** model, consistent with OpenAI.
This page explains how the actual charge for each call is computed.

## Billing components

Every successful call produces the following usage items:

| Item                | Meaning                                                                                                        |
| ------------------- | -------------------------------------------------------------------------------------------------------------- |
| `prompt_tokens`     | Input tokens you send to the model (including system / messages / tools and everything else).                  |
| `completion_tokens` | Output tokens the model returns (visible content).                                                             |
| `reasoning_tokens`  | Invisible chain-of-thought tokens from reasoning models (only o3 / GPT-5 / Claude thinking / Gemini thinking). |
| `cached_tokens`     | Input tokens that hit the prompt cache.                                                                        |

## Charging formula

```
charge =
    (prompt_tokens     × input price)
  + (completion_tokens × output price)
  + (reasoning_tokens  × output price)
  + (cached_tokens     × cache price)
  × user group multiplier
```

Where:

* **Input / output / cache prices** come from each model's official pricing, converted to RMB as **USD price per million tokens × OpenPAI multiplier × exchange rate**.
* **User group multiplier**: determined by your account's group; see [Core concepts](/en/introduction/concepts).
* **Cache price** is typically 0.1× to 0.5× of the input price; see [Cache billing](/en/pricing/cache-billing).

## Console log example

After a call, the **Logs** page shows token and billing details (without prompt / response content):

| Field                                     | Example                |
| ----------------------------------------- | ---------------------- |
| Model                                     | `gpt-5.5`              |
| Input / output / cache / reasoning tokens | `1024 / 512 / 800 / 0` |
| Multiplier                                | `1.0×`                 |
| Actual charge                             | `¥0.0034`              |
| Request ID                                | `req_01ab...`          |

## Billing by model type

<AccordionGroup>
  <Accordion title="Chat (Chat / Responses)">
    Charged by `prompt_tokens` + `completion_tokens`.
    If prompt caching is used, the cache-hit portion is settled at the cache price.
  </Accordion>

  <Accordion title="Reasoning (o3 / GPT-5 / Claude thinking)">
    `reasoning_tokens` are billed **additionally** at the output price (invisible but they consume compute).
    The console log breaks out thinking vs. answer tokens.
  </Accordion>

  <Accordion title="Embeddings">
    Charged by `prompt_tokens` (input) only; there is no output.
  </Accordion>

  <Accordion title="Image generation (DALL·E / gpt-image-1)">
    Charged by **number of images + size**, a fixed charge per call.
  </Accordion>

  <Accordion title="Audio (TTS / Whisper)">
    TTS is charged by **input character count**; Whisper is charged by **audio duration (seconds)**.
  </Accordion>

  <Accordion title="Midjourney / Suno">
    Asynchronous task model, charged by **number of tasks + action type**. Failed tasks are not billed.
  </Accordion>

  <Accordion title="Rerank">
    Charged by the **total tokens of (query + all documents)**.
  </Accordion>
</AccordionGroup>

## Are failed requests billed?

| Situation                                         | Billed?                                         |
| ------------------------------------------------- | ----------------------------------------------- |
| 4xx client error (bad params, auth failure)       | ❌ Not billed                                    |
| 5xx upstream error that auto-retries successfully | ✅ Billed for the successful attempt             |
| All channels fail, client finally gets a 5xx      | ❌ Not billed                                    |
| Streaming response disconnects midway             | Billed by tokens actually generated             |
| Client abort                                      | Billed by tokens the upstream already generated |

## Out of balance

When account balance ≤ 0, all **paid model** calls immediately return `insufficient_quota` (HTTP 403).
Some free models (such as Moderations) remain usable.

## Check your spend

* Console → **Logs**: per-call details.
* Console → **Usage statistics**: spend charts aggregated by day / model / token.
* API:
  * [GET /v1/dashboard/billing/usage](/en/api-reference/account/usage) — spend over a time range
  * [GET /v1/dashboard/billing/subscription](/en/api-reference/account/balance) — current balance
* Response headers: every API response includes `X-OpenPAI-Quota-Consumed` and `X-OpenPAI-Remaining-Quota`.

## Price changes

* **New models**: launched at the official price converted at integration time.
* **Official price changes**: OpenPAI follows the upstream, announced 24 hours in advance in the console.
* **Price cuts / promotions**: pushed from time to time, subject to the console banner.

## More

<CardGroup cols={2}>
  <Card title="Quota & tokens" icon="key" href="/en/pricing/quota">
    Account quota, token quota, expiry and transfers.
  </Card>

  <Card title="Cache billing" icon="database" href="/en/pricing/cache-billing">
    OpenAI / Claude / DeepSeek prompt-cache details.
  </Card>
</CardGroup>
