DEV Community

Andrii Vasin
Andrii Vasin

Posted on

How to make best of Claude Code's 5-Hour Limits

If you actively use Claude Code, you've probably already run into its rate limit system, regardless of your subscription tier. In general, the limits consist of 5-hour and weekly windows.

How the Limits Work

Claude Code applies limits using a sliding window approach. The catch is that the window starts ticking from the moment of your very first request.

For example, suppose you want to start work a bit later and do it all in one focused session without interruptions. If you burn through all your limits within the first hour, you'll have to wait another 4 hours for them to reset — not ideal.

The Solution: "Warming Up" the Limits

The logic is simple: if you send Claude a small message 3–4 hours before you plan to start working, the 5-hour limit window begins early and will reset right around the time you've been working for an hour or two.

In other words, if I want to be productive from 09:00, I need to "knock on Claude's doors" at 06:00 — automatically, while I'm still asleep.

Implementation: Vercel Cron + OAuth

I built a small open-source project — claude-code-warmup. Here's how it works:

  1. Vercel Cron Job runs on a schedule (e.g., every day at 04:00 UTC)
  2. The function grabs your OAuth token for Claude and sends it a short message.
  3. The 5-hour window starts ticking → resets after a few hours of your work.

About Tokens

Under the hood, Claude Code uses standard OAuth 2.0. To obtain a one-year OAuth token, run:

claude setup-token
Enter fullscreen mode Exit fullscreen mode

The value starts with sk-ant-oat01-... — that's your token for configuration.

How to Deploy in 2 Minutes

1. One-Click Deploy

The simplest option — one click:

Deploy

Then specify a Private Repository Name — what this repo will be called in your Git account.

2. Configure the Schedule

In vercel.json, change the schedule to match your needs — how many hours before work you want the "warmup". The format is standard cron (UTC). Note that on the Vercel Hobby plan you can only specify the hour (not minutes), and if you set it to 6, the function will be invoked randomly between 6:00 and 7:00 — not exactly at 6:

{
  "crons": [
    {
      "path": "/api/warmup",
      "schedule": "0 6 * * *"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

For building cron expressions, crontab.guru is very handy.

3. Add Environment Variables

  • CLAUDE_CODE_OAUTH_TOKEN — your OAuth token from the claude setup-token command
  • CRON_SECRET — any random password (16+ characters recommended) to keep your cron function private
  • WARMUP_MESSAGE(optional) a custom warmup message

After adding the token and cron secret, don't forget to redeploy (any commit to the repo) so the variables take effect. After deployment, the cron job will run automatically on schedule (±59 min — a Hobby plan limitation).

Summary

The 5-hour Claude Code limit problem is real, and it looks especially strange compared to Codex, which only has weekly limits. But it can be elegantly worked around by adding a simple "alarm clock" for a lazy Claude. The whole setup takes 2 minutes, and after that Claude Code is ready for serious work every day.

Code here: github.com/tappress/claude-code-warmup

Top comments (0)