APIHub
Back to Help Center

计费说明

How is the APIHub Token fee calculated? Billing explanation for input, output, and cache

Updated 10/30/2026, 22:38:36

For text requests billed only by standard input and output, the fee equals "Input Token Count × Input Unit Price + Output Token Count × Output Unit Price", then divided by one million. The APIHub public pricing page displays input and output prices in USD per million tokens. When cache or other billing categories are involved, the corresponding applicable rates must be used separately.

1. Understand the pricing unit

"Per million tokens" is often written as "/1M" or "/MTok", not per request, and not per million Chinese characters. A token is the unit models use to process text, and the token count for the same text may vary across different models. Fees should be verified against the actual returned usage and billing records.

At the same time, distinguish between this site's selling price, the supplier's listed price, and the applicable rate for your account. Do not mistake the strikethrough reference prices in the price list for the final price you need to pay.

2. Formula for standard text requests

Fee (USD) =
  Input Token Count ÷ 1,000,000 × Input Unit Price
  + Output Token Count ÷ 1,000,000 × Output Unit Price

Here is a hypothetical example: A model's input unit price is $1 / million tokens, and its output unit price is $5 / million tokens. A single request uses 2,000 input tokens and 500 output tokens, then:

ItemCalculationFee
Input2,000 ÷ 1,000,000 × 1$0.002
Output500 ÷ 1,000,000 × 5$0.0025
Total0.002 + 0.0025$0.0045

The above is only to explain the algorithm and is not the model quote for APIHub. For actual unit prices, please refer to the Pricing Page and the applicable rate for your account.

3. Cache creation and cache reading must be calculated separately

Requests with caching enabled may involve four types of usage: standard input, cache creation, cache reading, and output. Some models or suppliers differentiate creation fees based on the cache retention time. All cache tokens cannot be treated at the same standard input price.

If the categories are non-overlapping billing volumes, the estimation structure is:

Total Fee = Standard Input Fee
       + Cache Creation Fee for various durations
       + Cache Reading Fee
       + Output Fee
       + Other Applicable Fees

The usage field in different protocols may adopt different statistical standards: some total inputs include cache sub-items, while others report them separately. Confirm the field definition before calculating to avoid double-counting cache tokens. You cannot simply add them up based on the field name alone.

The current public price list mainly displays input and output prices. If you cannot see the cache creation and reading unit prices for a certain model, you should contact support to confirm first, and do not apply the supplier's cache multiplier to this site's selling price yourself.

4. In which situations do you need extra verification?

  • Long context tiers: Confirm whether the rate or calculation method changes based on input length.
  • Images, audio, or tools: Confirm whether billing is based on tokens, images, duration, or number of calls.
  • Accounts and groups: Confirm the actual group and applicable rate used by your Key.
  • Streaming interruptions and timeouts: Confirm the generated usage and final bill; you cannot assume it is free just because of a client-side error.

5. How to evaluate a monthly budget?

First, collect a batch of representative real requests, record the model, input/output usage, cache status, and actual fees, then estimate based on business request volume. Do not use only the shortest request to extrapolate all scenarios; long conversations, retries, and output lengths will all change the cost.

When comparing models, you should compare the total cost and effectiveness of completing the same task, rather than just looking at the lowest input unit price.

Next steps: View Real-time Model Prices, read the Integration Documentation, or Register an Account to start configuring.

Data verification date: 2026-10-30. Basis for this site's pricing units and price display: APIHub Pricing Page. Formula examples are hypothetical data; actual billing is subject to the applicable rates and bills.