repospend 0.1.7 → 0.1.8

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.
package/docs/llms.txt CHANGED
@@ -55,9 +55,10 @@ Positioning:
55
55
  - RepoSpend complements CLI tools such as ccusage.
56
56
  - ccusage is useful for terminal-first Claude Code totals and daily breakdowns.
57
57
  - RepoSpend is useful for visual repo-level analytics, session inspection, source/tool comparison, model mix, token shape, cache reuse, exports, and command/agent friction.
58
- - RepoSpend totals can intentionally differ from ccusage or Tokscale because it includes Claude Desktop/local-agent session roots when present, treats cache reads/writes as input sub-buckets, prices Claude cache writes by recorded 5-minute vs 1-hour TTL, and separates Codex visible output from reasoning output.
58
+ - RepoSpend totals can intentionally differ from ccusage or Tokscale because it includes Claude Desktop/local-agent session roots when present, treats cache reads/writes as input sub-buckets, prices cache writes by their recorded TTL (Claude 5-minute/1-hour, OpenAI 30-minute/12-hour), prices each Codex request at the model active for it, and separates Codex visible output from reasoning output.
59
59
 
60
60
  Cost language:
61
+ - October 27, 2026 pricing update: explicit GPT-6.1 Terra card ($1/$0.05/$5 input/cache-read/output per million tokens), OpenAI 30-minute and 12-hour cache-write rates, and per-request long-context tiers above 272K input tokens for GPT-6/6.1 and GPT-5.x Standard models (5.6 Sol/Terra/Luna, 5.5/5.4 plus Pro cards).
61
62
  - October 17, 2026 pricing update: Sonnet 5.5 cache reads are $0.10 per million tokens; Sonnet 5 remains at $0.20.
62
63
  - Haiku 5.5 has two per-request prompt-length tiers: input/cache read/output $0.10/$0.01/$0.50 up to 100K, and $0.50/$0.05/$2.50 above 100K. Cache writes have separate 5-minute and 1-hour rates. Unknown request lengths stay unpriced.
63
64
  - Gemini 4 Argon introductory input/cache read/output rates are $2/$0.10/$10 through November 30, 2026, then published rates become $4/$0.20/$20. Bundled tables are a dated snapshot, not an automatic future rate switch.
package/docs/pricing.md CHANGED
@@ -4,7 +4,7 @@ RepoSpend estimates API-equivalent cost from a local pricing table. The bundled
4
4
 
5
5
  The bundled table is seeded from public OpenAI, Anthropic, Google, and GitHub Copilot model references and is expressed as USD per 1M tokens. Pricing changes over time, so treat RepoSpend costs as API-equivalent estimates rather than invoice-grade accounting.
6
6
 
7
- The October 17, 2026 update checks Claude Haiku 5.5, Sonnet 5.5, and Gemini 4 Argon against provider documentation. The GPT-6.1 Sol card was checked on September 29; the other bundled defaults retain the September 28 snapshot. Defaults use published Standard API prices. Sonnet 5.5 cache reads fell from $0.20 to $0.10 per 1M tokens on October 7; its $2 input, $10 output, $2.50 5-minute writes, and $4 1-hour writes are unchanged. Sonnet 5 retains its $0.20 cache-read rate.
7
+ The October 27, 2026 update adds the GPT-6.1 Terra card and OpenAI's 30-minute and 12-hour cache-write rates, and checks Claude Haiku 5.5, Sonnet 5.5, Fable 5.1, Mythos 5.1, and Gemini 4 Argon against provider documentation. The GPT-6.1 Sol card was checked on September 29; the other bundled defaults retain the September 28 snapshot. Defaults use published Standard API prices. Sonnet 5.5 cache reads fell from $0.20 to $0.10 per 1M tokens on October 7; its $2 input, $10 output, $2.50 5-minute writes, and $4 1-hour writes are unchanged. Sonnet 5 retains its $0.20 cache-read rate.
8
8
 
9
9
  ### Claude Haiku 5.5 and request-length pricing
10
10
 
@@ -25,19 +25,25 @@ These are current API-equivalent rates applied to the selected usage window, not
25
25
 
