跪拜 Guibai
← All articles
Backend · Frontend · Java

AI Coding Quota: Two Ratios That Predict the Wall, and a Preheating Trick

By 码上实战 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Developers burning through AI coding credits mid-session lose context along with time. These rules turn an unpredictable wall into a schedule you can plan around, and the symlink trick preserves session history across accounts, so switching providers doesn't mean re-explaining everything.

Summary

AI coding quotas come in three metering styles: short windows that reset a few hours after the first message, weekly or monthly caps, and daily per-request buckets. Providers expose only a usage percentage and a reset time, so the method compares how much time has elapsed against how much quota is used. If usage extrapolates beyond 110%, a shutdown is coming; if a quarter of time remains and a quarter of quota sits unused, that quota will be wasted. Extrapolation uses recent speed, not the window average, because a burst of activity can exhaust a 5-hour window in under an hour.

When a hit is coming, the cheapest move is switching to a smaller model for lightweight tasks like commit messages, keeping the session and context intact. After a hit, the escalation order is wait, switch accounts, or switch agents, with waiting most cost-effective when reset is under an hour away. Preheating sends a minimal request earlier in the day to shift the reset to lunchtime, and sharing session history across multiple subscriptions works by symlinking the history directory while keeping credentials separate, with the caveat that settings.json must be copied rather than symlinked. These tactics are packaged in the open-source workbench Antumi.

Takeaways
— Three quota metering schemes: short windows (reset from first message), long periods (weekly/monthly), and per-request daily buckets.
— Providers expose only usage percentage and reset time; no token counts or costs.
— To predict exhaustion, compare elapsed window time to used quota; extrapolate using recent speed, not the window average.
— Thresholds: over 110% projected usage means too fast; under 25% usage with a quarter of time left means wasting quota.
— When heading over, switch to a smaller model first; switching agents is most expensive because it loses context.
— After hitting the wall, wait if reset is under an hour away; switch accounts only if they share session history; switch agents only for simple tasks.
— Preheating sends a minimal request early to shift the window reset to a convenient time; it works only for short windows.
— For multi-account setups, symlink the session history directory but keep credentials separate; settings.json cannot be symlinked because the CLI overwrites it.
— On macOS, Claude Code 2.1 names credentials by the literal config directory path, so the path must match exactly.
Conclusions

The method of predicting quota exhaustion with explicit thresholds is more reliable than asking the model itself, which costs quota and gives inconsistent answers.

The distinction between a rolling window and a sliding window clarifies a common misconception; the start is fixed at the first message, giving the user control over when the window begins.

Preheating exploits the service's own semantics by scheduling a minimal request, turning a fixed constraint into a flexible resource.

The symlink workaround shows that CLI tools are not designed for multi-account management, so users have to patch around assumptions about single-tenant config directories.

Concepts & terms
Rolling window (quota)
A quota window that starts counting from your first message and resets after a fixed duration, regardless of activity. Unlike a sliding window in rate limiting, its start is fixed at the first request.
Preheating (quota)
Sending a minimal request early in the day to shift the start of a short quota window so that its reset falls at a convenient time, such as lunch.
Per-model limit
A quota cap on a specific model's usage, separate from overall account quota, which can run out before the account-level limit.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