Claude Code gives you a 5-hour token budget in a rolling window, starting from the moment you send your first message of the day. If you trigger this early and burn through your tokens, you might be locked out for hours during your peak workflow.
A practical solution: use claude-warmup, a scheduled GitHub Action that automatically sends a throwaway “hi” to Claude Haiku before your day starts. This anchors your 5-hour window to your schedule, not whenever you first open Claude.
Why This Works
Claude Code’s budget window is floored to the clock hour of your first message. For example, a ping at 6:15 AM starts your window at 6:00 AM, so your 5-hour block runs 6 AM–11 AM. When you finish your budget, the next window starts at 11 AM sharp. The warmup ping costs negligible tokens—just a single “hi” to Claude Haiku.
Setup (6 Steps)
1. Fork the repo
gh repo fork vdsmon/claude-warmup --clone
cd claude-warmup
2. Generate an OAuth token
On a machine with Claude Code installed, run:
claude setup-token
This generates a sk-ant-oat01-... token. Copy and save it; it’s valid for about a year.
3. Store the token as a GitHub secret
gh secret set CLAUDE_OAUTH_TOKEN
Paste your token at the prompt. GitHub Actions will use it for authentication.
4. Set your cron schedule
Default is weekdays at 9:15 UTC. Adjust for your timezone/work schedule:
gh variable set WARMUP_CRON --body "15 13 * * 1-5"
Reference table:
| Your timezone | Warmup for 9 AM start | 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 |
5. Test the workflow
gh workflow run warmup.yml
Check the Actions tab in your fork to ensure it runs successfully.
6. Verify it’s working
Next morning, open Claude Code and run:
/usage
Confirm the session reset time matches your scheduled anchor hour. If you set the warmup for 8:45 AM, your window should show a reset at 8:00 AM.
Alternative: Run It Locally
Prefer not to use GitHub Actions? You can run the warmup command locally via cron or macOS launchd:
claude -p "hi" --model haiku --no-session-persistence
Add this to your local crontab (crontab -e) with the same timing logic. The key is to send the message before your day starts; it doesn't matter if it's from GitHub or your own machine.
Tips to Make Your Budget Last Longer
- Extended Thinking burns tokens fast. Use it only when necessary (e.g., for architecture or debugging). For quick lookups or code gen, turn it off.
-
Keep context lean. The more files/terminal output in context, the more tokens per message. Close unused files and use
--no-session-persistencefor one-offs. - Batch your requests. Combine small questions into one clear prompt to save tokens and get better answers.
-
Use Haiku for simple tasks. For renaming, boilerplate, or formatting, specify
--model haikuand save heavier models for complex reasoning.
If You’re Building APIs Alongside Claude Code
If you develop or test APIs while using Claude Code, Apidog is a solid companion. It lets you design API schemas, generate mock servers, and run automated tests—all in one platform, supporting REST, GraphQL, and gRPC. When Claude writes an endpoint, you can test it directly in Apidog without switching tools.
It’s free to get started and handles REST, GraphQL, and gRPC out of the box.
What to Keep in Mind
- The window is fixed once set. Your 5-hour block starts at the first message; it doesn't shift mid-day.
- Budget is shared. claude.ai, Claude Code, and Claude Desktop all use the same pool. Extended Thinking and tool calls use more tokens than plain chat.
- There’s also a 7-day cap. This method controls the daily reset, not the weekly budget.
- Token resets to the clock hour. A warmup at 8:47 AM anchors to 8:00 AM. Schedule your cron about 15 minutes before the hour you want.
If your Claude Code sessions keep timing out mid-day, this fix takes under 10 minutes to implement and runs automatically. Full repo: github.com/vdsmon/claude-warmup
Top comments (0)