Skip to content

[Bug]: Intermittent "API provider billing error" shown to user — swallows actual response #13935

@jm-fhc

Description

@jm-fhc

Description

Intermittent error message surfaces in Telegram chat that reads:

⚠️ API provider returned a billing error — your API key has run out of credits or has an insufficient balance. Check your provider's billing dashboard and top up or switch to a different API key.

The error is misleading — no API billing limits have actually been reached. More critically, when this error appears, the agent's actual response is sometimes not delivered, requiring the user to re-send their message to get a reply.

Environment

  • OpenClaw version: 2026.2.9 (33c75cb)
  • Channel: Telegram
  • Auth: Claude Max 20x (OAuth token)
  • Other APIs: Grok (xAI) for web search, Gemini for memory embeddings
  • Context at time of error: 100% (200k/200k)

Reproduction

  • Occurs intermittently during active conversation
  • No specific trigger identified — happens on normal text responses (no tool calls)
  • Not correlated with web_search, memory_search, or any specific tool
  • More frequent during long/heavy sessions near context limit

What we've ruled out

  • Anthropic weekly allowance — confirmed ~90% remaining
  • Grok/xAI credits — confirmed $23+ balance remaining
  • Gemini API — billed through Google Workspace, no limits hit

Key issues

  1. Error message is misleading — says "billing" but no billing limit is actually reached
  2. Swallows the agent's response — user sees error instead of the actual reply, has to re-ping
  3. Not logged anywhere — checked journalctl -u openclaw, session transcripts, and ~/.openclaw/logs/ — no trace of the error
  4. Intermittent — not every message, making it hard to diagnose

Expected behavior

  • If a transient API error occurs, retry before surfacing to user
  • If surfaced, don't swallow the actual response
  • Log the underlying error (HTTP status code, provider, endpoint) for diagnosis

Suspected cause

Possibly transient Anthropic rate limiting (per-minute, not weekly allowance) being caught and displayed as a billing error. May be related to high context usage (100%) triggering compaction-related API calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    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