Skip to content

feat: add Nous Portal account usage tracking (#33376) - #33888

Closed
ousiaresearch wants to merge 1 commit into
NousResearch:mainfrom
ousiaresearch:feat/nous-usage
Closed

feat: add Nous Portal account usage tracking (#33376)#33888
ousiaresearch wants to merge 1 commit into
NousResearch:mainfrom
ousiaresearch:feat/nous-usage

Conversation

@ousiaresearch

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds credit/usage tracking for Nous Portal provider. Queries /credits, /usage, or /account/usage endpoints to report consumption, falling back to connectivity check via /models.

Fixes #33376

Type of Change

  • ✨ New feature

Changes Made

  • agent/account_usage.py: Added _fetch_nous_account_usage(), _parse_nous_usage_payload(), and _nous_connectivity_snapshot() functions
  • Wired into fetch_account_usage() dispatch

How to Test

  1. Configure Nous as provider with valid credentials
  2. Call account usage — should return credit snapshot or connectivity confirmation

Checklist

  • I have tested these changes locally

Queries Nous inference API /credits, /usage, or /account/usage endpoints
to report credit consumption, falling back to a connectivity check via
/models when usage endpoints are unavailable. Uses the same OAuth
credential resolution path as inference traffic.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/nous Nous Research API (OAuth) labels May 28, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This is already implemented on current main, so this PR is now redundant.

Automated hermes-sweeper review evidence:

  • Nous Portal account data is mapped into the shared usage snapshot in agent/account_usage.py:137-228 and fetched through the authenticated Portal account path in agent/account_usage.py:233-280.
  • /usage renders that shared credit block in the CLI (cli.py:9712-9750), TUI (tui_gateway/server.py:6500-6512), and messaging gateway (gateway/slash_commands.py:3998-4011).
  • Existing coverage verifies credit balances, top-up amounts, total usable balance, renewal, depleted state, and the monthly-credit gauge (tests/agent/test_nous_credits_snapshot.py:24-165, tests/agent/test_nous_credits_gauge.py:28-150).
  • The implementation landed in fcb1944b4f76cc74d5092c2b8605d972c095bd3c and is included in v2026.6.19.

The linked issue discussion noted that a server-side billing API was the original blocker; the current Portal-account implementation resolves that path.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
@DPS0340

DPS0340 commented Jul 24, 2026

Copy link
Copy Markdown

+1 to this - and there's a broader use case beyond hermes balance.

I build tokenaudit (https://github.com/DPS0340/tokenaudit), an open-source read-only CLI that scans provider usage APIs and reports itemized cost savings (OpenAI, Anthropic, OpenRouter, NeuralWatt supported).
I'd like to add Nous Portal, but there's currently no public usage endpoint - the Portal dashboard fetches spend via session-only server actions, which third-party tools shouldn't depend on.

The pieces seem mostly in place already: the dashboard queries with groupBy: model / granularity: day server-side, and the Portal's OAuth AS metadata already supports dynamic client registration + PKCE public clients - so either a usage:read scope or an OpenRouter-style /api/v1/activity endpoint (the Portal is OpenRouter-powered) would unblock both this issue and external tooling.

Full details of what I've verified: DPS0340/tokenaudit#1. Happy to build against a draft spec.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/nous Nous Research API (OAuth) sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Check Nous Portal credit balance and usage via CLI

5 participants