# cf-free-tier

Narrow **Cloudflare free-tier wall** tool (Workers + D1): which quota is closest to the free cap, roughly which day it hits under growth, and the monthly bill if you move to **Workers Paid ($5)** + **D1 Paid**. Not a full pricing suite. No hardcoded VPS quotes — optional `vpsUsd` is user-supplied.

## Official numbers (verified 2026-10-17)

Sources: [Workers pricing](https://developers.cloudflare.com/workers/platform/pricing/), [Workers limits](https://developers.cloudflare.com/workers/platform/limits/), [D1 pricing](https://developers.cloudflare.com/d1/platform/pricing/), [D1 limits](https://developers.cloudflare.com/d1/platform/limits/), [D1 free-tier enforcement changelog 2026-09-01](https://developers.cloudflare.com/changelog/post/2026-09-01-d1-free-tier-limit-enforcement/).

| Product | Free | Paid |
|---------|------|------|
| Workers requests | 100,000 / day (UTC reset; Error 1027 when exceeded) | $5/mo base; 10M req/mo included; then $0.30 / million |
| Workers CPU | 10 ms / invocation (hard cap) | 30M CPU-ms/mo included; then $0.02 / million CPU-ms |
| Workers subrequests | 50 / request | (same class of per-request limit; not a daily pool) |
| D1 rows read | 5,000,000 / day | 25B / mo included; then $0.001 / million |
| D1 rows written | 100,000 / day | 50M / mo included; then $1.00 / million |
| D1 storage | 5 GB / account; 500 MB / DB; 10 DBs | 5 GB included; then $0.75 / GB-mo |

**Enforcement:** since **2026-09-01**, D1 free accounts that exceed daily rows read/written get query failures until **00:00 UTC**.

**Upcoming:** Workers Logs moves to Cloudflare Observability pricing on **2026-12-01** — re-verify then. This tool does not model Logs cost.

## How “first to hit” works

Utilization = used / free limit for Workers requests, D1 reads, D1 writes, and D1 storage. Highest utilization wins.

- Daily quotas with **growthPct = 0**: either already over today, or OK indefinitely at that constant rate (they reset every UTC day).
- With **growthPct > 0**: days until `used × (1 + g)^n ≥ limit` (compound daily).
- Storage is cumulative; growthPct compounds storage used the same way.

Per-request Workers caps (10 ms CPU, 50 subrequests) are documented but **not ranked** in `firstToHit` — they are not daily pools.

## Unindexed D1 helper

Effective rows read / day ≈

- unindexed: `tableRows × queriesPerVisit × visitsPerDay`
- indexed point lookup (approx): `1 × queriesPerVisit × visitsPerDay`

D1 bills **rows scanned**. UI button copies the estimate into the `reads` field.

## Human UI

Open `/cf-free-tier/`. Defaults illustrate a near-wall D1 writes case (80k req, 4.0M reads, 95k writes, 1.2 GB).

## Agent / JSON

```
GET /cf-free-tier/?requests=80000&reads=4000000&writes=95000&storageGb=1.2&format=json
```

Also accepts `json=1`. Optional: `growthPct`, `cpuMs`, `daysPerMonth`, `vpsUsd`.

Sample (defaults): first wall ≈ **D1 rows written** at 95% utilization; paid total ≈ **$5.00**/mo (Workers base only; D1 usage still inside paid included amounts).

Machine contracts: `agents.json`, `llms.txt`.

## Catalog

Listed on Agent home (`AGENT_SLUGS`) and in `projects.json`. Excluded from `/human.html` with other Agent-only tools.

## Local preview

```bash
cd /workspace/dev.luling.xyz/public
python3 -m http.server 8765
# open http://127.0.0.1:8765/cf-free-tier/
# JSON:  http://127.0.0.1:8765/cf-free-tier/?requests=80000&reads=4000000&writes=95000&storageGb=1.2&format=json
```
