Claude RotateRuns Claude Code on one of your accounts and moves you to the next account when Claude Code hits a usage limit. Works with Claude Code in a VS Code terminal, with the official Claude Code extension's chat panel, or both. First-time setup
The sidebar
Clicking the status bar item opens the sidebar. All commands are also in the Command Palette under "Claude Rotate". How switching worksTerminal (
|
| Method | How | Tradeoff |
|---|---|---|
processEnv |
Sets CLAUDE_CODE_OAUTH_TOKEN in the VS Code extension host's environment. Claude Code builds each new chat's environment from it. |
Nothing is written to disk. Every extension in the same extension host can read that environment variable, and processes they start inherit it. Gone when VS Code closes (re-applied on start). |
settings |
Writes { "name": "CLAUDE_CODE_OAUTH_TOKEN", "value": "<token>" } into claudeCode.environmentVariables in your user settings.json. Your other entries there are kept. |
The token is in plain text on disk in settings.json. It is added to settingsSync.ignoredSettings so it does not sync, and removed when you press Stop, remove the account, or set target back to terminal. |
auto (default) |
processEnv, unless Test panel token showed that it does not reach the panel; then settings. |
Test panel token (command "Claude Rotate: Test Panel Token Method (processEnv)") puts an obviously
invalid token into the extension host environment, opens a new Claude Code chat, and asks you to send
"hi". If that chat fails to authenticate, processEnv works.
When target is terminal, Claude Rotate does not change process.env or Claude Code's settings.
Priority order (claudeRotate.priorityMode, off by default)
Turn on Priority order in the sidebar settings. The account list is then a priority list: the top account is priority 1. Reorder with ··· → Move up / Move down.
- Start uses the highest-priority account that is ready.
- On a limit it moves to the highest-priority ready account (not just the next one in the list).
- Switching back: once a minute it looks for a higher-priority account whose limit has reset. With the usage check on, it first asks Anthropic to confirm the account really is usable. Then, depending on On usage limit: "Switch automatically" switches back, "Ask me" asks (Not now holds for 30 minutes), "Do nothing" never switches back.
- It only switches back while Claude is quiet: no terminal output and no panel transcript writes for 90 seconds. So a reply in progress is never cut off. Switching back restarts Claude like any switch (for a sidebar chat that means a window reload).
- If you pick an account yourself (Start on a specific account, or Switch away from an account that is not limited), switching back pauses until the next limit, or until you Stop and Start.
- Off: accounts rotate to the next one in the list, and nothing switches back.
Usage check (claudeRotate.usageCheckMinutes, default 10)
Every few minutes Claude Rotate asks Anthropic how much of each account's limits is used and shows it under the account in the sidebar (session = 5-hour window, weekly = 7-day window, with the time until each resets).
- How: a token from
claude setup-tokenmay not read the usage page that Claude Code's/usageuses (403, missinguser:profilescope). But every API response carries the account's limits inanthropic-ratelimit-unified-*headers. So the check sends a 1-token request per account to the cheapest model. That costs a tiny amount of usage, and on an idle account it starts its 5-hour window. - An account that is at a limit is marked cooling with the exact reset time, without you doing anything. If it is the account in use, this works like a detected limit (it asks or switches, per On usage limit).
- A cooling account whose check says it is usable again is marked ready.
- Switch no longer asks why you are switching when the check works: it marks the account only if it really is at a limit.
- The refresh button in the Accounts header (or Claude Rotate: Check Usage Now) checks all accounts now. Set the setting to 0 to turn the check off; then the manual "Mark limited" actions are what you have.
Testing without using real usage
Simulate Limit (··· menu in the sidebar's title bar, or "Claude Rotate: Simulate Limit (testing)") runs the same handling as a
real limit for the current session: it marks the account as cooling, switches (depending on autoSwitch),
and logs it. Use Clear cooldown afterwards.
Settings
claudeRotate.target: terminal (default) | panel | bothclaudeRotate.autoSwitch: ask (default) | auto | offclaudeRotate.cooldownHours: hours to skip an account after a session limit with no reset time (default 5)claudeRotate.weeklyCooldownHours: hours to skip after a weekly limit with no reset time (default 24)claudeRotate.claudeCommand: command to run in the terminal (defaultclaude)claudeRotate.panelTokenMethod: auto (default) | processEnv | settingsclaudeRotate.limitPattern: regex matched against new transcript lines (default"apiError"\s*:\s*"usage_limit_reached")
Known limitations
- Reopening a panel chat by session ID uses an undocumented argument of Claude Code's
claude-vscode.editor.opencommand (found in Claude Code 2.1.312). A Claude Code update can change it; then you get the "start a new chat and resume from history" notification instead. - Claude Rotate cannot type into the Claude Code panel. After a switch you send the next message yourself.
- The window reload for a sidebar chat (see above) also ends Claude Rotate's tracking of its terminal with
target
both: the terminal keeps running, but limits in it are no longer detected. Press Start again. - Finding a chat's tab by title needs the title line in the transcript to be written after VS Code started (Claude Code rewrites it often). Otherwise Claude Rotate asks.
- Panel chats that were already open before Start, or that Claude Code restores when VS Code starts, use whatever login they started with.
- If
ANTHROPIC_API_KEYis set in VS Code's environment, orclaudeCode.environmentVariablesalready has your ownCLAUDE_CODE_OAUTH_TOKEN, that overrides the account Claude Rotate gives the panel (you get a warning). - Transcript lines from the Claude desktop app (same folder) are ignored.
- Terminal detection reads the terminal text. If Anthropic changes the wording of the limit message,
detection can miss it; use Switch to next and update
LIMIT_REin extension.js. - Terminal detection needs VS Code terminal shell integration (on by default for PowerShell).
- Tokens from
claude setup-tokenlast about 1 year. You get a warning 30 days before. - If
apiKeyHelperis set in your Claude settings, it conflicts with the token. Remove it.