Skip to content

Account Pooler drops Claude Code Opus to a 200k context window (ANTHROPIC_BASE_URL disables native 1M); no [1m] model to work around it #4207

Closed

Description

@BartSoj

Summary

With Account Pooler routing on for Claude, every Claude Code thread runs Opus 5.5 with a 200k context window instead of 1M. Threads that were over 200k then fail with Prompt is too long. The cause is that the pooler points ANTHROPIC_BASE_URL at a local proxy, and Claude Code only gives Opus its native 1M window when the base URL is Anthropic's own. bb doesn't offer a [1m] model to work around it: the catalog has no such entry and bb thread update --model rejects it.

Environment: bb 0.43.4 (desktop, macOS), Claude Code 2.1.280, builtin [email protected], two Claude Max 20x OAuth accounts in the pool.

Reproduction

Same machine, same binary, same account. The pooled rows run inside a bb thread, so the pool env vars are inherited.

Route Model ID modelUsage.*.contextWindow
Account Pooler proxy claude-opus-5-5 200000
Direct claude.ai login (pool env removed) claude-opus-5-5 1000000
Account Pooler proxy claude-opus-5-5[1m] 1000000
# inside a bb Claude thread with pool routing on
claude -p "say ok" --model claude-opus-5-5 --output-format json --setting-sources "" | jq '.modelUsage'
# same, bypassing the pool
env -u ANTHROPIC_BASE_URL -u ANTHROPIC_AUTH_TOKEN claude -p "say ok" --model claude-opus-5-5 --output-format json --setting-sources "" | jq '.modelUsage'

In our case, 23 threads failed with Prompt is too long within a few hours of the pooler being enabled. After bb pool routing claude --off, bb thread retry recovered them: one resumed at about 660k tokens of context.

Root cause

In Claude Code 2.1.280, an Opus ID without [1m] only gets the native 1M window when ANTHROPIC_BASE_URL is unset or points at api.anthropic.com:

function ms(){ if(_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL) return true; return hb() }
function hb(){ let e=process.env.ANTHROPIC_BASE_URL; if(!e) return true; return ["api.anthropic.com"].includes(new URL(e).host) }
function jh(model){ ... if(provider==="firstParty" && ms()) return true; ... }  // modelHasNative1MContext

For pooled threads the provider sets ANTHROPIC_BASE_URL=http://127.0.0.1:<port>/api/v1/plugins/account-pool/http. That fails hb(), so Opus falls back to 200k.

Related problems

  1. No way to pick 1M Opus. The Claude Code catalog currently lists plain claude-opus-5-5. bb thread update <id> --model 'claude-opus-5-5[1m]' is rejected with HTTP 400: Model "claude-opus-5-5[1m]" is not available in this thread's claude-code model catalog. So once pooling is on, there is no user-side workaround. (Related: Claude Code catalog offers Opus only in 1M variants: no way to select a 200K-context Opus #3571, which describes the opposite catalog state in 0.43.0.)
  2. Misleading 200k placeholder. Until a thread's first result arrives, bb shows resolveClaudeModelContextWindowHint("claude-opus-5-5"), which is 200k. New or interrupted threads show / 200,000 even when Claude is actually running with 1M, which makes it hard to tell whether a fix worked.

Expected

A pooled Claude thread should get the same context window as the pooled account's own login would give it. For Max accounts on Opus 5.5 that is 1M.

Suggested fixes

  1. When pool routing is on, have the provider launch Claude Code with _CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL=1, since the pool is a transparent first-party proxy. Another option is to launch pooled Opus as claude-opus-5-5[1m].
  2. Offer [1m] variants such as "Opus 5.5 (1M)" in the catalog, or at least accept them in bb thread update --model.
  3. Before the first result, use the window Claude Code reports at init, or the account's entitlement, instead of a hardcoded 200k hint.

Workaround

bb pool routing claude --off, then bb thread retry on threads that failed with Prompt is too long. This gives up pooled failover for Claude.

🤖 Generated with Claude Code

Activity

  1. added theissue type on Sep 23, 2026
  2. added
    providers
    provider-claude-code
    partial-repro
    on Sep 23, 2026
  3. bb-slop-cop commented on Sep 23, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classified Bug · High priority · Medium effort; added providers, provider-claude-code, and partial-repro.

    Reproduction report: PARTIALLY REPRODUCED, medium root-cause confidence. The same source-derived diagnostic in two clean checkouts confirmed that plain Opus receives a 200k fallback hint while the explicit extended variant receives 1M. Pooling changes the base URL; the live account-dependent capacity reduction remains unverified. The catalog preserves SDK-discovered extended variants.

    No PR: the central failure was not fully reproduced, and a missing local pnpm executable blocked the required build and test suites. The report includes the repeatable diagnostic and both results.

    AGENT GENERATED

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    partial-reproprovider-claude-codeproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions