Skip to content

feat(ui): Model Providers settings page with auth, quota, and cost per provider - #104061

Merged
steipete merged 1 commit into
mainfrom
claude/model-providers-settings-883ed7
Jul 11, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/model-providers-settings-883ed7

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #104040

What Problem This Solves

Resolves a problem where there was no single place in the Control UI to see which model providers are configured on a gateway and how they are doing. Auth health lived in the CLI and the chat composer's quota popover, live plan/quota/billing cards sat at the bottom of the Usage dashboard, and locally computed session spend was buried in Usage aggregates — so questions like "is my Claude subscription about to hit its weekly limit, and what did OpenAI cost me this month?" required visiting three surfaces.

Why This Change Was Made

Adds a Settings → Model Providers page (/settings/model-providers, in the Agents & Tools group) that merges four existing gateway RPCs into one card list — no new RPC or config surface. Each configured provider renders as a card with its brand icon, auth pill (connected / expiring / expired / not signed in / API key), model availability, live plan/quota windows, balances/spend/budgets, provider-billed cost history, and locally computed session spend for the last 30 days. Provider alias ids (e.g. claude-cli → anthropic) canonicalize with the same table the gateway uses so one subscription stays one card, and the page reloads when the gateway client changes.

The change also consolidates duplicated presentation code instead of adding a third copy: the provider brand icon resolver and provider display labels moved out of the chat model picker into a shared ui/src/components/provider-icon.ts, and the Usage dashboard's provider usage card body (quota bars, billing rows, cost-history chart) moved into a shared ui/src/components/provider-usage.ts that both pages render.

Data sources: models.authStatus (provider list + credential health + embedded quota), models.list (model counts/availability), usage.status (live plan/quota/billing/cost history), sessions.usage aggregates.byProvider (local 30-day spend). Providers with no auth, no available models, no usage snapshot, and no recorded spend stay hidden as browse-only catalog entries.

User Impact

Operators get one Settings entry that answers "which model providers are configured, are their credentials healthy, what quota is left, and what are they costing me" — with icons, plan badges, quota bars with reset times, credit balances, provider-billed cost charts, and local session spend per provider. A Refresh button re-reads credential state and provider usage on demand.

Evidence

Screenshots (mock gateway fixtures via pnpm dev:ui:mock):

Model Providers settings page — Claude and Gemini cards

Model Providers settings page — Copilot, OpenAI, OpenRouter cards and local session spend

  • Unit tests: ui/src/pages/model-providers/data.test.ts (7 cases: alias merge with and without usage enrichment, auth-severity merge, usage.status precedence, local-cost attachment, browse-only filtering, sorting).
  • Mocked-gateway E2E: ui/src/e2e/model-providers.e2e.test.ts (auth pill, plan badge, quota bar, balance, local spend, alias merge, hidden unconfigured provider) — passes locally with Playwright Chromium.
  • Focused suites on Blacksmith Testbox: ui/src/pages/model-providers, app-navigation*, pages/usage/view.test.ts, chat-composer.test.ts, lib/chat/model-select-state.test.ts — all green.
  • pnpm check:changed (delegated to Testbox) green.
  • Codex autoreview (gpt-5.5, thinking high): two P2 findings (stale data across gateway client swaps; alias merge depending on optional usage embed) — both fixed in this PR with regression coverage; rerun clean.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Jul 11, 2026
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 10:14 PM ET / July 11, 2026, 02:14 UTC.

Summary
Adds a Control UI Model Providers settings page that combines provider authentication, model availability, quota, billing, and local session-cost data while extracting shared provider presentation components.

Reproducibility: not applicable. This PR adds a new Control UI aggregation page rather than fixing a reproducible broken behavior.

Review metrics: 1 noteworthy metric.

  • Gateway contract surface: 0 added, 4 existing RPCs reused. The feature adds a UI aggregation surface without expanding protocol or configuration compatibility obligations.

Stored data model
Persistent data-model change detected: persistent cache schema: ui/src/i18n/.i18n/ar.tm.jsonl, persistent cache schema: ui/src/i18n/.i18n/de.tm.jsonl, persistent cache schema: ui/src/i18n/.i18n/es.tm.jsonl, persistent cache schema: ui/src/i18n/.i18n/fa.tm.jsonl, persistent cache schema: ui/src/i18n/.i18n/fr.tm.jsonl, persistent cache schema: ui/src/i18n/.i18n/hi.tm.jsonl, and 14 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #104040
Summary: This PR is the direct implementation candidate for the still-open product issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted real-gateway browser proof showing configured provider data and manual refresh behavior.
  • Resolve the current-main locale conflicts and refresh exact-head checks.
  • Obtain explicit maintainer confirmation for the dedicated Settings destination.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The screenshots and E2E evidence clearly show the feature with mock gateway fixtures, but do not prove it against real provider credentials, quota/billing hooks, or persisted session aggregates; add redacted live browser evidence without private IPs, keys, phone numbers, or endpoints, then update the PR body for automatic review or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The linked issue has not yet recorded explicit maintainer acceptance of a dedicated Settings destination versus improving the existing Usage, chat quota, and auth surfaces.
  • [P1] The PR currently has a dirty merge state because current main changed generated UI localization outputs after the branch base.
  • [P1] The submitted screenshots and browser test use mock gateway fixtures, so real credential-store, provider-hook, billing, and session-aggregate behavior remains unproven.

Maintainer options:

  1. Decide the mitigation before merge
    Approve the dedicated Settings destination explicitly, then refresh the branch against current main and attach redacted real-gateway browser proof before landing the existing shared-component implementation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] A maintainer must confirm the new Settings information architecture; after that the contributor should resolve the branch conflicts and supply real-gateway proof, not request an automated code repair.

Maintainer decision needed

  • Question: Should provider auth, quota, billing, and local spend become a dedicated Settings page rather than remain in the existing Usage, chat quota, and CLI surfaces?
  • Rationale: The implementation is technically plausible, but it adds a new top-level Settings destination and the canonical issue is explicitly marked as needing a product decision.
  • Likely owner: steipete — He proposed this product direction and owns the strongest merged history in the provider-usage infrastructure it surfaces.
  • Options:
    • Approve dedicated page (recommended): Keep this information architecture and require conflict resolution plus real-gateway proof before merge.
    • Consolidate existing surfaces: Keep provider analytics in Usage and add narrower auth or discoverability improvements to existing pages.
    • Defer the feature: Pause this PR until the broader Control UI Settings structure is settled.

Security
Cleared: The diff reuses existing read-scoped methods and introduces no dependency, workflow, secret, permission, package-resolution, publishing, or downloaded-code change.

Review details

Best possible solution:

Approve the dedicated Settings destination explicitly, then refresh the branch against current main and attach redacted real-gateway browser proof before landing the existing shared-component implementation.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds a new Control UI aggregation page rather than fixing a reproducible broken behavior.

Is this the best way to solve the issue?

Unclear at the product level: the code is a maintainable reuse of existing RPCs and rendering, but maintainers still need to confirm that a dedicated Settings destination is preferable to enhancing the existing Usage and auth surfaces.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b7156ce68884.

Label changes

Label changes:

  • add P3: This is a speculative convenience and observability feature rather than a regression or blocked existing workflow.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The screenshots and E2E evidence clearly show the feature with mock gateway fixtures, but do not prove it against real provider credentials, quota/billing hooks, or persisted session aggregates; add redacted live browser evidence without private IPs, keys, phone numbers, or endpoints, then update the PR body for automatic review or ask a maintainer to comment @clawsweeper re-review.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The screenshots and E2E evidence clearly show the feature with mock gateway fixtures, but do not prove it against real provider credentials, quota/billing hooks, or persisted session aggregates; add redacted live browser evidence without private IPs, keys, phone numbers, or endpoints, then update the PR body for automatic review or ask a maintainer to comment @clawsweeper re-review.

Label justifications:

  • P3: This is a speculative convenience and observability feature rather than a regression or blocked existing workflow.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The screenshots and E2E evidence clearly show the feature with mock gateway fixtures, but do not prove it against real provider credentials, quota/billing hooks, or persisted session aggregates; add redacted live browser evidence without private IPs, keys, phone numbers, or endpoints, then update the PR body for automatic review or ask a maintainer to comment @clawsweeper re-review.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The screenshots and E2E evidence clearly show the feature with mock gateway fixtures, but do not prove it against real provider credentials, quota/billing hooks, or persisted session aggregates; add redacted live browser evidence without private IPs, keys, phone numbers, or endpoints, then update the PR body for automatic review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

What I checked:

  • Best-fix shape: The branch reuses four existing read RPCs and extracts the existing Usage provider renderer and chat provider-icon logic into shared components instead of creating a parallel gateway or config path. (ui/src/pages/model-providers/load.ts:52, 2f5b62346ce2)
  • Authorization contract: Every RPC used by the page is registered with operator.read, matching the existing Control UI read boundary for provider and usage data. (src/gateway/methods/core-descriptors.ts:38, b7156ce68884)
  • Provider merge coverage: Focused tests cover alias merging, auth-severity precedence, richer usage.status precedence, local-cost attachment, provider filtering, and sorting; mocked browser coverage verifies rendered auth, quota, billing, spend, and unavailable-model states. (ui/src/pages/model-providers/data.test.ts:29, 2f5b62346ce2)
  • Visual fixture evidence: The two attached screenshots visibly demonstrate the new Settings route, five provider cards, auth badges, quota windows, billing, cost history, local spend, and alias-normalized cards, but the PR states that the gateway data is mocked. (ui/src/e2e/model-providers.e2e.test.ts:24, 2f5b62346ce2)
  • Current-main conflict: Current main is one UI commit beyond the PR base and the three-way merge reports conflicts across generated locale outputs, so the exact merged head must be refreshed before landing. (ui/src/i18n/locales/en.ts:578, 2f5b62346ce2)
  • Linked product decision: The canonical issue remains open with protected maintainer and needs-product-decision signals; this PR is its explicit implementation candidate, not an already-approved bug repair. (2f5b62346ce2)

Likely related people:

  • steipete: Introduced provider usage tracking and later plugin hooks and refactors, and authored the linked product proposal for this page. (role: provider usage feature owner and product proposer; confidence: high; commits: 9bf66843660c, e7555724af15, 14b4c7fd56ae; files: src/infra/provider-usage.ts, src/infra/provider-usage.auth.ts, src/infra/provider-usage.load.ts)
  • omarshahine: Introduced the Control UI Model Auth status card and then normalized models.authStatus provider identifiers used by the new page. (role: auth overview feature introducer; confidence: high; commits: 507b7189177a, f2fdb9d1253c; files: src/gateway/server-methods/models-auth-status.ts, ui/src/pages/overview/cards.ts, ui/src/pages/overview/overview-page.ts)
  • Takhoffman: Introduced the web Usage dashboard and its session-usage surface, whose provider rendering and local aggregates are reused here. (role: usage dashboard introducer; confidence: high; commits: 8a352c8f9dfd; files: src/gateway/server-methods/usage.ts, src/infra/session-cost-usage.ts, ui/src/pages/usage/usage-page.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete force-pushed the claude/model-providers-settings-883ed7 branch from 2f5b623 to 829b1cd Compare July 11, 2026 02:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 829b1cd59e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

(error: unknown) => ({ ok: false as const, error }),
),
client
.request<{ models?: ModelCatalogEntry[] }>("models.list", {})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Use configured model catalog for provider cards

For configs that expose a provider through wildcard model visibility (for example agents.defaults.models['vllm/*']), the gateway only forces full catalog discovery when models.list is called with view: 'configured' (src/agents/model-catalog-browse.ts). The default {} request stays on the read-only/timeout path, so API-key providers that are intentionally absent from models.authStatus can be hidden entirely or show zero models on this new page even though they are configured; the chat picker already uses the configured view for this reason.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 0074005 into main Jul 11, 2026
84 checks passed
@steipete
steipete deleted the claude/model-providers-settings-883ed7 branch July 11, 2026 02:31
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings: single Model Providers page with auth state, quota, and cost per configured provider

1 participant