26
26
  `gemini-4-argon`, including Copilot-prefixed/suffixed aliases, uses $2 input, $0.10 cached input, and $10 output (including thinking) per 1M tokens through November 30, 2026. Google lists $4 input, $0.20 cached input, and $20 output from December 1. Argon has no explicit cache-write charge. Bundled rates are a verified snapshot: the application does not silently switch prices based on the machine clock. Refresh the table at the promotion boundary or save intentional overrides. Source: [Google's model and pricing guide](https://ai.google.dev/gemini-api/docs/latest-model?hl=en).
27
27
 
28
- GPT-6 Astra, Sol, and Luna use OpenAI's Standard short-context rates. Their long-context requests above 272,000 input tokens use different rates, and local session totals do not identify every request's pricing tier. Fast, batch, and regional processing can also differ from these defaults. RepoSpend keeps the result labeled as an API-equivalent estimate.
28
+ GPT-6 Astra, Sol, and Luna use OpenAI's Standard short-context rates. Their long-context requests above 272,000 input tokens use different rates, applied per request when local records carry request sizes (Codex per-turn and Copilot per-request usage); aggregate-only usage stays at short-context rates and is flagged with an `assumed_short_context_rates` warning instead of guessing a tier. Fast, batch, and regional processing can also differ from these defaults. RepoSpend keeps the result labeled as an API-equivalent estimate.
29
+
30
+ The GPT-5.x Standard cards carry the same per-request 272K threshold: GPT-5.6 Sol ($8 input / $0.80 cache read / $10 30m and $20 12h writes / $30 output), GPT-5.6 Terra ($4 / $0.40 / $5 and $10 / $18), GPT-5.6 Luna ($0.40 / $0.04 / $0.50 and $1 / $1.80), GPT-5.5 ($10 / $1 / $45), GPT-5.5 Pro ($60 / $270, no published cache rates), GPT-5.4 ($5 / $0.50 / $22.50), and GPT-5.4 Pro ($60 / $270, no published cache rates) each expose an editable `-long-context` card. GPT-5.4 mini and nano have no published long-context tier and stay flat at every request size. The same semantics apply as GPT-6/6.1: a request over 272,000 input tokens reprices at 2x input/cache rates and 1.5x output rates, an intentional custom flat base card stays flat unless the long-context card is also edited, and unknown request lengths use short-context rates with an assumption warning.
29
31
 
30
32
  ### GPT-6.1 Sol (September 29, 2026)
31
33
 
32
34
  The explicit `gpt-6.1-sol` card uses $2 input, $0.10 cached input, $2.50 cache writes, and $10 output/reasoning per 1M tokens, verified against [OpenAI's model reference](https://developers.openai.com/api/docs/models/gpt-6.1-sol) on September 29. GPT-6 Sol remains separate at $0.20 for cached input. Case-insensitive and Copilot-prefixed IDs resolve to the same card; terminal snapshot dates preserve the model generation. Snapshot support is defensive parsing, not a claim that OpenAI publishes those snapshot IDs. Custom exact-ID overrides continue to take precedence.
33
35
 
34
- Above 272K input tokens per request, GPT-6.1 Sol's Standard rates become $4 input, $0.20 cached input, $5 cache writes, and $15 output per 1M tokens. Fast costs twice Standard; Batch and Flex cost half Standard. RepoSpend's default estimate uses Standard short-context pricing because aggregate local usage cannot reliably identify these modifiers for every request. See the [GPT-6.1 Sol pricing and Codex tracking guide](https://repospend.com/guides/gpt-6-1-sol-pricing) for a worked example.
36
+ Above 272K input tokens per request, GPT-6.1 Sol's Standard rates become $4 input, $0.20 cached input, $5 cache writes, and $15 output per 1M tokens, selected per request through the `gpt-6.1-sol-long-context` card (a RepoSpend rate card, not a provider model ID). Fast costs twice Standard; Batch and Flex cost half Standard. Requests without a recorded size use short-context rates with an assumption note; sessions whose saved table lacks the long-context card fall back to base rates and are flagged with `missing_long_context_pricing`. See the [GPT-6.1 Sol pricing and Codex tracking guide](https://repospend.com/guides/gpt-6-1-sol-pricing) for a worked example.
37
+
38
+ ### GPT-6.1 Terra (October 26, 2026)
39
+
40
+ The explicit `gpt-6.1-terra` card uses $1 input, $0.05 cached input, $1.25 30-minute cache writes, $2.50 12-hour cache writes, and $5 output/reasoning per 1M tokens, verified against [OpenAI's model reference](https://developers.openai.com/api/docs/models/gpt-6.1-terra) on October 27. Above 272K input tokens per request the whole request reprices at 2x input/cache rates and 1.5x output rates through the editable `gpt-6.1-terra-long-context` card. Terra does not inherit the older GPT-5.6 Terra rates; custom exact-ID overrides continue to take precedence.
35
41
 
36
42
  Claude Fable 5.1 and Mythos 5.1 retain their predecessor's base rates but have lower cache-read pricing. Claude Opus 5.5 has its own lower base and cache rates. These model rows use Anthropic's global Standard rates.
37
43
 
38
44
  OpenAI reduced GPT-5.6 pricing effective July 30, 2026. RepoSpend uses $2 input and $12 output per 1M tokens for Terra, and $0.20 input and $1.20 output for Luna. Cached input remains 90% below the uncached input rate, and cache writes are billed at 1.25x the uncached input rate, so Luna's bundled cache-write rate is $0.25 per 1M tokens.
39
45
 
40
- GPT-5.6 Sol and its `gpt-5.6` alias use promotional $4 input, $0.40 cached input, $5 cache writes, and $20 output/reasoning per 1M tokens, available at least through November 21, 2026. Older full bundled pricing files receive this correction; intentionally saved sparse overrides remain unchanged.
46
+ GPT-5.6 Sol and its `gpt-5.6` alias use promotional $4 input, $0.40 cached input, $5 cache writes, and $20 output/reasoning per 1M tokens, available at least through November 21, 2026 — recheck the promotional card on November 22, 2026. Older full bundled pricing files receive this correction; intentionally saved sparse overrides remain unchanged.
41
47
 
42
48
  Gemini 3.6, 3.7, and 3.8 Flash use GitHub Copilot promotional rates through December 31, 2026. MAI-Code-1.1-Flash, Grok 4.5–4.7, and Kimi K3 have explicit Copilot reference cards. Grok rates use the up-to-200K input tier; longer requests cost more.
43
49
 
@@ -55,11 +61,20 @@ cache-write rate. If a source only exposes the older aggregate
55
61
  `cache_creation_input_tokens` field, RepoSpend falls back to the model's generic
56
62
  cache-write rate.
57
63
 
64
+ For OpenAI models, RepoSpend uses the TTL split recorded in
65
+ `usage.cache_write_tokens_details` (or the nested
66
+ `input_tokens_details.cache_write_tokens_details` shape): `ttl_30m_tokens` use
67
+ the 30-minute cache-write rate and `ttl_12h_tokens` use the 12-hour rate. Writes
68
+ without a TTL breakdown use the generic cache-write rate, which equals the
69
+ 30-minute rate on bundled OpenAI cards.
70
+
58
71
  Each model can define:
59
72
 
60
73
  - input tokens
61
- - 5-minute cache write input tokens
62
- - 1-hour cache write input tokens
74
+ - 5-minute cache write input tokens (Claude)
75
+ - 1-hour cache write input tokens (Claude)
76
+ - 30-minute cache write input tokens (OpenAI)
77
+ - 12-hour cache write input tokens (OpenAI)
63
78
  - generic cache write input tokens for sources without a TTL split
64
79
  - cached input tokens
65
80
  - output tokens
@@ -6,6 +6,7 @@ RepoSpend uses one normalized token shape across local clients:
6
6
  - `cachedInputTokens` is the cache-read portion of input.
7
7
  - `cacheCreationInputTokens` is the cache-write portion of input, when the source exposes it.
8
8
  - `cacheCreationInputTokens5m` and `cacheCreationInputTokens1h` preserve Anthropic's Claude cache-write TTL split when local transcripts expose `usage.cache_creation`.
9
+ - `cacheCreationInputTokens30m` and `cacheCreationInputTokens12h` preserve OpenAI's cache-write TTL split when usage records expose `cache_write_tokens_details` (flat or nested under `input_tokens_details`); `cacheCreationInputTokens` remains the total write bucket for billing.
9
10
  - `outputTokens` is visible/non-reasoning output.
10
11
  - `reasoningTokens` is reasoning output, when the source exposes it.
11
12
  - `totalTokens = inputTokens + outputTokens + reasoningTokens`.
@@ -55,15 +56,24 @@ session files exist, RepoSpend can show higher Claude totals than `ccusage` or
55
56
  Tokscale without a parser bug. When comparing tools, first check whether the
56
57
  same Claude roots are included.
57
58
 
58
- For Claude, RepoSpend also preserves the cache-write TTL split when it is present
59
+ RepoSpend also preserves the cache-write TTL split when it is present
59
60
  in local logs:
60
61
 
61
62
  ```text
62
63
  5-minute cache write = cacheCreationInputTokens5m
63
64
  1-hour cache write = cacheCreationInputTokens1h
64
- unclassified cache write = cacheCreationInputTokens - cacheCreationInputTokens5m - cacheCreationInputTokens1h
65
+ 30-minute cache write = cacheCreationInputTokens30m
66
+ 12-hour cache write = cacheCreationInputTokens12h
67
+ unclassified cache write = cacheCreationInputTokens - (5m + 1h + 30m + 12h buckets)
65
68
  ```
66
69
 
70
+ OpenAI cache reads and writes may arrive as flat fields (`cached_input_tokens`,
71
+ `cache_write_tokens`) or nested (`input_tokens_details.cached_tokens`,
72
+ `input_tokens_details.cache_write_tokens` with
73
+ `cache_write_tokens_details.ttl_30m_tokens` / `ttl_12h_tokens`). Both shapes
74
+ normalize to the same buckets, and `inputTokens` stays inclusive of reads and
75
+ writes per the OpenAI API contract.
76
+
67
77
  This is one reason RepoSpend API-equivalent cost can differ from `ccusage`.
68
78
  Anthropic prices 5-minute cache writes at a different rate than 1-hour cache
69
79
  writes. RepoSpend applies the recorded TTL-specific rate for each bucket; tools
@@ -93,6 +103,13 @@ When checking RepoSpend against `ccusage`, Tokscale, or another local usage tool
93
103
 
94
104
  For Codex, RepoSpend prefers per-turn `last_token_usage` deltas and skips stale duplicate snapshots when available. This avoids under-counting sessions that compacted and avoids over-counting rebroadcast cumulative checkpoints.
95
105
 
106
+ Codex sessions can switch models mid-session. Per-turn and direct usage records
107
+ each keep the model that was active for that request in the session's
108
+ `modelUsage` slices, so per-request pricing and model rollups stay correct
109
+ without creating duplicate session rows. Sessions that only expose cumulative
110
+ snapshots fall back to the session model and are priced as an aggregate with an
111
+ explicit assumption warning rather than invented per-request sizes.
112
+
96
113
  For GitHub Copilot, RepoSpend aligns with ccusage and Tokscale for OTEL-backed
97
114
  records, but keeps `cachedInputTokens` as a subset of `inputTokens` in the
98
115
  normalized model. Copilot CLI session-state files can expose output tokens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repospend",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Local-first dashboard for tracking AI coding token usage and API-equivalent spend by repository, session, model, and tool.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Mehmet Mustafa Demir",
@@ -70,24 +70,42 @@
70
70
  "sqlite"
71
71
  ],
72
72
  "engines": {
73
- "node": ">=20"
73
+ "node": ">=22.12"
74
74
  },
75
75
  "packageManager": "pnpm@9.15.9",
76
76
  "dependencies": {
77
- "@fastify/static": "^9.1.3",
77
+ "@fastify/static": "^10.1.8",
78
78
  "better-sqlite3": "^12.10.0",
79
- "fastify": "^5.6.2"
79
+ "fastify": "^5.12.7"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@eslint/js": "^9.39.1",
83
83
  "@types/node": "^22.19.1",
84
- "esbuild": "^0.28.0",
84
+ "esbuild": "^0.28.2",
85
85
  "eslint": "^9.39.1",
86
86
  "gifenc": "^1.0.3",
87
87
  "playwright": "^1.60.0",
88
- "sharp": "^0.35.1",
88
+ "sharp": "^0.35.5",
89
89
  "typescript": "^5.9.3",
90
90
  "typescript-eslint": "^8.46.4",
91
- "vitest": "^3.2.4"
91
+ "vitest": "^3.2.7"
92
+ },
93
+ "pnpm": {
94
+ "overrides": {
95
+ "vite": "^6.4.5",
96
+ "find-my-way": "^9.10.0",
97
+ "fast-uri@3": "^3.1.9",
98
+ "tinypool": "^2.1.2",
99
+ "brace-expansion@1": "^1.1.21",
100
+ "brace-expansion@>=2": "^5.0.12",
101
+ "js-yaml": "^4.3.2",
102
+ "postcss": "^8.5.23",
103
+ "postcss-selector-parser": "^6.1.5",
104
+ "nanoid@3": "^3.3.18",
105
+ "source-map-js": "^1.2.2",
106
+ "browserslist": "^4.28.7",
107
+ "baseline-browser-mapping": "^2.11.0",
108
+ "@babel/core": "^7.29.6"
109
+ }
92
110
  }
93
111
  }