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

# X402 Price Explanation

> Platform integration guide - Ace Data Cloud

This document explains how the pricing is determined when calling the Ace Data Cloud API using X402, and how it relates to the regular **Credits** pricing on the platform.

## Core Conclusion

X402 is not an independent pricing system. Each API call inherently has a cost measured in **Credits**, which is the only source of pricing shared across all billing methods (API Token deduction, account balance, X402 on-chain payment). X402 simply converts this Credits cost into on-chain USDC at a fixed exchange rate:

> **1 Credit = 0.095215 USDC** (i.e., `95215` atomic USDC, USDC is 6 decimal places)

In other words:

```text theme={null}
X402 Price (USDC) = The Credits cost of this call × 0.095215
```

This exchange rate is not arbitrarily set; it equals the platform's **optimal tier (bulk) Credits unit price**. Therefore, paying with X402 is approximately equivalent to purchasing Credits at the optimal tier price and then consuming them, **with no X402 premium**, instead directly enjoying the cheapest Credits unit price, without needing to pre-charge or use an API Token.

## Pricing Basis

| Item | Value | Description |
| - | - | - |
| Exchange Rate | `1 Credit = 0.095215 USDC` | A fixed rate set uniformly by the platform |
| Atomic Unit | `1 Credit = 95215 atomic USDC` | USDC 6 decimal places, `atomic = floor(credits × 0.095215 × 1e6)` |
| Minimum Charge | `1 atomic USDC` (\$0.000001) | Even with extremely low costs, at least 1 atomic is settled |
| Pricing Currency | USDC | Base / SKALE is ERC-20 USDC, Solana is SPL USDC |

The conversion is uniformly completed by the platform, and the amounts are consistent across all supported networks (Base, SKALE, Solana); different networks only differ in asset contracts and signature methods, with the same price.

### Relationship with Regular Credits Unit Price

Platform Credits are sold in a tiered manner where "the larger the usage, the lower the unit price." When billing by call, X402 uniformly uses the optimal tier unit price:

| Purchase/Payment Method | Approximate Credits Unit Price | Description |
| - | - | - |
| Entry / Small Recharge | About `$0.13 / Credit` | List price, unit price when buying small amounts of Credits |
| Large / Optimal Tier | `$0.095215 / Credit` | The cheapest unit price |
| **X402 Pay-per-call** | **`$0.095215 / Credit`** | **Always equals the optimal tier price** |

In other words, X402 settles each call at the optimal tier Credits unit price. Users who buy Credits with small recharges will have a higher unit price than X402; only users with large recharges will have a unit price that matches X402.

## Two Pricing Forms: `exact` and `upto`

In the 402 response of X402, `maxAmountRequired` is the amount you need to sign. It has two forms:

* **`exact` (fixed price)**: The price can be determined before processing the request (images, videos, music, search, order payment). `maxAmountRequired = The Credits cost of this call × 0.095215`, which is the amount payable for this call (consistent with `cost.amount` in the successful response).
* **`upto` (usage post-measurement)**: Interfaces like chat completion where "the number of tokens used is only known at the end of the response." `maxAmountRequired` is a **cap** (converted from the cap set by this model: cap Credits × 0.095215), and the actual settlement is based on real usage, not exceeding the cap.

