openclaw - 💡(How to fix) Fix Bug: Anthropic API-key auth shows 'invalid bearer token' in status --usage, but the key works for inference

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When openclaw status --usage (or /status in the UI) runs, it probes usage/quota for every configured auth profile, including Anthropic. For an Anthropic profile configured with a standard sk-* API key (the pay-per-use billing model from console.anthropic.com), the usage check returns "HTTP 401 authentication_error: Invalid bearer token".

This is misleading. The API key is fully valid for inference (confirmed: direct calls to api.anthropic.com/v1/messages succeed with 200). The root cause is that Anthropic simply has no usage/quota endpoint for pay-per-use API keys — it's an error of "no such endpoint for this auth type" that surfaces as an authentication failure.

Error Message

Anthropic: HTTP 401 authentication_error: Invalid bearer token

Root Cause

This is misleading. The API key is fully valid for inference (confirmed: direct calls to api.anthropic.com/v1/messages succeed with 200). The root cause is that Anthropic simply has no usage/quota endpoint for pay-per-use API keys — it's an error of "no such endpoint for this auth type" that surfaces as an authentication failure.

Code Example

Anthropic: HTTP 401 authentication_error: Invalid bearer token
RAW_BUFFERClick to expand / collapse

Summary

When openclaw status --usage (or /status in the UI) runs, it probes usage/quota for every configured auth profile, including Anthropic. For an Anthropic profile configured with a standard sk-* API key (the pay-per-use billing model from console.anthropic.com), the usage check returns "HTTP 401 authentication_error: Invalid bearer token".

This is misleading. The API key is fully valid for inference (confirmed: direct calls to api.anthropic.com/v1/messages succeed with 200). The root cause is that Anthropic simply has no usage/quota endpoint for pay-per-use API keys — it's an error of "no such endpoint for this auth type" that surfaces as an authentication failure.

Steps to Reproduce

  1. Configure an anthropic auth profile in OpenClaw using a standard sk-* API key from console.anthropic.com (not OAuth/setup-token).
  2. Run openclaw status --usage or check /status in the UI.
  3. Observe the Anthropic profile reported as failing with "Invalid bearer token".

Expected Behavior

OpenClaw should either:

  • Skip the usage check entirely for Anthropic API-key auth (since Anthropic doesn't expose quota data for pay-per-use keys), reporting "n/a" or similar.
  • Surface an actionable message like "pay-per-use API key — no usage quota endpoint available" instead of the misleading "invalid bearer token" error.

Actual Behavior

Anthropic: HTTP 401 authentication_error: Invalid bearer token

Impact

  • Users with valid Anthropic API keys see a persistent "invalid bearer token" error in /status, which suggests the key is broken when it actually works for inference.
  • Confusion between this and the separate (already-filed) issue #4614 about user:profile scope for setup-token OAuth auth. That issue covers the OAuth path; this issue covers the standard sk-* API-key path.

Related

  • #4614 — Usage tracking broken for setup-token auth (missing user:profile scope). That issue covers the OAuth/setup-token path. This is the distinct pay-per-use API-key path.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING