caliper-ai 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- caliper_ai-0.4.0/.gitignore +17 -0
- caliper_ai-0.4.0/CHANGELOG.md +195 -0
- caliper_ai-0.4.0/LICENSE +21 -0
- caliper_ai-0.4.0/PKG-INFO +478 -0
- caliper_ai-0.4.0/README.md +445 -0
- caliper_ai-0.4.0/pyproject.toml +109 -0
- caliper_ai-0.4.0/schemas/rates.schema.json +73 -0
- caliper_ai-0.4.0/schemas/tier-overrides.schema.json +69 -0
- caliper_ai-0.4.0/src/caliper/__init__.py +15 -0
- caliper_ai-0.4.0/src/caliper/__main__.py +4 -0
- caliper_ai-0.4.0/src/caliper/aggregation.py +127 -0
- caliper_ai-0.4.0/src/caliper/budgets.py +198 -0
- caliper_ai-0.4.0/src/caliper/cli.py +1820 -0
- caliper_ai-0.4.0/src/caliper/config.py +213 -0
- caliper_ai-0.4.0/src/caliper/exporters.py +340 -0
- caliper_ai-0.4.0/src/caliper/forecasts.py +92 -0
- caliper_ai-0.4.0/src/caliper/health.py +189 -0
- caliper_ai-0.4.0/src/caliper/humanize.py +40 -0
- caliper_ai-0.4.0/src/caliper/insights.py +143 -0
- caliper_ai-0.4.0/src/caliper/intervals.py +157 -0
- caliper_ai-0.4.0/src/caliper/live.py +330 -0
- caliper_ai-0.4.0/src/caliper/models.py +499 -0
- caliper_ai-0.4.0/src/caliper/output.py +47 -0
- caliper_ai-0.4.0/src/caliper/parse_cache.py +215 -0
- caliper_ai-0.4.0/src/caliper/parser.py +692 -0
- caliper_ai-0.4.0/src/caliper/pricing.py +337 -0
- caliper_ai-0.4.0/src/caliper/prom_export.py +116 -0
- caliper_ai-0.4.0/src/caliper/prom_snapshot.py +67 -0
- caliper_ai-0.4.0/src/caliper/py.typed +0 -0
- caliper_ai-0.4.0/src/caliper/rate_audit.py +337 -0
- caliper_ai-0.4.0/src/caliper/render.py +711 -0
- caliper_ai-0.4.0/src/caliper/scenarios.py +273 -0
- caliper_ai-0.4.0/src/caliper/statusline.py +241 -0
- caliper_ai-0.4.0/src/caliper/subscriptions.py +120 -0
- caliper_ai-0.4.0/src/caliper/timeutil.py +75 -0
- caliper_ai-0.4.0/src/caliper/windows.py +178 -0
- caliper_ai-0.4.0/src/codex_meter/__init__.py +65 -0
- caliper_ai-0.4.0/src/codex_meter/__main__.py +4 -0
- caliper_ai-0.4.0/src/codex_meter/py.typed +1 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Caliper follows **[Semantic Versioning](https://semver.org/)** with a
|
|
4
|
+
deliberately conservative pre-1.0 cadence:
|
|
5
|
+
|
|
6
|
+
- `0.x.y` — public API may still move between minor versions while the
|
|
7
|
+
cross-vendor surface stabilizes. Every release documents breakage in this
|
|
8
|
+
changelog and provides a one-step upgrade path.
|
|
9
|
+
- `1.0.0` — reserved for the release where the CLI surface, the
|
|
10
|
+
vendor-neutral record format, and the multi-vendor parser set are all
|
|
11
|
+
considered frozen. Caliper will not reach `1.0` until at least three
|
|
12
|
+
vendor parsers (Codex, Claude Code, Cursor) ship together.
|
|
13
|
+
|
|
14
|
+
## 0.4.0 - 2026-05-13
|
|
15
|
+
|
|
16
|
+
### Caliper — rebrand and vendor-neutral foundation
|
|
17
|
+
|
|
18
|
+
This release rebrands the project from `codex-meter` to **Caliper**, lays
|
|
19
|
+
down the vendor-neutral record that the next milestones build on, and ships
|
|
20
|
+
under a new PyPI distribution name. Existing users see a stable upgrade:
|
|
21
|
+
every command, option, output field, and exit code is preserved.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- New CLI entry point: `caliper`. The original `codex-meter` command is
|
|
25
|
+
retained as a permanent alias and dispatches to the same Typer app.
|
|
26
|
+
- Compatibility Python package: legacy `codex_meter.*` imports lazily alias
|
|
27
|
+
to the canonical `caliper.*` modules, including private helper imports used
|
|
28
|
+
by older downstream tests.
|
|
29
|
+
- Vendor-neutral record: `UsageEvent` and `RateLimitSample` now carry a
|
|
30
|
+
`vendor` field. Today's parser populates `openai-codex`; planned parsers
|
|
31
|
+
(`claude-code`, `cursor`, `aider`, `copilot`) will populate the same shape
|
|
32
|
+
so reports, pricing, budgets, forecasts, and exports work cross-vendor
|
|
33
|
+
without restructuring.
|
|
34
|
+
- Vendor constants exposed via `caliper.models`: `VENDOR_OPENAI_CODEX`,
|
|
35
|
+
`VENDOR_CLAUDE_CODE`, `VENDOR_CURSOR`, `VENDOR_AIDER`, `VENDOR_COPILOT`,
|
|
36
|
+
`VENDOR_UNKNOWN`, plus the `KNOWN_VENDORS` frozenset.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- Distribution name: `codex-meter` → `caliper-ai` on PyPI. Install with
|
|
40
|
+
`pip install caliper-ai`, `pipx install caliper-ai`, or
|
|
41
|
+
`uvx --from caliper-ai caliper`. Python import path is `caliper`.
|
|
42
|
+
- Internal package: `src/codex_meter/` → `src/caliper/`. All public Python
|
|
43
|
+
imports now use `from caliper import ...`; `codex_meter` remains available
|
|
44
|
+
for compatibility.
|
|
45
|
+
- Local config file: `.codex-meter.toml` → `.caliper.toml`.
|
|
46
|
+
- User config directory: `~/.config/codex-meter/` → `~/.config/caliper/`.
|
|
47
|
+
- Parse-cache and rate-audit sidecar directories migrated from
|
|
48
|
+
`codex-meter` to `caliper` under XDG cache/data dirs.
|
|
49
|
+
- README rewritten for the Caliper product narrative; roadmap publishes the
|
|
50
|
+
cross-vendor and ROI sequence ahead of 1.0.
|
|
51
|
+
- Release CI smoke-tests both `caliper` and `codex-meter` entry points from
|
|
52
|
+
the built wheel; PyPI environment URL now points at `caliper-ai`.
|
|
53
|
+
|
|
54
|
+
### Upgrade notes
|
|
55
|
+
- Reinstall: `uv tool install caliper-ai` (or `pipx install caliper-ai`).
|
|
56
|
+
The `codex-meter` command still works after the upgrade.
|
|
57
|
+
- Existing `.codex-meter.toml` files: rename to `.caliper.toml` (same
|
|
58
|
+
schema). Existing parse caches under `~/.cache/codex-meter/` can be
|
|
59
|
+
deleted; Caliper rebuilds them on first run under `~/.cache/caliper/`.
|
|
60
|
+
- `--cov=src/codex_meter` becomes `--cov=src/caliper` for downstream
|
|
61
|
+
tooling.
|
|
62
|
+
|
|
63
|
+
## 0.3.0 - 2026-05-13
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
- `insights` command for cache-savings, service-tier confidence, spend concentration,
|
|
67
|
+
and usage acceleration hints.
|
|
68
|
+
- `tail` command for recent usage events/sessions.
|
|
69
|
+
- Sidecar parse cache with `--no-parse-cache` bypass for parser debugging.
|
|
70
|
+
- Live TUI hotkeys (`q`, `?`, `r`, `p`) and `--max-ticks` for headless tests.
|
|
71
|
+
- Forecast API-dollar projection and sparkline output.
|
|
72
|
+
- Default `overview` invocation now accepts data-source, tier, rate-card, cache,
|
|
73
|
+
format, output, compact, and width options.
|
|
74
|
+
- `rates refresh --allow-network` now writes a pricing-source audit snapshot
|
|
75
|
+
with embedded rates, observed rates, and discrepancies instead of an empty
|
|
76
|
+
placeholder.
|
|
77
|
+
- Release automation now builds checked wheel/sdist artifacts, publishes through
|
|
78
|
+
PyPI Trusted Publishing, and attaches release assets on GitHub.
|
|
79
|
+
- Dependabot configuration now covers `uv` dependencies and GitHub Actions.
|
|
80
|
+
- Reports now expose normalized Codex subscription-plan metadata while preserving
|
|
81
|
+
the raw plan strings seen in local logs.
|
|
82
|
+
- Added `statusline` for a compact prompt/hook-friendly usage snapshot.
|
|
83
|
+
|
|
84
|
+
### Changed
|
|
85
|
+
- Cost reporting now uses exact decimal arithmetic internally, exposes exact
|
|
86
|
+
decimal strings in JSON output, and marks partial or estimated pricing when
|
|
87
|
+
rates or service tiers are not source-verified.
|
|
88
|
+
- Rate-limit window math now prefers the main `codex` subscription bucket when
|
|
89
|
+
logs also include model-specific preview buckets.
|
|
90
|
+
- `rates refresh --allow-network` audits fast-mode multipliers and long-context
|
|
91
|
+
rules in addition to per-token rates.
|
|
92
|
+
- GPT-5.4 now carries the official `>272K` long-context rule.
|
|
93
|
+
- GPT-5.1-Codex-Max remains API-priced, but Codex credit totals are marked
|
|
94
|
+
partial unless a local `--rates-file` supplies credit rates.
|
|
95
|
+
- Table rendering now honors terminal/`--width` instead of collapsing to 80 columns.
|
|
96
|
+
- Grouped reports accept `--top` as an alias for `--top-threads`.
|
|
97
|
+
- Doctor, rates, forecast, compare, what-if, and budgets now support CSV/Markdown
|
|
98
|
+
alongside table/JSON.
|
|
99
|
+
- GPT-5.1-Codex-Max now has API-equivalent rates in the embedded card.
|
|
100
|
+
- Receipts include cache savings, tier-source breakdowns, warning counts, and top
|
|
101
|
+
insights, and redact full local labels by default. Use `--show-sensitive` for
|
|
102
|
+
private/local receipts with full session/project labels.
|
|
103
|
+
- `init` scaffolds the full config surface.
|
|
104
|
+
- Parse-cache entries are independent of the requested report window, so normal
|
|
105
|
+
rolling `now` invocations can reuse parsed sessions. Cache payloads now use
|
|
106
|
+
JSON instead of pickle.
|
|
107
|
+
- Source distributions are trimmed to release-relevant files.
|
|
108
|
+
- Install documentation now leads with public PyPI, `uvx`, `pipx`, and Homebrew
|
|
109
|
+
paths instead of source-checkout installation.
|
|
110
|
+
|
|
111
|
+
### Fixed
|
|
112
|
+
- Reasoning tokens are no longer double-counted when Codex logs already include
|
|
113
|
+
them in `output_tokens`.
|
|
114
|
+
- Literal `[budgets]` text no longer disappears in Rich output.
|
|
115
|
+
- Doctor clock-skew output uses directional wording instead of signed seconds.
|
|
116
|
+
- What-if no-op scenarios now say there is no change.
|
|
117
|
+
- Compare warns when one window is too sparse to be representative.
|
|
118
|
+
- GPT-5.3-Codex-Spark stays unpriced/research-preview instead of being
|
|
119
|
+
normalized to GPT-5.3-Codex.
|
|
120
|
+
- Rate-limit samples are retained for burn-rate math and only truncated at
|
|
121
|
+
render/report time.
|
|
122
|
+
- SQLite connections are closed explicitly, making warning-as-error test runs
|
|
123
|
+
clean on Python 3.13.
|
|
124
|
+
- Monthly receipts include events through the final sub-second before the next
|
|
125
|
+
month starts.
|
|
126
|
+
|
|
127
|
+
## 0.2.0
|
|
128
|
+
|
|
129
|
+
### Added
|
|
130
|
+
- **Live TUI** (`codex-meter live`): full-window dashboard with today's credits, 7-day
|
|
131
|
+
total, 5-hour primary + weekly secondary countdowns, burn rate, ETA to 100%.
|
|
132
|
+
Border turns red at >= 80% used. `--interval` to tune refresh, graceful SIGINT.
|
|
133
|
+
- **Window math** (`windows.py`): `WindowState` decoded from rate-limit samples;
|
|
134
|
+
Unix-epoch `resets_at` handled correctly; burn rate requires >= 3 samples in
|
|
135
|
+
a 6-hour lookback; ETA projection only when burn rate is positive.
|
|
136
|
+
- **Analytics suite**:
|
|
137
|
+
- `forecast`: month-end credit projection with linear + EWMA estimators
|
|
138
|
+
and a ±1σ band. Optional `--cap` reports days-to-depletion.
|
|
139
|
+
- `compare --a --b`: side-by-side credit, dollar, and token deltas
|
|
140
|
+
between two windows (`last 7 days`, `previous 7 days`, ISO ranges, etc.).
|
|
141
|
+
- `whatif --tier --model`: re-cost the trailing window under a hypothetical
|
|
142
|
+
tier or model swap; rejects unknown models with the rate-card list.
|
|
143
|
+
- **Budgets** (`budgets check`): TOML `[budgets]` table (flat keys,
|
|
144
|
+
nested-by-period, or `items = [...]` list). Severity ladder ok/warn/breach
|
|
145
|
+
drives the exit code so CI can gate on it.
|
|
146
|
+
- **Rate card subcommands**:
|
|
147
|
+
- `rates show` (table + JSON) with age + stale-after-90d flag.
|
|
148
|
+
- `rates refresh` stub reserved for the network-opt-in flow.
|
|
149
|
+
- **Exporters**:
|
|
150
|
+
- `export grafana`: dashboard JSON wired to codex-meter Prometheus metrics.
|
|
151
|
+
- `export receipt --month YYYY-MM --format markdown|html`: totals, models,
|
|
152
|
+
top sessions, top projects. HTML escapes user-supplied labels.
|
|
153
|
+
- `export prometheus --host --port`: stdlib `/metrics` endpoint serving
|
|
154
|
+
`codex_meter_credits_used`, `burn_per_hour`,
|
|
155
|
+
`window_used_percent{window}`, `tokens_total{model,tier,kind}`,
|
|
156
|
+
`events_total`, `long_context_events_total`. Binds 127.0.0.1 by default.
|
|
157
|
+
- `[prom]` optional extra installs `prometheus-client`.
|
|
158
|
+
- **`init`** subcommand: scaffolds `.codex-meter.toml` with commented defaults;
|
|
159
|
+
refuses overwrite without `--force`.
|
|
160
|
+
- **`doctor` v2**: Python version, session root + file count, state DB, Codex
|
|
161
|
+
config, `codex --version` (best-effort), rate-card age, clock skew vs latest
|
|
162
|
+
event, parser warnings. JSON output for CI. Exit code reflects worst check.
|
|
163
|
+
- **Intervals** (`intervals.py`): `today`, `yesterday`, `last N days`,
|
|
164
|
+
`previous N days`, `last N hours`, `this/last week`, `this/last month`,
|
|
165
|
+
ISO date, `YYYY-MM-DD..YYYY-MM-DD` range.
|
|
166
|
+
- **JSON Schemas**: `schemas/rates.schema.json`, `schemas/tier-overrides.schema.json`
|
|
167
|
+
(Draft 2020-12) for editor autocomplete + validation.
|
|
168
|
+
|
|
169
|
+
### Pricing accuracy
|
|
170
|
+
- `Rates` gains `reasoning_output` (defaults to `output` rate). Pricing now
|
|
171
|
+
accounts for reasoning tokens, which were previously invisible.
|
|
172
|
+
- `LongContextRule` lives on `ModelCard`; only `gpt-5.5` carries the
|
|
173
|
+
272K-token, ×2/×1.5 rule today. Other models do not get the multiplier.
|
|
174
|
+
|
|
175
|
+
### Refactor
|
|
176
|
+
- `cli.py` deduplicated: subcommands share `Annotated` Option type aliases.
|
|
177
|
+
- `ModelCard` replaces parallel rate dicts.
|
|
178
|
+
- `RateCard` loads any local override file exactly once per run.
|
|
179
|
+
- `Usage` frozen dataclass replaces ad-hoc `dict[str, int]` usage shapes
|
|
180
|
+
across events, aggregation, and pricing.
|
|
181
|
+
- `humanize.py` carved out for `format_int`, `redact`, `REDACTION_LIMIT`.
|
|
182
|
+
- `limits` command participates in the unified render pipeline and
|
|
183
|
+
supports `--format table|json|csv|markdown` with decoded reset times.
|
|
184
|
+
|
|
185
|
+
### Packaging
|
|
186
|
+
- `__version__` resolves through `importlib.metadata` with a local fallback.
|
|
187
|
+
- `py.typed` marker shipped (PEP 561).
|
|
188
|
+
- `pytest-cov` wired up; line+branch coverage at >= 82%.
|
|
189
|
+
|
|
190
|
+
## 0.1.0
|
|
191
|
+
|
|
192
|
+
- Initial open-source-ready CLI scaffold.
|
|
193
|
+
- Added Codex JSONL parsing, SQLite metadata joins, token aggregation, Codex
|
|
194
|
+
credit estimates, API-equivalent dollar estimates, service-tier inference,
|
|
195
|
+
and table/JSON/CSV/Markdown output.
|
caliper_ai-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rajdeep Mondal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|