CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Feature request: OpenDesign subscription usage provider

Open vimcaw opened this issue 1 month ago • 5 comments

Summary

Please add OpenDesign as a usage provider so CodexBar can show the quota/usage of an OpenDesign subscription alongside providers such as Codex, Claude, Command Code, OpenCode Go, etc.

The main goal is subscription allowance tracking, not API-key spend tracking: show how much of the OpenDesign plan allowance has been consumed and when the relevant usage window resets, using the most authoritative source OpenDesign exposes.

Use case

OpenDesign subscriptions can be used from coding agents, so it is useful to see the remaining allowance without opening the OpenDesign dashboard or its CLI separately.

For users who switch among several subscription-backed coding providers, having OpenDesign in CodexBar would make it possible to compare remaining capacity and reset timing from the same menu bar UI.

Requested behavior

Ideally the provider would expose whatever authoritative fields OpenDesign makes available, for example:

  • current subscription/plan identity when available;
  • usage consumed / remaining allowance;
  • reset time or billing/usage-window boundary;
  • multiple windows separately if OpenDesign exposes more than one;
  • stale/error state rather than estimating quota from local token usage when authoritative quota cannot be fetched.

Authentication should preferably reuse a supported OpenDesign login/session mechanism (for example its browser/device login flow) or another stable provider-owned source. If OpenDesign only exposes a documented API-key route, an explicit API-key source would still be useful, but reading private credential files from another app/CLI should not be required.

Scope

This request is for OpenDesign subscription usage/quota. It is separate from estimating API-equivalent token cost from local agent logs.

A minimal first version that only shows the primary subscription usage window would already be useful; additional plan metadata or detailed spend/history could come later.

Duplicate search

I searched existing CodexBar issues and PRs for OpenDesign, Open Design, and related usage terms before filing and did not find an existing OpenDesign provider/usage request.

vimcaw avatar Oct 17 '26 07:10 vimcaw

Codex review: this still needs some work.

Summary This issue now has concrete quota fixtures and owner engagement, while current main still lacks OpenDesign support; retain it for a narrow browser-session plugin decision.

Reproducibility: This is a missing-provider request rather than an existing-behavior bug; source inspection confirms the absence, and the author supplies sanitized endpoint responses without an independently verified account probe.

Next step Validate the supplied browser-session flow and workspace scope, then implement the owner's proposed small plugin with quota-mapping and authentication-failure coverage.

Review details

Best possible solution:

Deliver an optional OpenDesign plugin using shared session handling, authoritative quota windows, workspace-scoped identity, and explicit unavailable states.

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

This is a missing-provider request rather than an existing-behavior bug; source inspection confirms the absence, and the author supplies sanitized endpoint responses without an independently verified account probe.

Is this the best way to solve the issue?

A small plugin follows the owner's stated direction and existing host capabilities; validate the supplied browser flow before implementation, without requiring an API-key route that the proposed web source does not use.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The reported browser flow has not been independently exercised, and its minimum headers, cookie scope, and session-expiry behavior remain unverified.
  • The supplied fixtures cover a personal subscription; team workspaces, permission failures, and ineligible accounts still need defined handling.

Codex review notes: model internal, reasoning medium; reviewed against 7683b73676bf.

Label changes

Label changes:

  • remove clawsweeper:needs-product-decision: Current issue advisory state no longer selects this label.

Label justifications:

  • P3: This adds optional provider coverage without an established failure in an existing supported workflow.
Evidence reviewed

What I checked:

  • Owner engagement and new quota evidence: The owner proposed a small plugin in https://github.com/steipete/CodexBar/issues/4601#issuecomment-6255288961; the author subsequently supplied workspace discovery, browser-session authentication, and sanitized five-hour and weekly quota responses in https://github.com/steipete/CodexBar/issues/4601#issuecomment-6331822495, while explicitly leaving API-key access and the minimal header set unconfirmed.
  • Integration remains absent: The provider enum contains no OpenDesign entry, and searches across source, tests, plugin tests, documentation, and README found no OpenDesign integration; GitHub main matches the reviewed checkout. (Sources/CodexBarCore/Providers/Providers.swift:21, 7683b73676bf)
  • Existing host capabilities fit the proposed flow: Plugins support custom request headers, browser-session enumeration and rejection, authenticated HTTP, multiple quota windows, ISO reset timestamps, and refresh errors alongside previous usage; a missing shared host API has not been established. (docs/plugins.md:253, 7683b73676bf)
  • Established cookie integration and isolation coverage: WorkBuddy uses an access-gated, request-scoped cookie plugin; existing cookie-jar tests cover host/path matching and credential-safe redirects, providing relevant implementation patterns without proving OpenDesign authentication. (TestsPlugin/ProviderPluginCookieJarTests.swift:43, 7683b73676bf)
  • Canonical and paired-item search: All-state searches for OpenDesign, open-design.ai, the spaced title, and references to this issue found no separate owning item; the author has no other open item in this repository.
  • Provider acceptance boundary: VISION.md welcomes provider additions following existing patterns but requires sign-off when authentication or privacy behavior remains unclear; the root AGENTS.md requires shared browser discovery, prompt controls, and provider identity isolation. (VISION.md:20, 7683b73676bf)
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; those execution lanes are retired.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Reviewed October 23, 2026, 4:37 AM ET / 08:37 UTC.

clawsweeper[bot] avatar Oct 17 '26 07:10 clawsweeper[bot]

Thanks for the request, @vimcaw. Is https://open-design.ai the service you mean? Its open-source client describes a workspace billing/preflight response with subscription windows (usedCredits, limitCredits, durationSeconds), which looks like the right source, but we couldn't confirm how an external client is meant to authenticate to read it.

If you can, please link the supported quota endpoint, or share a sanitized console/CLI response that shows the plan, used/total allowance, reset time and workspace scope (credentials and identifiers removed), and say whether an ordinary OpenDesign API key can read it. With that we can build it as a small plugin.

steipete avatar Oct 18 '26 21:10 steipete

@steipete Yes, https://open-design.ai is the service I mean.

I confirmed that the web source is sufficient to discover both the current workspace and the subscription quota using the signed-in browser session.

1. Discover the current workspace

GET https://amr-api.open-design.ai/api/v1/workspaces/current

Observed auth:

Accept: application/json
Cookie: __Secure-better-auth.session_token=<redacted>

Sanitized response shape:

{
  "userId": "<redacted>",
  "appUserId": "<redacted>",
  "workspaceId": "<workspace-id>",
  "workspaceName": "<redacted>",
  "workspaceType": "personal",
  "workspaceMemberId": "<redacted>",
  "role": "owner",
  "memberStatus": "active",
  "lifecycleState": "active",
  "billingState": "free",
  "planId": null,
  "personalMembershipTier": "go",
  "providerMode": "platform_credits",
  "permissions": {
    "canViewUsage": true,
    "canViewBillingRecords": true
  },
  "activeWorkspaceId": "<workspace-id>",
  "activeWorkspaceVersion": 1
}

For a personal subscription, personalMembershipTier appears to carry the OpenDesign plan tier (go in this example).

2. Fetch subscription usage

Using the discovered workspace ID:

GET https://amr-api.open-design.ai/api/v1/workspaces/<workspace-id>/billing/coding-plan-usage

Observed relevant headers:

Accept: application/json
X-Vela-Workspace-Id: <workspace-id>
Cookie: __Secure-better-auth.session_token=<redacted>

Sanitized response:

{
  "workspaceId": "<workspace-id>",
  "generatedAt": "2026-10-22T02:55:53.642Z",
  "eligible": true,
  "tier": "go",
  "windows": [
    {
      "policyId": "<redacted>",
      "durationSeconds": 18000,
      "resetMode": "anchored_recurring",
      "usedCredits": "500",
      "limitCredits": "50000",
      "remainingCredits": "49500",
      "windowStart": "2026-10-21T23:29:30.000Z",
      "resetsAt": "2026-10-22T04:29:30.000Z"
    },
    {
      "policyId": "<redacted>",
      "durationSeconds": 604800,
      "resetMode": "anchored_recurring",
      "usedCredits": "10451",
      "limitCredits": "150000",
      "remainingCredits": "139549",
      "windowStart": "2026-10-21T18:29:30.000Z",
      "resetsAt": "2026-10-28T18:29:30.000Z"
    }
  ]
}

This maps directly to the OpenDesign web UI:

  • 18000 seconds → Design Plan · 5-hour limit
    • 500 / 50000 used → 99% left
    • reset from resetsAt
  • 604800 seconds → Design Plan · 7-day limit
    • 10451 / 150000 used → 93% left
    • reset from resetsAt

So a CodexBar web source could be roughly:

browser session cookie
  → GET /api/v1/workspaces/current
  → read active/current workspaceId
  → GET /api/v1/workspaces/{workspaceId}/billing/coding-plan-usage
  → map windows[] to RateWindow

Suggested field mapping:

tier / personalMembershipTier → plan identity
durationSeconds             → quota window duration
usedCredits / limitCredits  → used percentage
remainingCredits            → remaining quota
resetsAt                    → reset time
generatedAt                 → snapshot timestamp
eligible                    → whether coding-plan quota is available

The response appears to be authoritative server-side subscription-window data, so no local token/cost estimation is needed.

I have not confirmed that an ordinary OpenDesign API key can access these endpoints. The working web flow uses the __Secure-better-auth.session_token browser session, which seems analogous to CodexBar's existing web-source integrations for other subscription providers.

The other browser/analytics cookies and Chromium headers shown by DevTools do not appear conceptually relevant to the integration; I have not yet tested the exact minimal header set.

vimcaw avatar Oct 22 '26 03:10 vimcaw

Answering the open question in the owner request: an OpenDesign API key cannot read the quota endpoint. Keys are chat-only.

What I tested

With a valid Go-plan sk-amr-… key (the same key that works for chat completions), against every plausible credential header:

GET https://amr-api.open-design.ai/api/v1/workspaces/current
Accept: application/json
Authorization: Bearer sk-amr-…
# also tried: x-api-key: sk-amr-…

Both return:

401 {"error":"unauthenticated"}

The chat gateway at https://amr-link.open-design.ai/v1 answers /v1/models and /v1/chat/completions with that key, but has no usage/billing/key-introspection route (/v1/usage, /v1/key, /v1/me, /v1/credits, /v1/auth/key are all 404). So the AMR Link key is scoped to inference only, and the billing routes sit on a different origin (amr-api) behind the __Secure-better-auth.session_token cookie.

This is consistent with what the pi extension @eiei114/pi-sub-core documents for its own OpenDesign usage provider: it reads quota through the Vela CLI (vela billing preflight) after vela login and states that the sk-amr-… key "authenticates chat only; amr-api billing routes reject it."

Consequence for the plugin

The provider is implementable as a browser-session (cookie) plugin only — the shape @vimcaw already supplied for workspaces/current + billing/coding-plan-usage. There is no API-key fallback to offer, so the settings surface should be cookie-source only (Automatic/Manual/Off), not an API-key field.

I wrote a local plugin against the documented contract and ran it on the sanitized responses in this thread. Mapping and edge cases, with the 5h window → primary and the weekly window → secondary (selected by durationSeconds, not array order, so a reorder cannot mislabel the meter):

Check Result
5h (18000) → primary, weekly (604800) → secondary pass
usedCredits/limitCredits decimal strings → percent + quotaUnit: credits pass
X-Vela-Workspace-Id sent on the usage call pass
Workspace auto-discovered from /workspaces/current, or pinned by a workspaceId setting pass
401 → authentication expired (not missing credential), session rejected pass
403 → permission denied, 429 → rate limited pass
Non-numeric credits or a zero limitCredits → parse failure / window dropped, never NaN pass
Windows returned in reverse order still labelled correctly pass

Two behaviours worth confirming before this ships, since both are inferred rather than observed:

  1. Whether billing/coding-plan-usage requires the __Secure- cookie specifically, and whether a session that only holds open-design.ai cookies (rather than amr-api.open-design.ai) resolves across the subdomain boundary. I declared both domains.
  2. Whether a non-go tier returns the same two durationSeconds values. I key on 18000/604800 and fall back to "no window" rather than guessing a cadence.

Happy to open a PR with the plugin plus a provider doc if that is the preferred shape — say the word and I will follow the WorkBuddy cookie-provider pattern (docs/workbuddy.md / Sources/CodexBarCore/Resources/Plugins/workbuddy.ts).

irfndi avatar Oct 30 '26 09:10 irfndi

Fixed in #4859 (12e9aa09a1b1); it will ship in the next release. Thanks for the report!

steipete avatar Oct 31 '26 01:10 steipete