Skip to content

[Bug]: OAuth tokens (sk-ant-oat) skip service_tier, causing excessive 529 overloaded errors #55758

@rxyknight

Description

@rxyknight

Summary

OAuth tokens (sk-ant-oat-*) are excluded from service_tier injection in createAnthropicFastModeWrapper. During high API load, this causes OAuth-authenticated requests to receive significantly more HTTP 529 overloaded_error responses compared to Claude Code (which uses the same OAuth token type but with service_tier enabled).

Root cause

In src/agents/pi-embedded-runner/anthropic-stream-wrappers.ts, the fast mode wrapper explicitly skips OAuth tokens:

// createAnthropicFastModeWrapper
if (model.api !== "anthropic-messages" || model.provider !== "anthropic" 
    || !isAnthropicPublicApiBaseUrl(model.baseUrl) 
    || isAnthropicOAuthApiKey(options?.apiKey))   // ← OAuth skipped here
    return underlying(model, context, options);

// Only non-OAuth gets service_tier
payloadObj.service_tier = serviceTier;

This means OAuth-authenticated requests are sent without any service_tier parameter, resulting in lowest priority during high load. Claude Code itself uses the same sk-ant-oat token type but includes service_tier, which is why it works fine while OpenClaw gets 529s under the same conditions.

Steps to reproduce

  1. Configure OpenClaw with an Anthropic OAuth token (sk-ant-oat-*)
  2. Use claude-opus-4-6 as primary model
  3. Send messages during periods of elevated Anthropic API load
  4. Observe repeated 529 overloaded_error responses, even with Sonnet fallback configured (both models fail)

Meanwhile, Claude Code CLI using the same account/token type works without issues.

Evidence from logs

132 overloaded errors in a single day, in bursts of 5 retries per request, across 11 separate runs:

"httpCode": "529",
"providerErrorType": "overloaded_error",
"model": "claude-opus-4-6",
"provider": "anthropic"

The cooldown cascade makes it worse: after 4 failures, the auth profile enters a 1-hour cooldown (calculateAuthProfileCooldownMs with 5^n backoff), blocking all subsequent requests.

Expected behavior

OAuth tokens should include service_tier in API requests, matching the behavior of Claude Code and other first-party Anthropic clients.

Actual behavior

OAuth tokens are excluded from service_tier injection, receiving no priority during high load, leading to persistent 529 errors and cooldown cascades.

Related

OpenClaw version

2026.3.13 (also verified unchanged in 2026.3.24)

Operating system

macOS 26.4 (arm64)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions