Skip to main content
NexoToken
← Back to guide center

NexoToken technical guide center

Claude Code cache billing and cost verification

Separate uncached input, reads, writes and output before reconciling the model, public group, price timestamp and bill.

A cache hit is not free, and a cache write is not a cache read. Fix the request time, full model ID and public group, then price uncached input, reads, 5-minute writes, 1-hour writes and output separately. Anthropic list prices are not automatically NexoToken settlement prices. A model label alone is not independent identity verification.

Scope

For Claude Code users of a Messages-compatible API checking cache usage and task cost; not for converting a chat subscription allowance into an API balance.

Last verified

Steps

  1. In official Messages usage, input_tokens excludes caching; add cache_read_input_tokens and cache_creation_input_tokens for total input. Platform-normalized counters may already include caching: check semantics before adding.

  2. When usage.cache_creation supplies ephemeral_5m_input_tokens and ephemeral_1h_input_tokens, price them separately. They are already included in cache_creation_input_tokens. Missing fields are unknown, not zero; do not assume a missing TTL is five minutes.

  3. Cost = (uncached input × input price + reads × read price + 5m writes × 5m price + 1h writes × 1h price + output × output price) / 1,000,000. Use one currency and the applicable price tier.

  4. Official Anthropic documentation checked on 2026-11-20 lists base write multipliers of 1.25 for five minutes and 2 for one hour. Most official cache reads are 0.1×, but Claude Sonnet 5.5 and Opus 5.5 are 0.05×, and Fable 5.1/5.2 are 0.025×. The Sonnet 5.5 platform quote for Plan 3 below is about 0.1× its own group input price. Do not apply the official direct-API multiplier to that quote.

  5. The NexoToken public pricing snapshot selects the lowest input-price group per model, which may not match your key’s group. A missing read price is not free, and it does not determine a missing write price.

  6. Platform price sample, NOT a customer bill: public snapshot generated 2026-11-20 14:18:03 Asia/Shanghai, claude-sonnet-5-5, public group “Anthropic 方案 3”. Multiplying USD/token by 1,000,000 gives rounded USD/MTok prices: input 0.074184, output 0.370920, cache read 0.007418 and cache_write_usd_per_token 0.092730. The write field does not distinguish TTL, so it does not establish the one-hour price. The snapshot converts using the then-current USD/CNY exchange rate. The separate recharge ratio is 1 CNY = 100 credits. The USD quote is not an actual debit; the applicable group and bill govern settlement.

  7. Reconcile each actual request before summing the task. Check retries, parallel work, context changes and long-context tiers. Send redacted records to support rather than repeatedly making paid requests to guess the cause.

Safe example

HYPOTHETICAL teaching example, not a customer bill or a model quotation.
Assumed USD per million tokens: input 2; 5m writes 2.5; 1h writes 4; reads 0.2; output 10.
Disjoint usage: input 2,000; 5m writes 10,000; 1h writes 4,000; reads 20,000; output 500.
Cost = (2000×2 + 10000×2.5 + 4000×4 + 20000×0.2 + 500×10) / 1000000
     = USD 0.054.
Messages write total: 14,000; total input: 36,000. Do not bill the 14,000 again.
No CNY/credit conversion, extra tool charges or tier adjustments are included.

Common errors and troubleshooting order

  1. Combining writes and reads loses TTL-specific pricing.
  2. Adding cached counters to an input total that already includes them double counts usage.
  3. A universal 10% cache-read claim ignores model and public-group differences.
  4. One visible action can produce retries, tool loops and subtask requests.
  5. Check prefix, model, TTL and usage when investigating misses; a client toggle alone does not prove a hit.

Completion checklist

  • Model, public group, request time and rate timestamp match.
  • Token buckets do not overlap; missing counters remain explicitly unknown.
  • Units and currencies match, without equating platform credits to fiat.
  • Illustrative numbers are distinct from real bills and contain no customer data.
  • Task cost includes all actual requests and any additional tool charges.

Limitations and boundaries

  • Checked 2026-11-20; prices, models and clients change. Current records and prices take precedence. The example promises neither savings nor cache-hit rates.
  • Platform status is a passive aggregate of real traffic over 24 hours, not third-party active probing. Availability and latency do not verify identity, quality or billing. Evaluate external monitoring by its own model, time window and methodology.
  • Exact reconciliation requires complete counters, consistent semantics and historical rates. If TTL splits or applicable prices are unavailable, disclose the limitation rather than inventing values.