cctrack 0.11.1__tar.gz → 0.11.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cctrack
3
- Version: 0.11.1
3
+ Version: 0.11.2
4
4
  Summary: Claude Code cost tracker — scans JSONL logs and reports token usage + estimated cost
5
5
  Project-URL: Homepage, https://github.com/rappdw/cctrack
6
6
  Project-URL: Repository, https://github.com/rappdw/cctrack
@@ -202,6 +202,7 @@ Prices per million tokens. Claude prices are from [Anthropic's pricing page](htt
202
202
 
203
203
  | Claude model | Input | Output | Cache Read | Cache Write 5m | Cache Write 1h |
204
204
  |---|---|---|---|---|---|
205
+ | Fable 5.2 / Mythos 5.2 | $8.00 | $40.00 | $0.20 | $10.00 | $16.00 |
205
206
  | Fable 5.1 / Mythos 5.1 | $10.00 | $50.00 | $0.25 | $12.50 | $20.00 |
206
207
  | Fable 5 / Mythos 5 | $10.00 | $50.00 | $1.00 | $12.50 | $20.00 |
207
208
  | Opus 5.5 | $4.00 | $20.00 | $0.20 | $5.00 | $8.00 |
@@ -217,12 +218,13 @@ Prices per million tokens. Claude prices are from [Anthropic's pricing page](htt
217
218
  | Haiku 3.5 | $0.80 | $4.00 | $0.08 | $1.00 | $1.60 |
218
219
  | Haiku 3 | $0.25 | $1.25 | $0.03 | $0.30 | $0.50 |
219
220
 
220
- OpenAI prices (for Codex) are from [OpenAI's pricing page](https://developers.openai.com/api/docs/pricing), Standard tier. OpenAI has a single cache-write price, listed only for some models; elsewhere cache writes bill as ordinary input.
221
+ OpenAI prices (for Codex) are from [OpenAI's pricing page](https://developers.openai.com/api/docs/pricing), Standard tier, last checked 2026-11-16. Cache writes are priced at OpenAI's 30-minute rate, shown below. OpenAI also sells 12-hour writes at 2×, but Codex logs don't record which one was used. Where no cache-write price is listed, cache writes bill as ordinary input. Some ids Codex logs aren't on OpenAI's price list at all, such as `codex-auto-review` and `gpt-daybreak-blue-latest`. Those stay flagged `?` and are estimated at GPT-5 rates.
221
222
 
222
223
  | OpenAI model | Input | Cached input | Output | Cache write | Over 272K input |
223
224
  |---|---|---|---|---|---|
224
225
  | gpt-6-astra | $10.00 | $1.00 | $50.00 | $12.50 | $20 / $2 / $75 / $25 |
225
226
  | gpt-6.1-sol | $2.00 | $0.10 | $10.00 | $2.50 | $4 / $0.20 / $15 / $5 |
227
+ | gpt-6.1-terra | $1.00 | $0.05 | $5.00 | $1.25 | $2 / $0.10 / $7.50 / $2.50 |
226
228
  | gpt-6-sol | $2.00 | $0.20 | $10.00 | $2.50 | $4 / $0.40 / $15 / $5 |
227
229
  | gpt-6-luna | $0.10 | $0.01 | $0.50 | $0.125 | $0.20 / $0.02 / $0.75 / $0.25 |
228
230
  | gpt-5.6-sol | $4.00 | $0.40 | $20.00 | $5.00 | $8 / $0.80 / $30 / $10 |
@@ -177,6 +177,7 @@ Prices per million tokens. Claude prices are from [Anthropic's pricing page](htt
177
177
 
178
178
  | Claude model | Input | Output | Cache Read | Cache Write 5m | Cache Write 1h |
179
179
  |---|---|---|---|---|---|
180
+ | Fable 5.2 / Mythos 5.2 | $8.00 | $40.00 | $0.20 | $10.00 | $16.00 |
180
181
  | Fable 5.1 / Mythos 5.1 | $10.00 | $50.00 | $0.25 | $12.50 | $20.00 |
181
182
  | Fable 5 / Mythos 5 | $10.00 | $50.00 | $1.00 | $12.50 | $20.00 |
182
183
  | Opus 5.5 | $4.00 | $20.00 | $0.20 | $5.00 | $8.00 |
@@ -192,12 +193,13 @@ Prices per million tokens. Claude prices are from [Anthropic's pricing page](htt
192
193
  | Haiku 3.5 | $0.80 | $4.00 | $0.08 | $1.00 | $1.60 |
193
194
  | Haiku 3 | $0.25 | $1.25 | $0.03 | $0.30 | $0.50 |
194
195
 
195
- OpenAI prices (for Codex) are from [OpenAI's pricing page](https://developers.openai.com/api/docs/pricing), Standard tier. OpenAI has a single cache-write price, listed only for some models; elsewhere cache writes bill as ordinary input.
196
+ OpenAI prices (for Codex) are from [OpenAI's pricing page](https://developers.openai.com/api/docs/pricing), Standard tier, last checked 2026-11-16. Cache writes are priced at OpenAI's 30-minute rate, shown below. OpenAI also sells 12-hour writes at 2×, but Codex logs don't record which one was used. Where no cache-write price is listed, cache writes bill as ordinary input. Some ids Codex logs aren't on OpenAI's price list at all, such as `codex-auto-review` and `gpt-daybreak-blue-latest`. Those stay flagged `?` and are estimated at GPT-5 rates.
196
197
 
197
198
  | OpenAI model | Input | Cached input | Output | Cache write | Over 272K input |
198
199
  |---|---|---|---|---|---|
199
200
  | gpt-6-astra | $10.00 | $1.00 | $50.00 | $12.50 | $20 / $2 / $75 / $25 |
200
201
  | gpt-6.1-sol | $2.00 | $0.10 | $10.00 | $2.50 | $4 / $0.20 / $15 / $5 |
202
+ | gpt-6.1-terra | $1.00 | $0.05 | $5.00 | $1.25 | $2 / $0.10 / $7.50 / $2.50 |
201
203
  | gpt-6-sol | $2.00 | $0.20 | $10.00 | $2.50 | $4 / $0.40 / $15 / $5 |
202
204
  | gpt-6-luna | $0.10 | $0.01 | $0.50 | $0.125 | $0.20 / $0.02 / $0.75 / $0.25 |
203
205
  | gpt-5.6-sol | $4.00 | $0.40 | $20.00 | $5.00 | $8 / $0.80 / $30 / $10 |
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cctrack"
7
- version = "0.11.1"
7
+ version = "0.11.2"
8
8
  description = "Claude Code cost tracker — scans JSONL logs and reports token usage + estimated cost"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -52,7 +52,7 @@ def _oa(family, tier, inp, cached, out, cache_write=None, lc=None):
52
52
  # "intro" is a time-limited launch price applying to usage on/before "until".
53
53
  # "long_context" rates apply to a whole request whose prompt (input + cache
54
54
  # reads + cache writes) exceeds "over".
55
- # Source: https://platform.claude.com/docs/en/about-claude/pricing (2026-10-12).
55
+ # Source: https://platform.claude.com/docs/en/about-claude/pricing (2026-11-16).
56
56
  def _an(family, tier, inp, cw5, cw1h, read, out, lc=None):
57
57
  """Build an Anthropic rate-card row."""
58
58
  row = {"family": family, "tier": tier, "provider": "anthropic", "input": inp,
@@ -66,6 +66,8 @@ def _an(family, tier, inp, cw5, cw1h, read, out, lc=None):
66
66
 
67
67
 
68
68
  RATES = [
69
+ _an("claude-fable-5-2", "frontier", 8.00, 10.00, 16.00, 0.20, 40.00),
70
+ _an("claude-mythos-5-2", "frontier", 8.00, 10.00, 16.00, 0.20, 40.00),
69
71
  _an("claude-fable-5-1", "frontier", 10.00, 12.50, 20.00, 0.25, 50.00),
70
72
  _an("claude-mythos-5-1", "frontier", 10.00, 12.50, 20.00, 0.25, 50.00),
71
73
  _an("claude-fable-5", "frontier", 10.00, 12.50, 20.00, 1.00, 50.00),
@@ -98,8 +100,11 @@ RATES = [
98
100
  _an("claude-haiku-3", "haiku", 0.25, 0.30, 0.50, 0.03, 1.25),
99
101
  ] + [
100
102
  # ── OpenAI (Codex CLI). Source: https://developers.openai.com/api/docs/pricing
101
- # (Standard tier, fetched 2026-10-12). OpenAI has one cache-write tier, so
102
- # cache_write == cache_write_1h. Where the price list shows no cache-write
103
+ # (Standard tier, fetched 2026-10-12; re-checked 2026-11-16). OpenAI lists
104
+ # 30-minute and 12-hour cache writes, but Codex logs a single
105
+ # cache_write_input_tokens count with no TTL, so writes are priced at the
106
+ # 30-minute rate and cache_write == cache_write_1h (12h writes, at 2x, would
107
+ # be under-priced). Where the price list shows no cache-write
103
108
  # price, cache writes are ordinary input and bill at the input rate; where it
104
109
  # shows no cached-input price (the -pro models), cached tokens bill at input.
105
110
  # "long_context" rates apply to a whole request whose input exceeds "over".
@@ -108,6 +113,7 @@ RATES = [
108
113
  # "tier" is a price-class proxy for the energy model only.
109
114
  _oa("gpt-6-astra", "frontier", 10.00, 1.00, 50.00, 12.50, lc=(20.00, 2.00, 75.00, 25.00)),
110
115
  _oa("gpt-6.1-sol", "sonnet", 2.00, 0.10, 10.00, 2.50, lc=(4.00, 0.20, 15.00, 5.00)),
116
+ _oa("gpt-6.1-terra", "sonnet", 1.00, 0.05, 5.00, 1.25, lc=(2.00, 0.10, 7.50, 2.50)),
111
117
  _oa("gpt-6-sol", "sonnet", 2.00, 0.20, 10.00, 2.50, lc=(4.00, 0.40, 15.00, 5.00)),
112
118
  _oa("gpt-6-luna", "haiku", 0.10, 0.01, 0.50, 0.125, lc=(0.20, 0.02, 0.75, 0.25)),
113
119
  _oa("gpt-5.6-sol", "opus", 4.00, 0.40, 20.00, 5.00, lc=(8.00, 0.80, 30.00, 10.00)),
@@ -141,13 +147,14 @@ MODEL_ALIASES = {
141
147
  FAST_MULTIPLIERS = {
142
148
  "claude-opus-4-6": 6.0, "claude-opus-4-7": 6.0,
143
149
  "claude-opus-4-8": 2.0, "claude-opus-5": 2.0, "claude-opus-5-5": 2.0,
150
+ "claude-fable-5-2": 2.0, "claude-mythos-5-2": 2.0,
144
151
  "gpt-5.5": 2.5,
145
152
  **dict.fromkeys(("gpt-5.3-codex", "gpt-5.4", "gpt-5.6-sol", "gpt-5.6-terra",
146
- "gpt-5.6-luna", "gpt-6-astra", "gpt-6-sol", "gpt-6.1-sol",
153
+ "gpt-5.6-luna", "gpt-6-astra", "gpt-6-sol", "gpt-6.1-sol", "gpt-6.1-terra",
147
154
  "gpt-6-luna"), 2.0),
148
155
  }
149
156
  FLEX_MODELS = {
150
- "gpt-6-astra", "gpt-6-sol", "gpt-6.1-sol", "gpt-6-luna",
157
+ "gpt-6-astra", "gpt-6-sol", "gpt-6.1-sol", "gpt-6.1-terra", "gpt-6-luna",
151
158
  "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5.5-pro",
152
159
  "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.4-pro",
153
160
  "gpt-5.2", "gpt-5.1", "gpt-5", "gpt-5-mini", "gpt-5-nano",
@@ -3446,7 +3453,7 @@ def print_explore(events: list[dict], date_str: str,
3446
3453
 
3447
3454
  SCHEMA_VERSION = 1
3448
3455
  # Date the rate card was last verified against both providers' price pages.
3449
- RATE_CARD_VERSION = "2026-10-17"
3456
+ RATE_CARD_VERSION = "2026-11-16"
3450
3457
  RATE_CARD_SOURCES = {
3451
3458
  "anthropic": "https://platform.claude.com/docs/en/about-claude/pricing",
3452
3459
  "openai": "https://developers.openai.com/api/docs/pricing",
@@ -196,6 +196,29 @@ def test_new_minor_versions_never_inherit_a_price():
196
196
  assert cctrack.get_rates("claude-opus-4-20250514")["family"] == "claude-opus-4"
197
197
 
198
198
 
199
+ def test_fable_5_2_and_gpt_6_1_terra_rows():
200
+ """Official prices, 2026-11-16 (Anthropic and OpenAI pricing pages)."""
201
+ for m in ("claude-fable-5-2", "claude-mythos-5-2"):
202
+ r = cctrack.get_rates(m)
203
+ assert r["family"] == m and cctrack.is_known_model(m)
204
+ assert (r["input"], r["cache_write"], r["cache_write_1h"], r["cache_read"], r["output"]) \
205
+ == (8.0, 10.0, 16.0, 0.20, 40.0)
206
+ assert "long_context" not in r
207
+ fast = cctrack.get_rates(m, service_tier="fast")
208
+ assert (fast["input"], fast["output"]) == (16.0, 80.0)
209
+ # Fable 5.2 must not fall back to Sonnet, nor 5.1's or 5's prices.
210
+ assert cctrack.get_rates("claude-fable-5-1")["input"] == 10.0
211
+ t = cctrack.get_rates("gpt-6.1-terra")
212
+ assert (t["input"], t["cache_read"], t["output"], t["cache_write"]) == (1.0, 0.05, 5.0, 1.25)
213
+ lc = cctrack.get_rates("gpt-6.1-terra", request_input=300_000)
214
+ assert (lc["input"], lc["cache_read"], lc["output"], lc["cache_write"]) == (2.0, 0.10, 7.5, 2.5)
215
+ assert cctrack.get_rates("gpt-6.1-terra", service_tier="fast")["output"] == 10.0
216
+ assert cctrack.get_rates("gpt-6.1-terra", service_tier="flex")["output"] == 2.5
217
+ # Not on OpenAI's price list: stay flagged rather than guessed.
218
+ assert not cctrack.is_known_model("codex-auto-review")
219
+ assert not cctrack.is_known_model("gpt-daybreak-blue-latest")
220
+
221
+
199
222
  def test_haiku_5_5_prompt_length_tier():
200
223
  """Haiku 5.5 requests whose prompt (input + cache reads + writes) exceeds
201
224
  100K tokens bill at the higher tier."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes