Billing Formulas
This page documents formulas, not rates. The reason is direct: rates are operational data that shift as models come and go and suppliers reprice — anything written here could be stale tomorrow. Formulas are code, and changing them requires a release. What you need is to know how the number was produced, so you can check a bill yourself.Everything settles in credits. The exchange rate is fixed: 1 CNY = 100 credits (code constant
CREDITS_PER_YUAN = 100).The common pipeline
Regardless of billing unit, every charge runs the same chain:1
Resolve the billing unit
The model config declares which unit it bills on:
token_split / per_call / per_ten_thousand_characters / duration_second / cost_matrix.2
Compute supplier cost, or rate directly
With a cost matrix, parameter conditions are matched first to get a cost in CNY. Without one, the configured rate is applied directly.
3
Apply margin
sellPrice(CNY) = cost(CNY) × (1 + marginPercent / 100)4
Convert to credits, rounding up
credits = max(1, ceil(sellPrice × 100))5
Apply parameter coefficient
When a parameter (resolution, mode, etc.) carries a coefficient:
finalCredits = ceil(baseCredits × coefficient)1. token_split: input and output priced separately
Used by conversational models. Input and output have separate rates in credits per million tokens.
Fallback when tokens are not itemized
Some suppliers return only a total token count. In that case a blended rate applies:Supplier cost recording
When supplier costs are configured, they are recorded alongside (this does not affect your charge; it is for platform reconciliation):2. duration_second: priced per second
Used by video generation, sandbox runtime, and similar.
flat exists because some suppliers charge per generation rather than per second — same duration unit, but selecting flat in the rule collapses it to a fixed price.
3. per_call: priced per call
Used by image generation and other one-call-one-result capabilities.
generate_batch) counts actual images with no volume discount.
4. per_ten_thousand_characters: priced per 10K characters
Used by TTS, translation, and other text-volume capabilities. It shares an implementation with per_call and adds only a divisor:
Cost-rule matching uses the raw character count (
callCount); the division by 10,000 applies only when computing the amount. So a tiered rule like “over 50,000 characters switches rate” must be written against raw characters, not per-10K units.5. cost_matrix: parameter conditions → cost
Not a fifth billing unit but a pricing strategy layered on top of the other four. It lets one model price differently by parameter (1024x1024 versus 4K, for example).
Rule structure:
- Rules are evaluated in order; the first rule whose conditions all match wins
- Multiple conditions on one rule are AND-combined
- A rule with an empty
conditionsarray matches everything and serves as the fallback - Conditions come in three shapes: enum (
values, any-of), range (min/max, withminExclusive/maxExclusivechoosing open or closed), and exact match (equals)
Sell price is never stored: only cost plus margin, computed at billing time. Adjusting margin means changing one number, with no historical backfill.
Credit deduction order (six buckets)
Your balance is not one number but six buckets, consumed in strict order:1
1. Daily check-in
Expires at midnight (UTC+8) the next day. Spent first because it lapses soonest.
2
2. Signup grant
Valid 90 days.
3
3. Plan grant
Valid for one subscription cycle.
4
4. Referral reward
Reclaimed after 100 days of inactivity.
5
5. Top-up bonus
Permanent.
6
6. Top-up principal
Permanent, and touched last.
Expiry reclamation targets a specific lot rather than following the priority order — the reclamation record carries the source transaction ID and deducts exactly that lot’s remainder. Only when no matching lot is found does it fall back to priority order. This guarantees that “signup credits expired” never eats into your paid balance.
Expert revenue share
Creator earnings follow two independent paths.Buyout (unlocking an expert)
Usage share (consumption)
The usage share stops rising after
professional (20%) — reaching master only raises the buyout share.
Withdrawal conversion
Checking a bill yourself
1
Get the unit and rate for the call
The consumption record carries
pricingUnit and a rate snapshot.2
Compute by hand using this page
Remember every step uses
ceil with a 1-credit floor.3
If it doesn't match, check three things
- Whether a parameter coefficient applied (
factorCoefficientother than 1) - Whether the cost matrix was used instead of a flat rate
- Whether a token-unit call fell back to the blended rate because the supplier returned no itemization
Related pages
Limits
Quotas, validity, rate limits
Credits and consumption
Earning and checking credits
Revenue system
Creator earnings in full
Pricing and billing
Pricing your own expert
Verified 2026-08-11. Sources:
services/core/src/db/service/credit-consume.ts (billing pipeline and six-bucket priority), services/core/src/constants/cost-matrix.ts (cost rules), services/core/src/db/service/platform-config.ts (revenue shares and withdrawal rules). Rate and cost values are ops data and are deliberately omitted.