For protocol details regarding these two schemes, see [`exact` and `upto` billing schemes](https://platform.acedata.cloud/documents/x402-metered-upto). Below, only pricing is discussed.

## Chat (Chat Completion) Pricing

Chat completion is measured as `upto`: billed based on actual usage of prompt/completion tokens. The price per million (1M) tokens = `The Credits cost of this model per 1M tokens × 0.095215`, which is completely consistent with the USD unit prices displayed in the platform's public model directory (`/api/v1/models?with_pricing=true`).

The following table shows the actual prices (taken from the model directory, calculated at the X402 exchange rate), in USD / 1M tokens:

| Model | Input / 1M | Output / 1M | `upto` Cap |
| - | - | - | - |
| gpt-4o-mini | \$0.0796 | \$0.3183 | 1 Credit (\$0.095215) |
| gemini-2.5-flash | \$0.1591 | \$1.3262 | 5 Credits (\$0.476074) |
| gpt-5 / gpt-5.1 | \$0.6631 | \$5.3050 | 20 Credits (\$1.904299) |
| gemini-2.5-pro | \$0.6631 | \$5.3050 | 50 Credits (\$4.760750) |
| gpt-4.1 | \$1.0610 | \$4.2440 | 20 Credits (\$1.904299) |
| claude-sonnet-4-5 | \$0.6006 | \$3.0028 | 50 Credits (\$4.760750) |
| grok-4 | \$1.5915 | \$7.9574 | 10 Credits (\$0.952149) |
| claude-opus-4-1 | \$3.0028 | \$15.0140 | 50 Credits (\$4.760750) |

Notes:

* The table shows the unit price measured by token; the cost of a single request = input tokens × input unit price + output tokens × output unit price.
* The `upto` cap is the maximum amount allowed to be signed for a single request for that model; it is not the actual deduction, as the vast majority of requests are far below the cap.
* The cap only determines "the maximum that could possibly be deducted," while the actual settlement is calculated based on token usage.

### Example: Quotation and Deduction Match (`exact`)

Below is a **real paid call** initiated to `serp/google` using the official X402Client (Base `exact`). It demonstrates the consistency of the three: 402 quotation, signed amount, and the `cost` returned in the successful response.

```text theme={null}
# 1) Unpaid request -> 402, get the quotation (no deduction)
POST /serp/google  ->  402
base/exact maxAmountRequired = 952 atomic = $0.000952 = 0.01 Credit
# 0.01 × 0.095215 = 0.00095215, rounded down to atomic = 952

# 2) Sign 952 atomic PAYMENT-SIGNATURE with the wallet, retry
POST /serp/google (PAYMENT-SIGNATURE) -> 200
body.cost = {"amount": 0.000952, "currency": "usdc", "settlement": "authorized"}
```

The `cost.amount` (0.000952 USDC) returned in the response is completely consistent with the 402 quote and `Credits × 0.095215`. The `settlement` field indicates the settlement status of the payment (`authorized` = authorized); on-chain settlement is handled by the platform, see the [`exact` and `upto` billing schemes](https://platform.acedata.cloud/documents/x402-metered-upto).

### `upto` Quote Calculation (Chat)

Chat is measured by token. The quote for a request (not the cap) is calculated using the following formula (taking gpt-4o-mini as an example):

```text theme={null}
Credits = 1e-6 × (0.835733 × prompt_tokens + 3.342933 × completion_tokens)
USDC    = Credits × 0.095215
```

For a request of 500 prompt + 200 completion tokens:

```text theme={null}
Credits = 1e-6 × (0.835733 × 500 + 3.342933 × 200) ≈ 0.001086 Credits
Quote USDC ≈ 0.001086 × 0.095215 ≈ $0.0001034
```

The client signs according to the `upto` cap (gpt-4o-mini is 1 Credit = `95215` atomic), which is just the **maximum possible deduction**; the actual quote for this request (approximately \$0.0001 in the example) is far below the cap and is settled based on token usage. The on-chain settlement mechanism for `upto` can be found in the [`exact` and `upto` billing schemes](https://platform.acedata.cloud/documents/x402-metered-upto).

## Other Service Prices (Fixed Price `exact`)

For interfaces like images, videos, music, and search, the price can be determined at the time of the request using `exact`. The table below shows the actual prices, taken from the online interface's 402 `maxAmountRequired` for unpaid requests (querying the quote does not incur charges):

| Service | Example Model / Parameters | Credits | USDC | atomic |
| - | - | - | - | - |
| Web Search | serp/google, ≤10 results | 0.01 | \$0.000952 | 952 |
| Image | nano-banana | 0.14 | \$0.013330 | 13330 |
| Image | gpt-image-1, 1024×1024 | 0.20 | \$0.019043 | 19043 |
| Image | flux-dev | 0.24 | \$0.022851 | 22851 |
| Image | midjourney imagine | 0.27 | \$0.025708 | 25708 |
| Image | seedream-4 | 0.32 | \$0.030468 | 30468 |
| Music | suno generate | 0.55 | \$0.052368 | 52368 |
| Music | producer generate | 0.68 | \$0.064746 | 64746 |
| Video | luma | 1.19 | \$0.113305 | 113305 |
| Video | hailuo (minimax-hailuo-2-3) | 1.72 | \$0.163769 | 163769 |
| Video | kling-v2-6 std | 2.10 | \$0.199951 | 199951 |
| Video | kling-v3 std | 4.20 | \$0.399903 | 399903 |
| Video | veo-3 text→video | 5.00 | \$0.476074 | 476074 |
| Video | seedance-1-0-pro, 1080p / 5s | 5.60 | \$0.533204 | 533204 |
| Video | wan2.6-t2v | 13.50 | \$1.285402 | 1285402 |

Note:

* The price for the same service varies with **model, resolution, duration, and action** (especially for video). The table shows the actual values under a specific set of parameters, for reference only.
* For these fixed-price (`exact`) interfaces, the `maxAmountRequired` in the 402 response for this request is the amount due (consistent with the `cost.amount` in a successful response, as tested in the previous section).
* Each price is obtained by rounding down `Credits × 0.095215` to the atomic unit (see the pricing benchmark above), using the same conversion as for chat. Due to floating-point representation and rounding, some values may differ from the naive product by 1 atomic (\$0.000001), and the 402 returned value shall prevail.

## Order Payment Price

When using the X402 payment console to pay for orders (purchase packages / recharge Credits), the price is based on what is displayed on the order page, and the 402 `amount` is the final signature basis. Order payments go through the platform API and require an account token, see the [Order Payment Tutorial](https://platform.acedata.cloud/documents/x402-order-payment).

A real example from the order payment tutorial (purchasing 10 Credits):

```text theme={null}
description Ace Data Cloud Credits x 10.0
created price 1.26          # Order creation price (USD)
settled    1.20 USDC        # Final signature/settlement amount (= 402 amount)
            = 1200000 atomic USDC
```

Note: **Pay-per-call** (as mentioned in Chat / Other Services) and **order payment** are two different paths. Pay-per-call uniformly uses the optimal unit price of `0.095215`/Credit; order payment is priced according to the package, and the difference between the creation price and the final settlement amount is based on the [Order Payment Tutorial](https://platform.acedata.cloud/documents/x402-order-payment).

## How to Get Prices in Real Time

Prices vary with models and parameters, please obtain them in real time using a program, do not hard-code:

* **Pay-per-call price**: Make a request to the target API **without** `PAYMENT-SIGNATURE` (and without `Authorization`), and read the returned 402 `accepts[].maxAmountRequired`. This step will not incur charges. For `exact` interfaces, it is the final price; for `upto` interfaces (chat), it is the cap, settled based on usage.
* **Chat per token unit price**: `GET https://platform.acedata.cloud/api/v1/models?with_pricing=true&type=chat`, read each model's `pricing.input_usd` / `pricing.output_usd` (calculated according to `credit_usd_rate`).
* **Conversion verification**: `atomic = floor(Credits × 0.095215 × 1e6)`, `USDC = atomic / 1e6` (i.e., `USDC ≈ Credits × 0.095215`).

Minimum request example to get prices:

```bash theme={null}
curl -sS -X POST https://x402.acedata.cloud/midjourney/imagine \
  -H 'Content-Type: application/json' \
  -d '{"prompt": "a cat"}'
# Returns 402, accepts[].maxAmountRequired is the price for this (exact) call
```

## Summary

* X402 price = The cost of Credits for this call × `0.095215`, which is the **same price** as regular Credits billing, just settled in on-chain USDC.
* `0.095215`/Credit is the platform's **optimal tier** (large amount) Credits unit price; the unit price for small top-ups is higher, so X402 automatically gets the optimal unit price.
* The `exact` interface (images / videos / music / search / orders) signs the amount due for this transaction; the `upto` interface (chat) signs the upper limit, settled based on actual usage.
* The authoritative price is based on the `maxAmountRequired` returned by 402: `exact` is the amount due (consistent with the successful response's `cost.amount`, verified); `upto` is the upper limit, and the successful response's `cost.amount` is the actual amount settled based on usage (≤ upper limit).

## Related Documents

| Document | Link |
| - | - |
| X402 Integration Guide (Overview) | [X402 Integration Guide](https://platform.acedata.cloud/documents/x402-integration) |
| Quick Start | [X402 Quick Start](https://platform.acedata.cloud/documents/x402-quickstart) |
| `exact` and `upto` Billing Plans | [Billing Plan Description](https://platform.acedata.cloud/documents/x402-metered-upto) |
| Networks and Payment Methods | [Networks and Payment Methods](https://platform.acedata.cloud/documents/x402-networks) |
| Order Payment Tutorial | [Order Payment Tutorial](https://platform.acedata.cloud/documents/x402-order-payment) |


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