# Gpt Weekly Limit Estimation

> Estimate OpenAI weekly usage limits from ground-truth token cost + reproducible pricing snapshots (billing week resets 14:47 local).

- Skill: `tankygranny05/gpt-weekly-limit-estimation-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add tankygranny05/gpt-weekly-limit-estimation-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tankygranny05/gpt-weekly-limit-estimation-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tankygranny05 (https://skillmd.com/u/tankygranny05)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/tankygranny05/gpt-weekly-limit-estimation-2

---


<!-- [Created by Claude: ed59febd-48d1-4c71-be9a-2b86d353cd44] -->

# GPT Weekly Limit Estimation
*[Edited by Codex: 019bebf3-c7d3-75c1-b096-339970e5cbc0 2026-01-23]*

Estimate weekly limit as:

`weekly_limit_usd = cost_so_far_usd / percent_used`

This skill intentionally does **not** re-implement token counting. It depends on two base skills:

- `compute-token-cost` (ground truth token+cost computation)
- `pull-pricing` (live pricing snapshots + append-only historical JSONL)

## Quick Start

```bash
# 0) Pull live pricing snapshot (writes snapshot JSON + appends pulled_data.jsonl)
python ~/.claude/skills/pull-pricing/run_pull_pricing_and_log.py

# 1) Extract one billing-week window (OpenAI resets weekly at 14:47 local time)
python /Users/sotola/swe/token-computation/extract_codex_week.py \
  --src ~/centralized-logs/codex/sse_lines.jsonl \
  --dst /tmp/billing_week.jsonl \
  --start "2026-01-15 14:47" \
  --end "2026-01-22 14:47" \
  --assume-sorted-by-t

# 2) Compute cost using a specific pricing snapshot (pick the newest snapshot file)
cd /Users/sotola/swe/token-computation && \
  python compute_token_costs.py \
    --codex /tmp/billing_week.jsonl \
    --claude ~/centralized-logs/claude/sse_lines.jsonl \
    --pricing-snapshot ~/centralized-logs/pull-pricing/snapshots/<pick-newest>.json
```

## Critical Knowledge

### Billing week boundary

OpenAI’s weekly reset is **Thursday 14:47 local time** (confirm on the dashboard if unsure).

- Treat the reset timestamp as the **exclusive end** of the window.
- Extract `[start, end)` where `start = end - 7 days`.

### Why CodexMonitor can be wrong

CodexMonitor-style “delta of `total_token_usage`” can overcount when totals reset or multiple runs mix.

Ground truth is:
- Codex/OpenAI: sum `turn.token_count.info.last_token_usage` and dedupe repeated snapshots per `sid`.
- Pricing: use a saved snapshot (don’t hardcode discounts).

## Weekly limit estimation

If OpenAI dashboard shows you’ve used X% of your weekly limit:

```python
cost_so_far = 147.20   # from compute_token_costs.py output
percent_used = 0.28    # from dashboard
weekly_limit = cost_so_far / percent_used
print(weekly_limit)    # 525.714...
```

## File locations

- Ground truth scripts:
  - `/Users/sotola/swe/token-computation/compute_token_costs.py`
  - `/Users/sotola/swe/token-computation/extract_codex_week.py`
  - `/Users/sotola/swe/token-computation/pull_pricing.py`
- Live logs:
  - `~/centralized-logs/codex/sse_lines.jsonl`
  - `~/centralized-logs/claude/sse_lines.jsonl`
- Pricing history:
  - `~/centralized-logs/pull-pricing/pulled_data.jsonl`
  - `~/centralized-logs/pull-pricing/snapshots/`

