Skip to content

feat: add Anthropic and OpenAI cost history#100672

Merged
steipete merged 8 commits into
mainfrom
codex/provider-admin-cost-history
Jul 6, 2026
Merged

feat: add Anthropic and OpenAI cost history#100672
steipete merged 8 commits into
mainfrom
codex/provider-admin-cost-history

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw could show quota, credits, or balances for several providers, but it did not expose provider-reported daily spend history for Anthropic or OpenAI. That left the Usage page materially behind CodexBar for the two main coding providers and made model/cache/category cost analysis unavailable inside OpenClaw.

Closes #100608.

Why This Change Was Made

  • add provider-owned Anthropic Admin API collection for cost reports and Messages usage
  • add provider-owned OpenAI organization costs and completions usage collection, including optional project scope
  • add a generic provider cost-history shape for daily spend, requests, input/cache/output tokens, model attribution, and billing categories
  • auto-detect explicit Admin environment credentials plus Anthropic Admin keys in stored profiles, including SecretRef-backed profiles; preserve Claude/Codex OAuth quota behavior when Admin credentials are absent
  • declare usage-only credential environment variables in plugin manifests so discovery and secret redaction stay plugin-owned
  • render today, 7-day, and 30-day spend with daily bars and model/category breakdowns in the Control UI
  • preserve concrete provider endpoint errors when Codex synthetic quota fallback is also unavailable

This brings the provider API surface to CodexBar parity. It intentionally does not import local session logs from other applications; OpenClaw's existing transcript estimates remain a separate local view.

User Impact

Users with Anthropic Admin credentials or a dedicated OPENAI_ADMIN_KEY can see actual provider-billed USD history in OpenClaw's Usage page. Existing Claude and Codex OAuth users keep their current plan/quota cards. OpenAI inference credentials are never forwarded to organization APIs because they may belong to custom, Azure, or agent-local endpoints. Other providers continue to report their existing balance, budget, credits, or quota data unchanged.

Evidence

  • Blacksmith Testbox tbx_01kwtw19xh4t51hehrep3wpwf4 (quick-crab)
  • broad pnpm check:changed: passed on the full touched surface
  • focused provider/auth/UI/security suites: 203 tests passed; post-review regressions added another 21 status tests and 43 provider/auth tests
  • pnpm build: passed after the final SecretRef-aware auth change, including SDK export and production Control UI bundle checks
  • live isolated CLI probe against the real Anthropic and OpenAI Admin endpoints: both returned Admin API key required for dummy credentials, proving automatic discovery, provider routing, and error selection without exposing credential material
  • mocked successful Admin responses cover pagination, currency conversion, daily aggregation, cached-token accounting, model attribution, category attribution, and OpenAI project scope
  • Control UI before/after screenshots: published through the dedicated OpenClaw PR asset repository
  • post-review credential-boundary and sandbox-manifest suites: 57 tests passed on Testbox tbx_01kwv5sg25xc1dg84q1zc0pdsk; enabled-vs-disabled plugin trust regression: 29 tests passed on tbx_01kwv6ddxvrdj1m274j8tgphfr
  • final Madge import-cycle proof: zero cycles on Testbox tbx_01kwv6fhhkz65ss4tj0k91gk1t
  • fresh autoreview after all accepted fixes: no actionable findings, overall correct (0.88)

Authenticated successful Admin API proof was not run because no approved live Anthropic/OpenAI Admin key was available in the configured credential stores. The real endpoint failure path and fully mocked success path are both covered.

Before / After

Before After
Existing provider quota and balance cards Anthropic and OpenAI cost history with daily, token, model, and category analysis
Before provider cost history After provider cost history

Proof asset release

@steipete
steipete requested a review from a team as a code owner July 6, 2026 06:27
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui agents Agent runtime and tooling extensions: anthropic extensions: openai size: XL maintainer Maintainer-authored PR labels Jul 6, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for caea6bda4cd:

  • Blacksmith Testbox: tbx_01kwtw19xh4t51hehrep3wpwf4 (quick-crab)
  • full touched-surface pnpm check:changed: passed
  • focused provider/auth/UI/security run: 203 tests passed
  • post-live status regression: 21 tests passed
  • SecretRef follow-up: 43 provider/auth tests passed
  • final pnpm build: passed, including SDK export and production Control UI bundle checks
  • live isolated CLI probe reached both real Admin endpoints; Anthropic and OpenAI each returned Admin API key required for dummy credentials, with no credential material in output
  • final autoreview: no actionable findings, patch correct (0.86)
  • CI follow-up: translated all 178 provider-usage fallback records and reconciled the four-export SDK surface budget; the two exact failed tooling files pass 16/16 on fresh Testbox tbx_01kwv2kj6ey3dr7f08w818mxp6
  • post-follow-up autoreview: no actionable findings, patch correct (0.98)
  • rebased onto current main and regenerated its stale raw-copy baseline; local ui:i18n:check is clean with 696 baseline entries and zero locale fallbacks
  • OpenAI organization usage now accepts only the dedicated OPENAI_ADMIN_KEY; Codex OAuth remains automatic for plan/quota, and inference/profile keys are never forwarded to organization APIs
  • provider auth/docs/manifest contract: 57 tests passed on fresh Testbox tbx_01kwv5sg25xc1dg84q1zc0pdsk
  • configured-plugin secret scrubbing and disabled-workspace trust regression: 29 tests passed on tbx_01kwv6ddxvrdj1m274j8tgphfr
  • final architecture proof: Madge reports zero cycles on tbx_01kwv6fhhkz65ss4tj0k91gk1t
  • final fresh autoreview after all accepted fixes: no actionable findings, patch correct (0.88)
  • refreshed docs/docs_map.md after the exact hosted docs gate identified the generated index drift
  • repaired the two pre-existing no-underscore-dangle failures surfaced by exact-head hosted lint; targeted run-oxlint and git diff --check pass
  • exact-head hosted CI run 28777758403 passed on attempt 2; the sole first-attempt native-command-session-target smoke timeout did not recur
  • rebased cleanly onto ba9700d59a1; the previously carried bundled-shape lint repair was already present on main and dropped automatically
  • exact-SHA full CI fanout passed 102 jobs and exposed two deterministic main-base inventory drifts plus two unrelated saturation timeouts; regenerated native/Control UI inventories pass both local checks
  • rebased onto 5000f324cbb; merged current-main translation memory with all 20 provider-usage translations, then regenerated metadata with zero fallbacks
  • re-audited latest CodexBar ff1c6c7; its newest change only affects Codex weekly-quota projection, while Anthropic/OpenAI cost contracts remain unchanged and matched
  • rebased onto 738654d20c7; current main now owns the Android worktree-chat locale rollout, the temporary branch sync was dropped, and android:i18n:check passes with all 26 keys aligned
  • final exact-head hosted CI run 28782938110 passed all 49 executed jobs at bc5bb8a3a29
  • accepted final autoreview finding: zero-cost days now render 0% chart bars instead of the positive-day 3% minimum; mixed zero/positive regression passes 7/7 on Testbox tbx_01kwvejb423gbmk905pcfh495r
  • post-fix autoreview: no actionable findings, patch correct (0.99)
  • final exact-head hosted CI run 28784395115 passed all 45 executed jobs at bdbc9574e18; no failed or pending required checks
  • rebased onto 17777b3a9ff; removed the branch changelog entry because current main's native prepare guard reserves CHANGELOG.md for release-owned updates, while retaining the release-note context in the PR body
  • rebased onto 8ce620f3e67, which owns the managed-worktree protocol export repair; this PR no longer touches gateway protocol
  • final exact-head hosted CI run 28785631021 passed on attempt 2 at caea6bda4cd; all 45 executed jobs are green, with the unrelated fast-mode timing shard clean on failed-job rerun
  • before/after proof: https://github.com/steipete/openclaw-pr-assets/releases/tag/provider-cost-history-100672

Known gap: authenticated successful Admin API proof was not run because no approved live Anthropic/OpenAI Admin key was available. Successful pagination and aggregation paths are covered with mocked provider responses; real endpoint discovery/auth failure routing is live-proven.

@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: f3c2c01c9d

ℹ️ 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".

Comment on lines +422 to +424
const oauth = await ctx.resolveOAuthToken();
if (oauth) {
return oauth;

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 Check stored OpenAI admin keys before OAuth

When a user has an existing ChatGPT/Codex OAuth profile and then stores an OpenAI Admin API key in an auth profile or SecretRef, this returns the OAuth token before the stored key candidates are inspected, so fetchOpenAIUsage takes the Codex quota path and the new Admin cost history never appears. The Anthropic path already classifies stored admin candidates before OAuth; OpenAI should similarly select a stored sk-admin-... candidate before falling back to OAuth.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 6, 2026, 6:54 AM ET / 10:54 UTC.

Summary
The PR adds Anthropic/OpenAI Admin API cost-history collection, usage-only credential metadata, a generic provider costHistory contract, Control UI rendering, docs, tests, and generated i18n updates.

Reproducibility: not applicable. this is a feature PR; source inspection confirms current main lacks provider costHistory and Admin API history collection.

Review metrics: 3 noteworthy metrics.

  • Usage credential env surface: 3 billing env vars added, 1 project-scope env read. New Admin credential names affect secret scrubbing, sandbox stripping, provider routing, and model-auth marker behavior before merge.
  • Provider plugin contract: 1 manifest field added, 1 cost-history snapshot shape added. The PR expands plugin-facing metadata and the provider usage snapshot contract, which is compatibility-sensitive.
  • Patch size: +2705/-164 across 97 files. The review surface spans provider runtimes, core usage contracts, auth/secrets helpers, docs, UI, and generated locales.

Stored data model
Persistent data-model change detected: persistent cache schema: docs/providers/anthropic.md, persistent cache schema: extensions/anthropic/usage.test.ts, 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/pt-BR.tm.jsonl, and 20 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100608
Summary: this PR is the candidate implementation for issue #100608; PR #100520 is the already-merged provider billing foundation, not a replacement for this work.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

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

Rank-up moves:

  • [P2] Remove providerUsageAuthEnvVars from inference auth marker discovery and add a regression covering OPENAI_ADMIN_KEY as usage-only.
  • Propagate OpenAI amount.currency into billing and costHistory units with a non-USD test fixture.
  • [P2] Have the maintainer/security owner confirm the Admin API credential and provider costHistory contract before merge.

Risk before merge

  • [P1] Merging as-is can allow a billing-only Admin API env marker such as OPENAI_ADMIN_KEY to be resolved as an inference credential for a configured model endpoint.
  • [P1] OpenAI organizations that report costs in a non-USD amount.currency would see mislabeled spend and cost-history units.
  • [P1] The PR expands provider plugin SDK/manifest/auth surface and should land only after the credential boundary and upgrade contract are explicitly accepted.

Maintainer options:

  1. Fix the credential boundary first (recommended)
    Keep usage env names in secret scrubbing and sandbox stripping, but remove them from provider auth marker discovery so Admin billing keys cannot be selected for inference.
  2. Carry OpenAI response currency
    Read amount.currency from the OpenAI Costs API result and use a consistent provider unit for billing and costHistory, with a non-USD regression test.
  3. Pause for contract redesign
    If maintainers are not ready to bless Admin API env metadata and costHistory as a plugin contract, pause or replace the PR rather than landing the new surface.

Next step before merge

  • [P2] Protected maintainer/security/product surface plus P1 auth-boundary and P2 currency defects require author or maintainer repair and review before merge.

Maintainer decision needed

  • Question: Should this PR merge after narrowly fixing the usage-only credential marker leak and OpenAI currency handling, or should the Admin API history contract be redesigned before merge?
  • Rationale: The feature crosses plugin SDK, provider auth, Admin API credentials, and sensitive billing-data display; automation can identify defects but should not decide the permanent security/product boundary.
  • Likely owner: steipete — He owns the linked issue, current PR, and recent provider billing foundation being extended.
  • Options:
    • Fix boundary then merge (recommended): Keep the provider cost-history design, but first remove usage env vars from inference marker discovery, propagate provider currency, and add focused regressions.
    • Redesign contract first: Pause the PR and rework the Admin API credential and provider cost-history contract before accepting the new SDK/manifest surface.
    • Defer Admin history: Close or supersede this PR if maintainers decide provider Admin API billing history should stay outside OpenClaw for now.

Security
Needs attention: The diff still has a credential-boundary bug that can expose usage-only Admin API keys to inference auth resolution.

Review findings

  • [P1] Keep usage env vars out of inference markers — src/secrets/provider-env-vars.ts:451
  • [P2] Use the provider currency in OpenAI costs — extensions/openai/usage.ts:338-343
Review details

Best possible solution:

Fix the usage-credential boundary and OpenAI currency handling before merge, then keep the Admin history feature behind the provider-owned plugin contract with maintainer-approved docs and tests.

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

Not applicable: this is a feature PR; source inspection confirms current main lacks provider costHistory and Admin API history collection.

Is this the best way to solve the issue?

No: the owner-boundary design is plausible, but the current implementation is not the best merge state until usage-only env vars cannot become inference markers and OpenAI currency is preserved.

Full review comments:

  • [P1] Keep usage env vars out of inference markers — src/secrets/provider-env-vars.ts:451
    providerUsageAuthEnvVars are documented as billing-only, but adding them here makes listKnownProviderEnvApiKeyNames() classify markers like OPENAI_ADMIN_KEY as model env API-key markers. resolveUsableCustomProviderApiKey() then reads that env value for inference, so an org-admin billing key can be sent to a configured model endpoint instead of staying usage-only.
    Confidence: 0.94
  • [P2] Use the provider currency in OpenAI costs — extensions/openai/usage.ts:338-343
    The Costs API result includes amount.currency alongside amount.value, but this code forces both the spend card and cost history to USD. Non-USD organizations would see the provider's monetary value labeled with the wrong currency, so carry the response currency through the aggregate and add a non-USD regression.
    Confidence: 0.88

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority provider cost-visibility feature with meaningful operator value, not an outage or blocked first-run path.
  • merge-risk: 🚨 compatibility: The PR adds public providerUsageAuthEnvVars metadata and a costHistory snapshot shape that provider plugins and UI consumers may rely on.
  • merge-risk: 🚨 auth-provider: The diff changes provider usage credential discovery and currently lets usage-only Admin env names flow into model auth marker resolution.
  • merge-risk: 🚨 security-boundary: The PR handles organization Admin API keys and billing data, and the current marker path can send an Admin key to inference endpoints.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The PR body provides linked before/after Usage screenshots plus Testbox checks and live dummy-credential endpoint probes; authenticated Admin success was not available but the posted proof is adequate for the visible UI/routing path.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides linked before/after Usage screenshots plus Testbox checks and live dummy-credential endpoint probes; authenticated Admin success was not available but the posted proof is adequate for the visible UI/routing path.
Evidence reviewed

Security concerns:

  • [high] Usage-only Admin env vars can become inference credentials — src/secrets/provider-env-vars.ts:451
    The new providerUsageAuthEnvVars names are included in known provider auth env vars, which model auth marker resolution treats as env API-key markers; this can resolve an Admin billing key for model inference.
    Confidence: 0.94

Acceptance criteria:

  • [P1] Inspect src/secrets/provider-env-vars.ts, src/agents/model-auth-env-vars.ts, src/agents/model-auth-markers.ts, and src/agents/model-auth.ts for the usage-only credential boundary.
  • [P1] Inspect extensions/openai/usage.ts and extensions/openai/usage.test.ts for amount.currency propagation.
  • [P1] Run the PR's focused provider/auth/UI/security suites on the approved remote validation path before merge.

What I checked:

  • Live PR state: this PR is open at caea6bd, closes Provider cost history for Anthropic and OpenAI Admin APIs #100608, touches 97 files with +2705/-164 LOC, and has maintainer/proof/merge-risk labels. (caea6bda4cd0)
  • Usage env vars enter inference marker discovery: The PR adds providerUsageAuthEnvVars to listKnownProviderAuthEnvVarNames, and that helper is exposed as listKnownProviderEnvApiKeyNames for model auth marker matching. (src/secrets/provider-env-vars.ts:451, caea6bda4cd0)
  • Inference resolution consumes known env markers: isKnownEnvApiKeyMarker uses listKnownProviderEnvApiKeyNames, and resolveUsableCustomProviderApiKey reads the environment value for a matching models.json marker. (src/agents/model-auth.ts:317, caea6bda4cd0)
  • Manifest contract says usage credentials are not inference auth: The PR docs define providerUsageAuthEnvVars as billing-only credentials used for discovery/scrubbing and explicitly not inference credentials. Public docs: docs/plugins/manifest.md. (docs/plugins/manifest.md:161, caea6bda4cd0)
  • OpenAI currency is discarded: The OpenAI aggregation reads amount.value from each cost result, but both billing and costHistory force unit: "USD". (extensions/openai/usage.ts:338, caea6bda4cd0)
  • OpenAI Costs API currency contract: The official OpenAI Costs API page describes amount value as monetary value in its associated currency and amount.currency as a lowercase ISO-4217 currency.

Likely related people:

  • steipete: Authored the current PR and issue, introduced the admin cost-history commit, and authored the merged provider billing foundation PR feat: show auto-detected provider plans and billing #100520 that this extends. (role: recent feature owner and likely decision owner; confidence: high; commits: e65d486081f8, 07e2d633cc33, ca2e508f8705; files: extensions/openai/usage.ts, extensions/anthropic/usage.ts, src/infra/provider-usage.types.ts)
  • Masato Hoshino: Blame on the existing provider env-var auth helper shows recent work around the helper that the PR extends with usage credential names. (role: adjacent owner; confidence: medium; commits: e7158a581da1; files: src/secrets/provider-env-vars.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.
Review history (4 earlier review cycles)
  • reviewed 2026-07-06T06:57:13.539Z sha e6ae727 :: needs changes before merge. :: [P2] Check stored OpenAI admin keys before OAuth
  • reviewed 2026-07-06T07:06:19.338Z sha e6ae727 :: needs changes before merge. :: [P2] Check stored OpenAI admin keys before OAuth
  • reviewed 2026-07-06T08:44:34.808Z sha 036d445 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-06T10:01:45.484Z sha bc5bb8a :: found issues before merge. :: [P2] Use OpenAI's returned currency for costs

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 6, 2026
@steipete
steipete force-pushed the codex/provider-admin-cost-history branch from a07c864 to e6ae727 Compare July 6, 2026 06:51

@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: e6ae7278f8

ℹ️ 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".

Comment on lines +290 to +292
const cacheWriteTokens =
nonNegativeInteger(cacheCreation?.ephemeral_1h_input_tokens) +
nonNegativeInteger(cacheCreation?.ephemeral_5m_input_tokens);

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 Read Anthropic cache-write totals from top-level fields

When the Admin Usage API returns prompt-cache creation usage, Anthropic's Usage Report schema exposes the write counts as top-level cache_creation_5m_input_tokens and cache_creation_1h_input_tokens fields, not as result.cache_creation.ephemeral_*. In any report with cache writes this keeps cacheWriteTokens at zero and undercounts totalTokens/model totals in the new cost-history card even though the provider returned the data; the current unit test mocks the non-API shape, so it does not catch the regression.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 6, 2026
@steipete
steipete force-pushed the codex/provider-admin-cost-history branch from e6ae727 to 5d6bb1c Compare July 6, 2026 07:55
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Jul 6, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The prior finding reviewed e6ae7278f8a1. Current head 5d6bb1c8819 intentionally does not inspect or forward stored OpenAI inference/profile keys before OAuth: those credentials may belong to custom, Azure, or agent-local endpoints. OpenAI organization usage now requires the dedicated OPENAI_ADMIN_KEY; Codex OAuth remains the automatic plan/quota fallback. The provider docs, normalization mock, and focused regressions match that contract.

Proof: 57 provider auth/docs/manifest tests passed on Testbox tbx_01kwv5sg25xc1dg84q1zc0pdsk; 29 active-vs-disabled plugin secret-scrubbing tests passed on tbx_01kwv6ddxvrdj1m274j8tgphfr; final Madge check reported zero cycles on tbx_01kwv6fhhkz65ss4tj0k91gk1t; fresh autoreview reported no actionable findings (0.88).

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@steipete
steipete force-pushed the codex/provider-admin-cost-history branch from 5d6bb1c to 94e5244 Compare July 6, 2026 08:07
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Jul 6, 2026
@steipete
steipete force-pushed the codex/provider-admin-cost-history branch from 0ee7145 to 96a5d94 Compare July 6, 2026 08:12
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 6, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 6, 2026
@steipete
steipete force-pushed the codex/provider-admin-cost-history branch from be55a7a to bdbc957 Compare July 6, 2026 10:16
@openclaw-barnacle openclaw-barnacle Bot removed the app: android App: android label Jul 6, 2026
@steipete
steipete force-pushed the codex/provider-admin-cost-history branch 2 times, most recently from 3e9c50d to f0cdcd3 Compare July 6, 2026 10:35
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Jul 6, 2026
@steipete
steipete force-pushed the codex/provider-admin-cost-history branch from f0cdcd3 to caea6bd Compare July 6, 2026 10:40
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 6, 2026
@steipete
steipete merged commit 8274022 into main Jul 6, 2026
161 of 164 checks passed
@steipete
steipete deleted the codex/provider-admin-cost-history branch July 6, 2026 11:06
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
* feat(providers): add admin cost history

* fix(ui): sync cron raw-copy baseline

* fix(usage): harden provider cost credentials

* fix(ui): refresh raw-copy baseline

* docs: refresh documentation map

* fix(ci): sync provider usage baselines

* fix(ui): hide zero-cost history bars

* docs(changelog): defer provider cost note
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
* feat(providers): add admin cost history

* fix(ui): sync cron raw-copy baseline

* fix(usage): harden provider cost credentials

* fix(ui): refresh raw-copy baseline

* docs: refresh documentation map

* fix(ci): sync provider usage baselines

* fix(ui): hide zero-cost history bars

* docs(changelog): defer provider cost note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation extensions: anthropic extensions: openai maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider cost history for Anthropic and OpenAI Admin APIs

1 participant