Skip to content

feat: add spend command - #2

Open
okturan wants to merge 1 commit into
monid-ai:mainfrom
okturan:feat/spend
Open

okturan wants to merge 1 commit into
monid-ai:mainfrom
okturan:feat/spend

Conversation

@okturan

@okturan okturan commented Aug 25, 2026

Copy link
Copy Markdown

Adds a monid spend command that summarizes workspace spend by provider and endpoint.

What it does

  • Pages through GET /v1/runs and aggregates client-side: total spend with date range, spend per provider, top endpoints, top runs by cost, and failed-run count with the amount billed on failures ($0.00 when billing is healthy).
  • -j/--json for machine-readable output, matching the other commands.
  • Follows the existing command template (ConfigManager → MonidAPI → formatter/JSON), with formatSpendReport added alongside formatBalance.
  • Unit tests for the pure aggregation function buildSpendReport, in the same style as the existing price/format tests. One deliberate call pinned by a test: BLOCKED runs don't count as failures, since that's a budget guardrail firing as intended.
  • Adds a monid spend row to the skill's command table (version left untouched).

Note on scale
Aggregation is client-side, so the command fetches the full run history (one request per 100 runs). For accounts with very large histories a backend summary endpoint would be the better home for this; buildSpendReport maps directly onto that shape, and the CLI side would shrink to one call plus the formatter. Happy to adapt the PR in that direction if preferred.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Aggregate the full runs list into a workspace spend report: totals,
spend by provider, top endpoints, top runs, and failed-run billing.
Supports -j for agents.

Claude-Session: https://claude.ai/code/session_01A72LKxMpKrLftv4VrPQgzA

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant