DEV Community

brian austin
brian austin

Posted on

Claude Code Routines burn through rate limits 4x faster — here's the fix

Claude Code Routines burn through rate limits 4x faster — here's the fix

Claude Code Routines just shipped and they're incredible. Write a routine once, run it on every PR, every deploy, every morning standup.

But there's a problem nobody's talking about: Routines consume 4x more tokens than single prompts.

Here's why, and what to do about it.

Why Routines Eat Your Rate Limits

A typical Claude Code Routine chains 4-6 steps:

# .claude/routines/review.md
- Read the diff
- Identify security issues  
- Check for performance regressions
- Suggest test coverage
- Write the PR summary
- Post to Slack
Enter fullscreen mode Exit fullscreen mode

Each step costs tokens. But here's the hidden cost: the entire conversation context grows with every step.

Step 1: 500 tokens

Step 2: 500 tokens + 500 context = 1,000 tokens

Step 3: 500 tokens + 1,000 context = 1,500 tokens

Step 4: 500 tokens + 1,500 context = 2,000 tokens

By step 6, you've burned 10,500 tokens for what felt like 6 simple prompts.

Run that routine 3x per day on a busy codebase and you'll hit the Claude Code rate limit before lunch.

The Problem Gets Worse at Scale

Routines are designed to be automated — run on every commit, every PR, every deploy. That's 10-50 runs per day for an active team.

At 50 runs/day × 10,500 tokens = 525,000 tokens/day.

The Claude Code Pro tier cap? You'll hit it by 10am.

Solution 1: Keep Routines Focused

The fix is to design lean routines that do one thing well:

# .claude/routines/security-only.md
You are reviewing ONLY for security issues.
Do not comment on style, performance, or tests.
Output: JSON array of security findings with line numbers.
Enter fullscreen mode Exit fullscreen mode

Single-purpose routines = shorter context chains = fewer tokens per run.

Solution 2: Use API-Direct Access

For heavy Routine users, the real fix is bypassing the Claude Code UI rate limits entirely and hitting the API directly.

I built a proxy that gives you API access at $10/month — no per-token charges, no rate limit anxiety:

curl https://simplylouie.com/api/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-latest",
    "messages": [{"role": "user", "content": "Review this diff for security issues: $(git diff HEAD~1)"}]
  }'
Enter fullscreen mode Exit fullscreen mode

You can call this from inside your Routine or replace the routine with a shell script that calls the API directly — no UI, no rate limits, no interruptions.

Solution 3: Batch Routine Runs

Instead of running routines on every commit, batch them:

# .github/workflows/claude-review.yml
on:
  pull_request:
    types: [ready_for_review]  # Only on PR open, not every push

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - name: Claude Code Review
        run: |
          curl https://simplylouie.com/api/chat \
            -H "Authorization: Bearer ${{ secrets.CLAUDE_API_KEY }}" \
            -d '{"messages": [{"role": "user", "content": "Review this PR: ${{ github.event.pull_request.body }}"}]}'
Enter fullscreen mode Exit fullscreen mode

This cuts token usage by 80% for active repos.

The Math on API-Direct vs Claude Code Pro

Claude Code Pro API-Direct ($10/mo)
Rate limits Hit by 10am None
Routine runs/day ~20 before cutoff Unlimited
GitHub Actions Rate limited Works fine
Cost $100+/month $10/month

If you're using Routines seriously, API-direct access pays for itself on day 1.

What I'm Actually Running

Here's my current setup for a 50k-line TypeScript codebase:

Morning routine (runs at 9am via cron):

#!/bin/bash
curl https://simplylouie.com/api/chat \
  -H "Authorization: Bearer $CLAUDE_KEY" \
  -d "{\"messages\": [{\"role\": \"user\", \"content\": \"Summarize all commits from yesterday and flag any that need follow-up: $(git log --since=yesterday --oneline)\"}]}"
Enter fullscreen mode Exit fullscreen mode

PR review (runs on ready_for_review):

#!/bin/bash  
DIFF=$(git diff main...HEAD | head -5000)  # Cap at 5k chars
curl https://simplylouie.com/api/chat \
  -H "Authorization: Bearer $CLAUDE_KEY" \
  -d "{\"messages\": [{\"role\": \"user\", \"content\": \"Security review only: $DIFF\"}]}"
Enter fullscreen mode Exit fullscreen mode

Start Here

If you're hitting rate limits with Claude Code Routines:

  1. First: audit your routine step count. Every step chains context.
  2. Second: batch your runs — don't trigger on every push
  3. Third: if you're running >20 routines/day, switch to API-direct

7-day free trial, no card required at checkout: simplylouie.com/developers

The routines feature is genuinely useful. Don't let rate limits make you abandon it — work around them.

Top comments (0)