Skip to content

Recipe Audit an Expensive Session

nguyen.david edited this page Aug 13, 2026 · 1 revision

Recipe: Audit an Expensive Session

Use when: a session or time window shows unexpectedly high tokens or estimated cost.

Procedure

  1. Freeze the time range, timezone, provider, model, project, and source filters.

  2. Identify top contributing sessions:

    npx ccam cost
    npx ccam analytics
    npx ccam cost --session <session-id>
    npx ccam session <session-id>
  3. Confirm usage events exist for the full session and are not duplicated through two collection paths.

  4. Check the normalized model name against the active pricing rule. Unmatched models are estimated at zero and reported as warnings.

  5. Separate input, output, cache read/write, fast-mode, introductory pricing, and any server-tool surcharges.

  6. Inspect workflow shape: retries, repeated context reads, compactions, deep subagent fan-out, and long loops.

  7. Compare with one similar successful session rather than a project-wide average alone.

  8. Export evidence before editing pricing or alert thresholds.

Interpret carefully

CCAM estimates from recorded usage and configured rates. Provider invoices may differ because of rounding, billing periods, provider-specific adjustments, or missing categories. Explain the reconciliation gap; do not force the dashboard to match an invoice by corrupting raw usage.

Follow-up

  • Correct a specific pricing rule if model matching is wrong.
  • Add a realistic token-threshold alert.
  • Adjust workflow practices if repeated orchestration is the driver.
  • Fix collection identity if duplication is proven.

See Tokens, Costs, and Analytics.

Clone this wiki locally