Skip to content
Copy a prompt for your AI tool. Keep your key local.
PALEPALE / DOCUMENTATION

Calculate AI API token costs

Estimate input, cached input and output costs, then check settlement.

Calculate the charge

Find the input, cached input and output rates on Models. Rates are in USD per million tokens.

Token cost = (ordinary input × input rate + cached input × cached rate + cache writes × cache-write rate + output × output rate) / 1,000,000.

Subtract cache hits and separately priced cache writes from total input to get ordinary input. Use the reported output total, which includes reasoning tokens. Add any published per-request search fee and check Billing for rounding.

Worked example

At example rates of USD 2.00 for input, 0.20 for cached input and 4.00 for output, a request with 1,000 input tokens (200 cached) and 100 output tokens costs USD 0.00204.

Check actual usage

Open Usage for confirmed charges and requests that are still pending. Inference leaves wallet funds available while usage is pending. One dollar equals 1,000,000 microdollars in API responses.

With an owner credential or browser session, call GET /v1/account/usage/log and follow next_cursor to page through request history. The older GET /v1/account/usage endpoint takes an owner credential and returns up to 100 rows. Its timestamp-only cursor can skip rows with the same timestamp.

Need a hand?

Open Palepale Discord for account support. Compare model rates or read about wallet billing.