DEV Community

Preecha
Preecha

Posted on

How to Stop Running Out of Claude Code Limits Every Day

Claude Code gives you a 5-hour token budget on a rolling window. That window starts when you send your first message of the day. If you ask a quick question at 8:30 AM and burn through your budget by 11 AM, you may be waiting until 1 PM before you can work again.

Try Apidog today

A small utility called claude-warmup fixes this by sending one scheduled throwaway message to Claude Haiku before your workday starts. That message anchors your 5-hour window to a predictable time instead of whatever time you first open Claude.

Why This Works

Claude Code’s budget window is anchored to the clock hour of your first message.

For example:

  • First message: 6:15 AM
  • Window anchor: 6:00 AM
  • 5-hour block: 6:00 AM → 11:00 AM

If you exhaust your budget mid-morning, the next window starts at the next reset time instead of landing in the middle of your workday.

The warmup message is intentionally minimal:

hi
Enter fullscreen mode Exit fullscreen mode

Sent to Claude Haiku with no tools or context, it uses negligible tokens.

Setup: Schedule Claude Warmup with GitHub Actions

1. Fork and clone the repo

gh repo fork vdsmon/claude-warmup --clone
cd claude-warmup
Enter fullscreen mode Exit fullscreen mode

2. Generate a Claude OAuth token

On a machine where Claude Code is installed, run:

claude setup-token
Enter fullscreen mode Exit fullscreen mode

This outputs a token that looks like:

sk-ant-oat01-...
Enter fullscreen mode Exit fullscreen mode

Copy it. The token stays valid for about a year.

3. Store the token as a GitHub secret

In your forked repo, run:

gh secret set CLAUDE_OAUTH_TOKEN
Enter fullscreen mode Exit fullscreen mode

Paste the token when prompted.

GitHub Actions will use this secret to authenticate with Claude.

4. Configure the warmup schedule

The default schedule is weekdays at 9:15 UTC.

Set your own schedule with a GitHub Actions variable:

gh variable set WARMUP_CRON --body "15 13 * * 1-5"
Enter fullscreen mode Exit fullscreen mode

Cron syntax:

minute hour day-of-month month day-of-week
Enter fullscreen mode Exit fullscreen mode

Useful examples:

Timezone Warmup target Cron expression
UTC 8:45 AM UTC 45 8 * * 1-5
US Eastern, EST 8:45 AM = 13:45 UTC 45 13 * * 1-5
US Pacific, PST 8:45 AM = 16:45 UTC 45 16 * * 1-5
CET, Central Europe 8:45 AM = 7:45 UTC 45 7 * * 1-5

Tip: schedule the warmup shortly before the hour you want to anchor. A message at 8:45 AM anchors the window to 8:00 AM.

5. Test the workflow manually

Run:

gh workflow run warmup.yml
Enter fullscreen mode Exit fullscreen mode

Then open the Actions tab in your fork and confirm the workflow completes successfully.

6. Verify the reset time

The next morning, open Claude Code and run:

/usage
Enter fullscreen mode Exit fullscreen mode

Check the session reset time.

If your warmup runs at 8:45 AM, the window should be anchored to 8:00 AM.

Alternative: Run the Warmup Locally

You do not have to use GitHub Actions. You can run the warmup command from your own machine with cron, macOS launchd, or another scheduler.

The command is:

claude -p "hi" --model haiku --no-session-persistence
Enter fullscreen mode Exit fullscreen mode

For example, edit your crontab:

crontab -e
Enter fullscreen mode Exit fullscreen mode

Add a weekday warmup entry:

45 8 * * 1-5 claude -p "hi" --model haiku --no-session-persistence
Enter fullscreen mode Exit fullscreen mode

The important part is timing: the message must run before you start using Claude Code for the day.

Tips to Make Your Claude Code Budget Last Longer

Anchoring the reset window helps, but you still need to manage what consumes tokens.

Use Extended Thinking only when needed

Extended Thinking can burn tokens quickly because Claude reasons through complex tasks step by step.

Use it for:

  • Architecture decisions
  • Difficult debugging
  • Multi-step reasoning

Avoid it for:

  • Simple lookups
  • Boilerplate generation
  • Small refactors you can already describe clearly

Keep context small

Claude Code includes open files and recent terminal output in context.

To reduce token usage:

  • Close files you are not actively using
  • Avoid dumping large logs unless needed
  • Use --no-session-persistence for one-off commands

Example:

claude -p "Generate a basic Express middleware for request logging" \
  --model haiku \
  --no-session-persistence
Enter fullscreen mode Exit fullscreen mode

Batch related requests

Ten small prompts usually cost more than one complete prompt.

Instead of asking:

How do I add auth?
How do I validate input?
How do I test it?
Enter fullscreen mode Exit fullscreen mode

Ask:

I have an Express POST /users endpoint. Show me how to add JWT auth, validate the request body, and write a basic test for success and validation failure cases.
Enter fullscreen mode Exit fullscreen mode

You’ll usually get a better answer with fewer back-and-forth messages.

Use Haiku for lightweight tasks

For simple tasks, specify Haiku:

claude -p "Rename this variable consistently across the file" --model haiku
Enter fullscreen mode Exit fullscreen mode

Good Haiku use cases:

  • Variable renames
  • Config formatting
  • Boilerplate functions
  • Simple shell commands
  • Basic test scaffolding

Save heavier models for work that needs deeper reasoning.

If You’re Building APIs Alongside Claude Code

Many developers use Claude Code while building or testing APIs. If that is your workflow, Apidog fits naturally alongside it.

You can use Apidog to:

  • Design API schemas
  • Generate mock servers
  • Run automated API tests
  • Work with REST, GraphQL, and gRPC

When Claude Code writes an endpoint, you can test it immediately in Apidog instead of switching between Postman, Swagger, and separate mock tools.

It’s free to get started and supports REST, GraphQL, and gRPC out of the box.

What to Keep in Mind

  • The window is fixed once set. After the first message fires, the 5-hour block is locked in for that cycle.
  • Budget is shared. claude.ai, Claude Code, and Claude Desktop draw from the same pool.
  • Extended Thinking and tool calls use more budget. Plain chat is usually cheaper.
  • There is also a 7-day cap. This technique controls the daily reset window, not the weekly budget ceiling.
  • The reset floors to the clock hour. A warmup at 8:47 AM anchors to 8:00 AM, not 8:47 AM.

If your Claude Code sessions keep running dry at the wrong time, this setup takes under 10 minutes and then runs automatically every workday.

Repo: github.com/vdsmon/claude-warmup

Top comments (0)