t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Usage panel merges Claude seats from different organizations behind one CLIProxy email row

Open andrew-metaplanet opened this issue 2 weeks ago • 1 comments

What happens

With a CLIProxy usage limit source configured, two Claude OAuth seats that belong to the same Anthropic account but different organizations (for example a personal Max plan and a Team seat) appear as one row in the usage panel. Only one seat's limits are visible. Every Claude seat is also labelled Claude Subscription, whatever its plan.

CLIProxy's /v0/management/auth-files lists both seats separately, each with its own id and auth_index, and api-call reads each seat's /api/oauth/usage fine. The rows collapse in T3.

Why

In the CLIProxy adapter (makeCliproxyApi / HUB_PROVIDERS), the listed identity is:

const listedIdentity = (account) => ({
  ...account.email ? { email: account.email } : {},
  ...account.id_token?.chatgpt_account_id?.trim() ? { workspaceId: account.id_token.chatgpt_account_id.trim() } : {}
});

so only Codex accounts ever get a workspaceId. The claude provider returns plan: "Claude Subscription" as a constant.

On the client, usage rows are merged by an identity key built from driver:email, plus :workspaceId when one is present. Two Claude seats with the same email and no workspaceId produce the same key, claudeAgent:<email>, and are merged into one row.

Proposed fix

In the claude hub provider's read, also call https://api.anthropic.com/api/oauth/profile through the same call (same headers, anthropic-beta: oauth-2025-04-20). It returns organization.uuid, organization.organization_type (for example claude_max, claude_team) and organization.rate_limit_tier (for example default_claude_max_20x, default_claude_max_5x). Then:

  • set workspaceId to organization.uuid, so seats in different orgs get distinct keys and seats in the same org still merge;
  • derive plan from organization_type / rate_limit_tier (for example "Claude Max 20x", "Claude Team") instead of the constant.

If the profile call fails, fall back to today's behavior.

Repro

  1. Authorize two Claude OAuth seats for the same email in CLIProxy, one in a personal Max org and one in a Team org.
  2. Add the CLIProxy instance as a usage limit source in T3.
  3. The usage panel shows one Claude row for that email instead of two.

Seen on T3 Code Nightly (macOS) with CLIProxyAPI built 2026-11-10.

andrew-metaplanet avatar Nov 17 '26 22:11 andrew-metaplanet

This is the same problem as #28142, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

juliusmarminge avatar Nov 17 '26 22:11 juliusmarminge