anthropics / anthropics/claude-code-action

Continuously getting rate limited when using Claude Code Action in Github (PR Review)

Open
#137 1 comment 1 reaction 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

Whenever I run this action through Github I get continuously rate limited, this seems to be happening only for larger PRs (>1000 LOCs)

Here is the latest error from the Github Action Logs

```
{
"type": "result",
"subtype": "success",
"cost_usd": 0.2461181,
"is_error": true,
"duration_ms": 76225,
"duration_api_ms": 23934,
"num_turns": 7,
"result": "API Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed the rate limit for your organization (xxxxx) of 80,000 input tokens per minute. For details, refer to: https://docs.anthropic.com/en/api/rate-limits. You can see the response headers for current usage. Please reduce the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase.\"}}",
"total_cost": 0.2461181,
"session_id": "xxx"
}
```

Here is the Github action YAML configuration (nothing special, more or less the one that comes by default)
```
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "15"
model: "claude-3-5-sonnet-20241022"
```

I'm looking through the Github Readme and Anthropic Github Action docs but I don't happen to see a way to overcome this.

Any thoughts or ideas on how to improve this situation? Other models like Amazon Q do not seem to have a problem with this (not sure what they do differently though).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.