range-cost

range-cost is a command for coding agents from omrikais/cctally. It costs 0 tokens per session (1,002 once invoked), scanned A, original, Apache-2.0.

A command that calculates the US-dollar cost of Claude or Codex usage within any specified time range, using locally stored session data.

In plain words
What is it for?
Use it to inspect total or per-model costs, filter by project or provider, and receive human-readable or JSON output.
Why use it?
It answers spending questions for time periods that do not match a calendar day, week, or month. Claude totals are lower-bound estimates from transcripts, not exact billing totals.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/omrikais/cctally/range-cost
Clone the repo
git clone --depth 1 https://github.com/omrikais/cctally

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for range-cost

README.md
[![agentmods](https://agentmods.dev/badge/commands/omrikais/cctally/range-cost.svg)](https://agentmods.dev/commands/omrikais/cctally/range-cost)
Your own site
<a href="https://agentmods.dev/commands/omrikais/cctally/range-cost"><img src="https://agentmods.dev/badge/commands/omrikais/cctally/range-cost.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,002 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01002
Opus 5 $0.00000 $0.00501
Sonnet 5 $0.00000 $0.00200
Haiku 4.5 $0.00000 $0.00100

Measured 3d ago against content hash e671eb8ce6b1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

range-cost scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/commands/range-cost.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

range-cost

Compute USD cost for an arbitrary absolute time range from Claude, Codex, or both providers' local session data.

Claude cost coverage: Claude dollar and token totals are transcript-derived lower bounds, not exact /usage billing totals. Codex accounting is unaffected.

Synopsis

cctally range-cost
    -s START [-e END]
    [-m {auto,calculate,display}]
    [-p PROJECT] [-b]
    [--source {claude,codex,all}] [--speed {auto,standard,fast}]
    [--json] [--total-only]

Purpose

Ad-hoc cost question: "what did I spend between X and Y?". Useful for an absolute window that does not align to a calendar day, week, or month.

Options

Flag Description
-s, --start START Start timestamp (ISO 8601, with timezone offset). Required.
-e, --end END End timestamp (ISO 8601, default: now).
-m, --mode {auto,calculate,display} Claude cost calculation mode. Default auto; non-default values are rejected for direct Codex requests.
-p, --project PROJECT Filter to a source-native project.
-b, --breakdown Show per-model usage and cost breakdown.
--json Machine-readable JSON.
--total-only Print numeric USD total only — useful for shell math.
--source {claude,codex,all} Analytics provider; default claude. cctally claude range-cost and cctally codex range-cost are fixed-source forms and do not expose this flag.
--speed {auto,standard,fast} Codex pricing tier; default auto. Applies to Codex/all and a non-default value is rejected for Claude-only.

Examples

cctally range-cost -s "2026-04-10T10:00:00+03:00"
cctally range-cost \
    -s "2026-04-10T10:00:00Z" -e "2026-04-12T10:00:00Z" --breakdown
cctally range-cost -s "2026-04-10T10:00:00Z" --json
cctally range-cost -s "2026-04-10T10:00:00Z" --total-only
cctally codex range-cost -s "2026-07-14T00:00:00Z" -e "2026-07-15T00:00:00Z" --breakdown
cctally range-cost --source all -s "2026-07-14T00:00:00Z" -e "2026-07-15T00:00:00Z" --total-only

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 77 lines · 0 tokens per session scan A e671eb8ce6b1

Subscribe to this mod's changes

range-cost is a command published in the GitHub repository omrikais/cctally (5 stars, last pushed 4d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,002 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.