Repository navigation
Description
Summary
Claude Code can run through a custom Anthropic-compatible backend configured in ~/.claude/settings.json without a native Claude OAuth credential. Stock BB reports its usage as unauthenticated and Provider Usage gives a sign-in prompt, so it cannot show that backend's limits. Signing in to Claude does not connect BB's usage check to the configured backend.
Versions and environment
- bb CLI 0.44.0; current source checked at
facb6c161d9915d2517ed15f6101e4295cf85da1. - macOS 26.6.2 (25G83), Claude Code 2.1.285, Node 26.2.0.
- Claude user
settings.jsoncontainsenv.ANTHROPIC_BASE_URL,env.ANTHROPIC_AUTH_TOKEN, andenv.ANTHROPIC_CUSTOM_HEADERS. Backend address and credential values are omitted. There is no~/.claude/.credentials.json. - Investigation: @thread:thr_k562vjf3im.
Steps to reproduce
- Install Claude Code and configure
~/.claude/settings.jsonwith a working Anthropic-compatible backend:{ "env": { "ANTHROPIC_BASE_URL": "https://gateway.example", "ANTHROPIC_AUTH_TOKEN": "<backend-token>" } } - Do not create a native Claude OAuth credential.
- Run Claude Code with this configuration, then run
bb settings usage --json | jq -c '."claude-code"'. - Open Provider Usage in BB.
Expected vs actual
Observed from the installed BB CLI:
{"status":"unauthenticated"}Provider Usage consequently presents Claude sign-in guidance. Expected: BB should recognize that this is a configured backend, avoid claiming Claude login is required, and show quota windows when a backend-specific usage source is configured. If the backend offers no readable quota API, BB should say its limits are unavailable rather than claim the agent is unauthenticated. Anthropic OAuth quota must not be presented as this backend's quota.
Evidence
- The provider reads only macOS Keychain or
~/.claude/.credentials.jsonfor maintenance credentials: provider-maintenance.ts#L282-L298. - Missing OAuth credentials return
unauthenticatedbefore any backend settings are examined: provider-maintenance.ts#L499-L515. - When OAuth exists, BB calls Anthropic's fixed OAuth endpoint, so a custom gateway's usage is still not queried: provider-maintenance.ts#L517-L526.
- The built-in Claude usage source forwards this host-local result to Provider Usage: usage-source.ts#L73-L95.
- Anthropic documents
ANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKENfor LLM gateways, but gateway quota APIs are backend-specific: LLM gateway configuration.
What you ruled out
- Not Claude usage check ignores CLAUDE_CONFIG_DIR, reporting expired for a signed-in account #3607: that issue has a working native OAuth account in a nondefault
CLAUDE_CONFIG_DIR; here there is no native OAuth credential to read. - Not Let plugins contribute to Settings → Usage limits #1620: Provider Usage already accepts plugin sources; this issue is the built-in Claude source's authentication and backend detection.
- A missing CLI install is not the cause: Claude Code 2.1.285 is installed and
claude auth status --jsonreportsloggedIn: trueon this setup. A live model request and a backend quota response were not collected during this investigation.
Suggested priority and effort
The misleading sign-in state affects every Claude Code setup routed solely through a custom backend. A generic quota percentage cannot be inferred from ANTHROPIC_BASE_URL alone; a fix needs a backend-specific source or an explicit adapter interface, with CLI, SDK, and UI output aligned.
AGENT GENERATED
Activity
pieroshka commentedon Sep 30, 2026
Closing at the reporter’s request. ModelHub already exposes quota data through /api/v1/quota with a separate quota:read token. The proposed BB change is not being submitted, and no BB PR was opened. > AGENT GENERATED