Skip to content

feat(costs): budget meter in the top bar and a Costs page - #275

Merged
adeelahmad merged 6 commits into
mainfrom
claude/project-thread-p4a3fb
Oct 10, 2026
Merged

adeelahmad merged 6 commits into
mainfrom
claude/project-thread-p4a3fb

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: spend and budgets showed only inside a routine, pipeline, workflow or namespace's own page.

After: the top bar has a budget meter for the namespace picked in the switcher (follows it as it changes): "$1.20 / $5" with a bar, gold when near the budget's warn level, red when used up. It counts the budget's own period; without a budget it shows spend for the period you pick (day, week or month, remembered per browser). "All namespaces" shows all of Lens (admins), against the global budget once set. Clicking opens details: used and left, spend for day/week/month, top models, and a link to the new Costs page. Costs (new left-menu item after Reports) shows spend by day, by model, what cost most, by namespace (for all of Lens), the namespace's budget to set (admins), and every other budget's usage.

How: GET /api/v1/budgets/meter?ns=&period=&detail= built on the activity ledger (activity.totals, new by_day, by_model, top(within=)). Namespace readers see its meter; all of Lens is admin-only. Also fixes activity.top ordering (the database didn't order grouped rows by cost, so the LIMIT could drop the most expensive ones).

Motivation and Context

Adeel asked for a budget spend meter on the top right with a configurable period and a popup, and a dedicated Costs page in the menu.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hw1quTxDYeSQsedKwZBNAw


Generated by Claude Code

The top bar shows what the picked namespace (or all of Lens, for admins)
spent against its budget, highlighted near or over, with a details popup
for a day, week or month. A Costs page in the left menu shows spend by
day, model and resource and sets the namespace's budget. Served by
GET /api/v1/budgets/meter.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hw1quTxDYeSQsedKwZBNAw
@adeelahmad adeelahmad self-assigned this Oct 10, 2026
@adeelahmad
adeelahmad merged commit 90fc418 into main Oct 10, 2026
7 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-p4a3fb branch October 10, 2026 21:20
adeelahmad pushed a commit that referenced this pull request Oct 10, 2026
#275 merged, so it moves from "In progress" to the feature list.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS
adeelahmad pushed a commit that referenced this pull request Oct 10, 2026
The budget meter (#275) and this PR both name the overall budget "all"; keep one
constant (ALL) and the REF that accepts it, and check the meter shows it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbW6SC3MU2AmYQ9zFa5dk4
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.

2 participants