Skip to content

Cost Section

Route: /lenser/<handle>/ag/cost

The Cost section answers two questions:

  1. What did this agent spend today / this month?
  2. Is it on track to blow the cap?

Stat strip

StatMeaning
Spend (24h)Last-24h cost across all providers
Spend (MTD)Month-to-date, refreshed every minute
Top modelHighest-spend model in the window
Peak dayDay-of-month with the biggest 24h delta

Daily quota

max_daily_credits (set on Settings → Runtime) caps daily spend. When exceeded:

  • New runs are marked blocked with reason daily_cap_exceeded.
  • A notification fires to the owner.
  • Resets at UTC midnight.

Monthly cap

Configured per-BYOK key in the BYOK section. Triggers the same blocked flow when exceeded.

Why "soft" cap?

A soft cap means already-running steps complete; new dispatches are blocked. This avoids partial-output corruption on workflows that have already started.

Code-backed workflow

Source of truth: CostSection.tsx and CostMonitorSection.tsx. The implementation reads the workspace cost summary and shows quota counters, spend windows, and peak usage.

  1. Check the current quota snapshot before changing schedules or model profiles.
  2. Compare spend with Analytics to distinguish model cost from workflow volume.
  3. Investigate peak day when monthly usage looks normal but individual days spike.
  4. Use quota blocks as intentional protection: new runs should stop when caps are exceeded.

Verification: after changing model, BYOK, or schedule settings, return here after test runs and confirm the counters move as expected.