Skip to content

fix(providers): AgentRouter quota not shown on Dashboard Quota (USAGE_SUPPORTED_PROVIDERS gap) #10078

Description

@nordz0r

Bug summary

AgentRouter (agentrouter) has a working balance quota fetcher for routing preflight/monitor, but the connection does not appear on Dashboard → Quota / home Provider Quota widget. Operators only see routing work; remaining credits are invisible in the UI.

Environment

  • OmniRoute: 3.8.50 (next-web / branch release/v3.8.50)
  • Provider: built-in agentrouter (API key sk-… + optional New-API System Access Token / New-Api-User)
  • Dashboard: /dashboard/quota and home ProviderQuotaWidget

Background

  • Feature request feat(providers): AgentRouter quota tracking #6850 asked for AgentRouter credit wallet via New-API:
    • GET /api/user/self with Authorization: Bearer {System Access Token} + New-Api-User: {userId} → raw quota
    • dollar balance ≈ quota / quota_per_unit (default 500000)
  • Closed by PR feat(sse): quota tracking for AgentRouter, v0 (Vercel), FreeModel (#6850, #6845, #7075) #7653 (feat(sse): quota tracking for AgentRouter, v0, FreeModel), which added:
    • open-sse/services/agentrouterQuotaFetcher.ts (registered via quotaTrackersBatch.ts into quotaPreflight + quotaMonitor)
    • Dashboard connection fields for providerSpecificData.consoleApiKey + newApiUserId (AgentrouterConsoleFields.tsx)
    • Changelog claimed “feeding preflight + the dashboard's Provider Quota card

Root cause (verified on release/v3.8.50)

Two separate surfaces; only the SSE/preflight path was wired.

1. Dashboard filters out agentrouter

ProviderQuotaWidget (and the same pattern on the quota page) keeps only:

USAGE_SUPPORTED_PROVIDERS.includes(connection.provider) &&
(connection.authType === "oauth" || connection.authType === "apikey")

On release/v3.8.50, USAGE_SUPPORTED_PROVIDERS in src/shared/constants/providers.ts does not include "agentrouter" (nor aliases). Same gate: supportsProviderQuota() in src/shared/utils/providerQuotaVisibility.ts.

So even with a healthy connection and console credentials filled, AgentRouter never enters the quota UI list. Same class of gap as open #9740 (Cline Pass).

2. Usage / provider-limits path never dispatches AgentRouter

  • open-sse/services/usage.tsUSAGE_FETCHER_PROVIDERS / getUsageForProvider() has no case "agentrouter".
  • src/lib/usage/providerLimits.tsPROVIDER_LIMITS_APIKEY_PROVIDERS has no agentrouter entry.
  • The implemented fetcher only registers with registerQuotaFetcher / registerMonitorFetcher (routing preflight/monitor), not the /api/usage/provider-limits cache the dashboard reads.

Net effect: preflight may know balance for routing, but Dashboard Quota stays empty for AgentRouter.

Expected

  1. Active agentrouter connections appear on Dashboard Quota / home quota widget when quotaVisible !== false.
  2. Balance is shown (raw units and/or USD ≈ quota / 500000) when System Access Token + New-Api-User are set on the connection.
  3. If console credentials are missing: show the connection with an explicit “quota credentials required / not available” state instead of omitting the provider entirely.
  4. Prefer a single source of truth: either add AgentRouter to the usage/provider-limits path or document that preflight-only trackers must also be listed + hydrated for the dashboard.

Proposed fix

  1. Add "agentrouter" to USAGE_SUPPORTED_PROVIDERS.
  2. Wire getUsageForProvider / provider-limits sync to fetchAgentrouterQuota (or share the registered QuotaFetcher used by preflight).
  3. Ensure Add/Edit connection still persists consoleApiKey + newApiUserId (already present from feat(sse): quota tracking for AgentRouter, v0 (Vercel), FreeModel (#6850, #6845, #7075) #7653).
  4. Regression tests:
    • unit: supportsProviderQuota("agentrouter") === true
    • unit/integration: provider-limits / usage path returns balance when console credentials present
    • UI: connection not filtered out of ProviderQuotaWidget candidate list

Related

Acceptance

  • agentrouter listed in USAGE_SUPPORTED_PROVIDERS
  • Dashboard Quota shows the connection with live balance when console token + user id are configured
  • Missing console credentials → visible “not configured” state, not silent omission
  • Preflight/monitor path still works (no regression on routing quota checks)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions