WuDi APIWuDi API

How AI API token costs work

API charges depend on the model's billing rules and actual request usage. A displayed unit price is only meaningful together with its unit, token category and applicable group. The current model catalog is the reference for platform prices.

Tokens are different from words and characters

Tokenization depends on language, text and model. Avoid a fixed characters-to-tokens conversion. Instructions, conversation history, tools, code and images may contribute to input usage. A coding client can send much more context than the latest typed question.

Separate input and output charges

For a simple text request without separate cache or other charges:

Input charge = input tokens / 1,000,000 × input price per million
Output charge = output tokens / 1,000,000 × output price per million
Total = (input charge + output charge) × applicable group multiplier

This is a calculation framework, not a fixed quote. Some models use different units or dynamic conditions.

Compare the same billing unit

Per-thousand and per-million rates differ by a factor of 1,000. Confirm the unit before comparing two displayed prices. A per-request image model cannot be evaluated using a text model's token price.

Cache reads and writes

Cache categories may have separate prices and counts. Check whether a displayed input count includes or excludes a separately listed cache category. Avoid adding the same tokens twice or omitting a category when reconciling logs.

Conversation and agent costs

A new turn may resend earlier history. Tool definitions, results and retrieved files can add input tokens. An agent task may generate several requests, including auxiliary tasks. Estimate the complete workflow rather than just the final answer.

Retries and image requests

An automatic retry can issue another chargeable request. If a client times out, inspect the original log before retrying. Image pricing may depend on request count, images, quality or image tokens; use the actual model's pricing rules.

Check the final usage record

Match time, model, group, token categories and request ID where available. Client-side cost estimates may use different prices. For a disputed charge, keep the redacted request record and contact support rather than inferring the total from one column.

See WuDi API billing for wallet and key allowances, log reconciliation and credit instructions.