Type to search by title, content, or category

Esc to close, Enter for all results

/ Coder

How Much Weekly Quota Does a 5-Hour Window Consume? Calculating Claude, Codex, and Antigravity with CodexBar History

Calculating the exact ratio of a 5-hour quota window relative to weekly limits across Claude Pro, Codex, and Antigravity using local CodexBar usage history and Python.

1. Background and BLUF (Bottom Line Up Front)

I subscribe to Claude Pro, ChatGPT Plus (using Codex), and Google AI Pro (using Antigravity). All three enforce a two-tier quota model: a rolling 5-hour session window and an overall weekly allotment. I wanted to understand two questions: How much of the weekly quota does a full 5-hour window consume? And what daily pacing ensures you don't waste unused quota before the weekly reset?

CodexBar logs percentage snapshots locally. I wrote a Python script to parse these logs and extract consumption deltas within matching windows:

Account / PoolOne 5h Window ≈ Weekly QuotaWindows per WeekConfidence
Claude Pro12.5%–13%7.5–8High
Codex (ChatGPT Plus)~16%~6.4High
Antigravity Regular Gemini (Google AI Pro)~28.6%~3.5Moderate

Running this analysis revealed that October 22 was my Claude weekly reset day. At 11:54 AM, I had only used 46% of my weekly quota. Even by maxing out every remaining 5-hour window until the 10:00 PM reset, the total would cap out at ~73%. Because usage was too light earlier in the week, no amount of late sprint could recover the lost quota.

TL;DR: Don't count individual session resets—monitor your daily weekly quota growth. For a 7-day work week, Claude requires burning slightly more than one full 5-hour window every day, Codex needs about 90% of a full window daily, and Antigravity only needs half a window per day.

Note: These benchmarks reflect real usage on my personal accounts in October 2026. Providers do not publish static conversion factors.

2. Core Mental Model: Why You Cannot Simply Divide Current Percentages

The intuitive approach is dividing the two current numbers shown in CodexBar: e.g., Claude 5h at 85% and weekly at 46%. This produces a meaningless ratio because 46% includes all cumulative sessions earlier in the week.

Valid ratios require computing matching deltas. Within the same 5-hour window, any activity draws down both quotas simultaneously. Therefore: (Weekly Quota Delta) ÷ (5-Hour Quota Delta) = Equivalent Weekly Quota for a Full 5-Hour Window. Between 12:58 and 13:58 on October 19, my Claude 5h usage jumped from 48% to 80% (+32), while weekly usage moved from 8% to 12% (+4): 4 ÷ 32 = 12.5%. A subsequent window the next evening recorded +48 and +6, again exactly 12.5%.

Two critical constraints to keep in mind:

  • A "5-hour window" represents a quota bucket, not 5 hours of continuous typing. Under agentic loads, a bucket can be depleted rapidly.
  • Changing clients does not provide separate quota. Anthropic documentation clarifies that claude.ai, Claude Code, and Claude Desktop share a single quota pool; OpenAI notes ChatGPT Work and Codex share usage, and Codex Pro currently has no 5-hour limit. Quota draw rate also varies with model selection, reasoning effort, context length, and tool calls.

3. Reproduction Steps

Step 1: Locate CodexBar Local History Files

codexbar --help | head -1
ls ~/Library/Application\ Support/com.steipete.codexbar/history/

On CodexBar 0.79.0, the history directory contains antigravity.json, claude.json, and codex.json. You can query live usage via the CLI:

codexbar usage --provider claude --format json --pretty

Step 2: Understand the JSON Schema

Files are organized by account key. Each account contains two series: session (windowMinutes: 300) and weekly (windowMinutes: 10080). Entries record three fields:

{"capturedAt": "2026-10-19T04:58:37Z", "resetsAt": "2026-10-19T08:30:00Z", "usedPercent": 48}

Timestamps are stored in UTC, sampled roughly once per hour. They represent percentage snapshots rather than individual transaction billings. A file may contain multiple accounts; preferredAccountKey marks the active one.

Step 3: Filter Paired Windows and Calculate Ratios

Save the following script as quota_ratio.py:

#!/usr/bin/env python3
"""用 CodexBar 本地历史估算:一整轮 5 小时额度约等于多少周额度。

用法:python3 quota_ratio.py <claude|codex|antigravity> [起始时间] [5 小时增量下限]
"""
import json
import sys
from datetime import datetime
from pathlib import Path

provider = sys.argv[1]
since = sys.argv[2] if len(sys.argv) > 2 else "1970-01-01"   # 只用这个时间之后的采样(UTC)
min_delta = float(sys.argv[3]) if len(sys.argv) > 3 else 15  # 整数百分比的产品建议 15

path = Path.home() / "Library/Application Support/com.steipete.codexbar/history" / f"{provider}.json"
data = json.loads(path.read_text())
series = data["accounts"][data["preferredAccountKey"]]       # 只取当前账户


def entries(name, minutes):
    return {e["capturedAt"]: e for s in series
            if s["name"] == name and s["windowMinutes"] == minutes for e in s["entries"]}


def ts(t):
    return datetime.fromisoformat(t.replace("Z", "+00:00"))


def close(a, b):                                             # resetsAt 会有 ±1 分钟抖动
    return abs((ts(a) - ts(b)).total_seconds()) <= 60


session, weekly = entries("session", 300), entries("weekly", 10080)
samples = [(t, session[t], weekly[t]) for t in sorted(session.keys() & weekly.keys()) if t >= since]


def same_window(a, b):
    (_, sa, wa), (tb, sb, wb) = a, b
    if not all(e.get("resetsAt") for e in (sa, sb, wa, wb)):  # 空闲条目可能没有 resetsAt
        return False
    return (close(sa["resetsAt"], sb["resetsAt"]) and close(wa["resetsAt"], wb["resetsAt"])
            and ts(sb["resetsAt"]) > ts(tb)                   # 后一条还没过 5 小时重置点
            and sb["usedPercent"] >= sa["usedPercent"]
            and wb["usedPercent"] >= wa["usedPercent"])


groups = []
for s in samples:
    if groups and same_window(groups[-1][-1], s):
        groups[-1].append(s)
    else:
        groups.append([s])

total_s = total_w = 0
for g in groups:
    (ta, sa, wa), (tb, sb, wb) = g[0], g[-1]
    ds = sb["usedPercent"] - sa["usedPercent"]
    dw = wb["usedPercent"] - wa["usedPercent"]
    if ds < min_delta or dw <= 0:
        continue
    total_s += ds
    total_w += dw
    print(f"{ta} → {tb}  5h +{ds:g}  周 +{dw:g}  比例 {dw / ds:.1%}")

if total_s:
    r = total_w / total_s
    print(f"合计:5h +{total_s:g},周 +{total_w:g} → 一整轮 5h ≈ 周额度的 {r:.1%},一周约 {1 / r:.1f} 轮")
else:
    print("没有符合条件的样本:放宽起始时间,或调低 5 小时增量下限")

Execution:

python3 quota_ratio.py claude 2026-10-15

Observed output from October 22:

2026-10-19T03:59:15Z → 2026-10-19T07:59:31Z  5h +56  周 +8  比例 14.3%
2026-10-19T14:57:59Z → 2026-10-19T18:55:03Z  5h +19  周 +2  比例 10.5%
2026-10-20T10:56:43Z → 2026-10-20T14:57:51Z  5h +91  周 +11  比例 12.1%
2026-10-22T02:59:05Z → 2026-10-22T06:56:11Z  5h +64  周 +9  比例 14.1%
2026-10-22T07:56:59Z → 2026-10-22T11:52:47Z  5h +44  周 +6  比例 13.6%
合计:5h +274,周 +36 → 一整轮 5h ≈ 周额度的 13.1%,一周约 7.6 轮

The script performs three tasks:

  1. Filters timestamps matching since for the active account and aligns session and weekly entries.
  2. Identifies continuous windows where resetsAt aligns within 60 seconds and neither metric decreases.
  3. Calculates delta per window using first and last records, filters out trivial increments, and sums totals before dividing.

Individual window ratios fluctuate between 10.5% and 14.3% due to integer truncation. The aggregated 13.1% lines up closely with the manual 12.5% samples, making 12.5%–13% a reliable budgeting baseline.

For other providers:

python3 quota_ratio.py codex 2026-10-20T07:23:40Z   # 从本周周窗口开始的时间算起(UTC)
python3 quota_ratio.py antigravity 2026-10-14 2     # 百分比是小数,但会回落,下限设成 2

Codex yields 15.6% (~15.7% in interactive runs). Antigravity yields 28.9% (~28.57% across 2/7 integer fractions).

Step 4: Translating Ratios into Daily Pacing Targets

Formulas:

  • Windows per week ≈ 1 / r
  • Target usage per day across D active days = 1 / (D × r) full windows
Account (r)7 Active Days / Week5 Active Days / Week
Claude (12.5%)1 full window daily + 1 extra window on 1 day2 windows daily at ~80% each
Codex (16%)~90% of a full window daily~125% of a window daily (e.g., 80% morning, 45% evening)
Antigravity (28.6%)Half a window daily~70% of a window daily

Mid-week rebalancing formula: Remaining Weekly Quota ÷ Remaining Days ÷ r determines needed daily window throughput. Alternatively, compare elapsed weekly window percentage against consumed quota. The expectedUsedPercent field in codexbar usage --format json directly tracks this pace.

Step 5: Near-Reset Feasibility Check

Maximum Achievable Quota = Current Weekly % + (Remaining in Current Window % + Max Usable Future Windows × 100%) × r

On October 22: at 11:54 AM, Claude weekly usage was 46% with 22:00 reset; the 5-hour window was at 85% with 15:20 reset. Burning the remaining 15%, completing a full window after 15:20, and running a final window before 22:00 yields: 46% + (15 + 100 + 100) × 12.5% ≈ 73%. Over a quarter of weekly allocation was mathematically unreachable.

4. Troubleshooting and Edge Cases

SymptomRoot CauseFix
Hardcoded timestamps throw KeyError on repeat runsSnapshots within the same hour are overwritten by newer samplesFilter entries dynamically rather than hardcoding timestamps
Window resetsAt values misalignIdle entries use synthetic timestamps; resets jitter by ±1 minAllow 60-second tolerance; treat missing fields as window breaks
Antigravity primary is not 5 hoursField mapping differs: Antigravity primary tracks Gemini weekly, secondary tracks Claude/GPT 5hKey off windowMinutes and bucket id
Menu bar displays 80% while CLI shows 85%Menu bar UI uses cached stateTrust CLI values for calculations
Adjacent sample ratios swing wildly between 12.5% and 20%Integer percentage quantizationUse larger window deltas and aggregate before division
Antigravity usage drops backwardUnknown server-side reconciliation; quota pools are fragmentedOnly evaluate strictly increasing windows with large deltas
Estimating Claude vs Gemini cost multiplier in AntigravityClaude and GPT share a combined quota poolInsufficient discrete logging; requires controlled benchmark tasks
CLI dumps contain email or organization namesaccountEmail and accountOrganization fieldsSanitize JSON before sharing logs

5. Summary and Scope

If you use CodexBar and need predictable capacity planning across multiple AI subscriptions, this delta-based method provides an actionable schedule:

  • Conversion ratios reflect single-account, single-cycle observations. Upgrades (e.g. Claude Max) or shifts in reasoning effort require re-evaluating.
  • Codex weekly reset timestamps can adjust mid-cycle. Follow live CLI reset values.
  • Complimentary quota resets are treated separately (e.g. Codex Full resets or Claude limit resets).
  • Antigravity's ~28.6% ratio has wider variance due to pool telemetry fluctuations.