anthropics / anthropics/claude-code-action

anthropic_api_key insufficient - misleading 'Credit balance is too low' error when Claude Code subscription required

Open
#1,053 6 comments 2 reactions 0 assignees View on GitHub
bug documentation p2
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

## Summary

Setting up `claude-code-action@v1` with a valid `anthropic_api_key` (fresh key, $30 USD balance on platform.claude.com) consistently fails with:

```
Claude Code returned an error result: Credit balance is too low
```

The error is misleading — the real issue is that the action requires a Claude Code subscription or OAuth token, not just API credits.

## Steps to reproduce

1. Create an API key on platform.claude.com with credits
2. Add as `ANTHROPIC_API_KEY` GitHub secret
3. Configure workflow with only `anthropic_api_key` input (as documented)
4. Trigger PR review

## Expected behaviour

Either works correctly, or fails with a clear error explaining that a Claude Code subscription/OAuth token is required.

## Actual behaviour

Fails instantly (`duration_ms: 180`, `total_cost_usd: 0`) with `Credit balance is too low` — no indication that the credential type is wrong.

## Root cause (inferred)

The action uses `@anthropic-ai/claude-agent-sdk` which internally runs the `claude` CLI. That CLI checks for a Claude Code subscription, not just API access. A raw `anthropic_api_key` from platform.claude.com is not sufficient without a linked Claude Code subscription.

## Additional pain points

1. **README implies `anthropic_api_key` is sufficient** — it is not, at least not without a Claude Code subscription
2. **console.anthropic.com redirects to platform.claude.com** with no indication this is a separate billing system from claude.ai subscriptions — developers with a Max plan have no reason to know a second account with separate credits is needed
3. **`claude_code_oauth_token` is not clearly documented** as the likely correct credential for most users
4. **The billing separation between claude.ai and platform.claude.com is not mentioned anywhere in the action docs**

## Environment

- `anthropics/claude-code-action@v1`
- GitHub Actions, ubuntu-latest
- Auth method: `anthropic_api_key` only
- No `claude_code_oauth_token` provided

Contributor guide

Open the contributing guide

Research direction

Start with the README credential documentation and the workflow configuration for anthropic_api_key and claude_code_oauth_token. Reproduce the documented setup, then trace the @anthropic-ai/claude-agent-sdk and Claude CLI authentication error path. Done means the supported credential requirements and billing distinction are documented clearly, or the failure explains the required subscription or OAuth token.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
authentication, ci-cd, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.