Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Reconcile an Agent session

Lazu groups gateway requests by the session identifier sent by the client. A session is a view of API activity: it cannot observe local tools, editor time or every action an agent performs. Requests without a client session identifier cannot reliably identify a single task.

From a task to its cost

  1. Connect a client using the Claude Code guide or Codex guide.
  2. Run a small task. In the console, open Usage → Agent sessions and select that task. Confirm the client, time window and models.
  3. Read the session total, then open individual request receipts. Check input, output, cache reads, cache writes, lane and any applicable long-context or plan conditions. A failed request is not automatically a zero-charge request; read its receipt.
  4. Load all available batches before exporting JSON. The coverage notice distinguishes loaded requests from retained requests and the durable session count. Expired records cannot be restored by pagination.

A reproducible calculation

The repository includes a reconciliation script and a deliberately synthetic fixture. They are arithmetic examples, not customer results or current model prices.

python3 ops/scripts/summarize-agent-session.py ops/fixtures/agent-session.example.json
python3 ops/scripts/summarize-agent-session.py session.json

The fixture totals $0.015 across three requests. Only two have a comparable official price: $0.0145 charged against $0.020 official, a $0.0055 difference. That comparison excludes the third request and must not be applied to the whole session. The script exits unsuccessfully for incomplete exports or totals that do not reconcile, and suppresses the savings comparison. It prints no prompt text or request identifiers; model names and cost data may still be private.

What the chart can establish

Request concurrency uses completion timestamps minus recorded durations, at whole-second resolution. Idle gaps between a thread's requests are not running time. Missing details suppress whole-session analysis. Cost changes around a compaction are observations from nearby requests, not proof that compaction caused the savings.

Session totals can remain after request details expire. First-message text is available only when content was captured and remains within the configured retention period. Before sharing an export, remove prompts, account information and any proprietary model identifiers, and obtain permission from its owner.

See billing and request receipts for the authoritative charge breakdown.