eca icon indicating copy to clipboard operation
eca copied to clipboard

Anthropic API-key requests fail with "credit balance is too low"

Open stamdrovas opened this issue 1 month ago • 0 comments

Describe the bug

With an Anthropic API key (provider key, ANTHROPIC_API_KEY, or the Console login), every chat fails with Anthropic invalid_request_error: Your credit balance is too low to access the Anthropic API, though the key has credits. The cause is the system block chat! prepends for every auth type, "You are Claude Code, Anthropic's official CLI for Claude." (anthropic.clj#L546). The same key succeeds when that block is absent.

To Reproduce

curl -s https://api.anthropic.com/v1/messages -H "x-api-key: $KEY" \
  -H 'anthropic-version: 2023-06-01' -H 'content-type: application/json' \
  -d '{"model":"claude-sonnet-5-5","max_tokens":5,"messages":[{"role":"user","content":"hi"}]}'
# 200

curl -s https://api.anthropic.com/v1/messages -H "x-api-key: $KEY" \
  -H 'anthropic-version: 2023-06-01' -H 'content-type: application/json' \
  -d '{"model":"claude-sonnet-5-5","max_tokens":5,"messages":[{"role":"user","content":"hi"}],
       "system":[{"type":"text","text":"You are Claude Code, Anthropic'\''s official CLI for Claude."}]}'
# 400 "Your credit balance is too low to access the Anthropic API..."

In ECA: configure an anthropic provider with an API key and send any prompt.

Expected behavior

API-key requests omit the identity block; only OAuth (subscription) requests send it.

Doctor

ECA 0.166.0 (also current master 26176a3), macOS. Seen with claude-sonnet-5-5 and claude-haiku-5-5.

stamdrovas avatar Oct 25 '26 00:10 stamdrovas