A single-file Python script that pulls your Neon project metrics from the v2 Consumption History API and turns them into a readable usage & cost report — including a month-to-date summary and an end-of-month forecast.
Heads-up: This assumes the standard Neon Launch plan pricing (2026). Pricing constants are defined at the top of the script and can be adjusted if your plan differs. The forecast is a linear extrapolation — treat it as a rough guesstimate, not a guarantee.
- Month-to-date costs — compute, storage, instant restore, data transfer, extra branches
- Per-project cost breakdown — see per-project dollar costs for each metric, with transfer cost split proportionally (the 100 GB free tier is org-wide)
- Deleted project tracking — projects deleted mid-month still show their incurred costs (tagged
[deleted]); their cumulative costs are fixed in the forecast while point-in-time costs drop to zero - End-of-month forecast — linear projection based on current usage rate, with smart handling of deleted projects
- Detailed mode — split storage into root/child branches, transfer into public/private
- JSON output — pipe into
jq, dashboards, or monitoring scripts - Single file, no dependencies — only uses the Python standard library
- Python 3.8+
- A Neon account on a paid plan (Launch, Scale, Business, or Enterprise)
- A Neon API key (create one here)
git clone https://github.com/klumz33/Neon_usage.git
cd Neon_usage
chmod +x neon_usage.pyThat's it — no pip install, no virtual environment needed.
The script needs your Neon API key and (optionally) your Organization ID. There are three ways to provide them, listed by priority (highest first):
| Method | API Key | Org ID |
|---|---|---|
| CLI argument | — | --org-id org-... |
| Environment variable | NEON_API_KEY |
ORG_ID |
.env file (next to script) |
NEON_API_KEY=... |
ORG_ID=... |
export NEON_API_KEY="your-api-key"
export ORG_ID="org-your-org-id" # optionalCreate a .env file in the same directory as the script:
NEON_API_KEY=your-api-key
ORG_ID=org-your-org-id
The .env file is listed in .gitignore and will never override existing environment variables.
# Default report (month-to-date + forecast)
python3 neon_usage.py
# Detailed breakdown (root/child storage, public/private transfer)
python3 neon_usage.py --detail
# JSON output (for scripting / dashboards)
python3 neon_usage.py --json
# Hourly granularity
python3 neon_usage.py --granularity hourly
# Override org ID from CLI
python3 neon_usage.py --org-id org-example-12345678
# Only show active projects (exclude deleted)
python3 neon_usage.py --active-only
# Combine flags
python3 neon_usage.py --detail --granularity monthly --json--org-id ORG_ID Organization ID (default: $ORG_ID or .env)
--detail Show root/child storage & public/private transfer split
--active-only Exclude deleted projects from report and forecast
--granularity hourly | daily (default) | monthly
--json Output as JSON instead of a text report
Neon Usage Report - February 2026
Generated: 2026-02-11 14:23 UTC
Day 11 of 28 (39.3% of month)
================================================================
Fetching projects...
Found 6 active projects
Fetching consumption metrics (daily granularity)...
Processing 6 active + 4 deleted projects...
----------------------------------------------------------------
PER-PROJECT USAGE
----------------------------------------------------------------
infisical (plain-butter...)
Compute: 60.84 CU-hours cost: $6.45
Storage: 1.11 GB cost: $0.39
Instant Restore: 0.14 GB cost: $0.03
Transfer: 24.24 GB cost: $0.00
infisical total cost: $6.87
assetdb (royal-fire-7...)
Compute: 36.68 CU-hours cost: $3.89
Storage: 21.00 GB cost: $7.35
Instant Restore: 0.00 GB cost: $0.00
Transfer: 14.86 GB cost: $0.00
assetdb total cost: $11.24
...
CURRENT USAGE (Month-to-Date)
----------------------------------------------------------------
Compute:
Usage: 157.75 CU-hours
Cost: $16.72
Storage:
Total: 26.13 GB
Cost: $9.15
...
CURRENT TOTAL (Month-to-Date)
Subtotal: $26.37
Minimum: $5.00
TOTAL: $26.37
...
FORECAST TOTAL
Subtotal: $52.26
Minimum: $5.00
TOTAL: $52.26
By default the report includes projects that were deleted during the current billing month. These still incur charges for any usage before deletion.
- Deleted projects appear with a
[deleted]tag in the per-project section - Current costs include all incurred charges (active + deleted)
- Forecast handles deleted projects specially:
- Cumulative costs (compute, transfer) are locked at their current value — they won't grow
- Point-in-time costs (storage, instant restore, extra branches) drop to zero — the resources are gone
- Use
--active-onlyto exclude deleted projects entirely
- Fetches project names via
GET /projects - Pulls all consumption data in a single call to the v2 Consumption History API (
GET /consumption_history/v2/projects) - Tags projects present in consumption but absent from
/projectsas deleted - Aggregates metrics per-project and across the account
- Calculates costs using Launch plan pricing, with per-project cost attribution
- Projects a linear end-of-month forecast (with deleted-project adjustments)
Apache-2.0 — see LICENSE for details.