metergraph-core 0.8.6__tar.gz → 0.8.7__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.
Files changed (25) hide show
  1. {metergraph_core-0.8.6/src/metergraph_core.egg-info → metergraph_core-0.8.7}/PKG-INFO +4 -3
  2. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/README.md +3 -2
  3. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/pyproject.toml +1 -1
  4. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/catalog.py +12 -3
  5. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/catalog_delta.py +1 -0
  6. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/data/prices.yaml +101 -7
  7. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/loader.py +12 -0
  8. {metergraph_core-0.8.6 → metergraph_core-0.8.7/src/metergraph_core.egg-info}/PKG-INFO +4 -3
  9. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/MANIFEST.in +0 -0
  10. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/setup.cfg +0 -0
  11. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/__init__.py +0 -0
  12. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/billing.py +0 -0
  13. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/calls.py +0 -0
  14. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/data/models.yaml +0 -0
  15. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/data/sources.yaml +0 -0
  16. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/extractors.py +0 -0
  17. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/models.py +0 -0
  18. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/refresh.py +0 -0
  19. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/responses.py +0 -0
  20. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/retrieval.py +0 -0
  21. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core/sources.py +0 -0
  22. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core.egg-info/SOURCES.txt +0 -0
  23. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core.egg-info/dependency_links.txt +0 -0
  24. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core.egg-info/requires.txt +0 -0
  25. {metergraph_core-0.8.6 → metergraph_core-0.8.7}/src/metergraph_core.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metergraph-core
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: Open, effective-dated LLM pricing catalog and deterministic cost calculator for popular models across major providers and gateways, including OpenAI, Anthropic, Google Gemini, AWS Bedrock, OpenRouter, Vercel AI Gateway, and more.
5
5
  Author: Metergraph
6
6
  License-Expression: Apache-2.0
@@ -186,8 +186,9 @@ standard `cache_read_per_mtok`, as before. A standard call always uses the
186
186
  standard cache-read rate. A row with only a batch cache rate fully prices a
187
187
  cached batch call, while a cached standard call on it is `partial` with
188
188
  `cache_read_rate_unavailable`.
189
- Batch cache writes use `Price.batch_cache_write_5m_per_mtok` when stated;
190
- otherwise they retain the row's standard cache-write rate.
189
+ Batch cache writes use `Price.batch_cache_write_5m_per_mtok` or
190
+ `Price.batch_cache_write_1h_per_mtok` for the matching TTL when stated;
191
+ otherwise each retains the row's standard cache-write rate.
191
192
 
192
193
  A `ModelUsage` count left `None` is unknown, not zero. A missing input or
193
194
  output count keeps the subtotal that is known, marks the result `partial`, and
@@ -156,8 +156,9 @@ standard `cache_read_per_mtok`, as before. A standard call always uses the
156
156
  standard cache-read rate. A row with only a batch cache rate fully prices a
157
157
  cached batch call, while a cached standard call on it is `partial` with
158
158
  `cache_read_rate_unavailable`.
159
- Batch cache writes use `Price.batch_cache_write_5m_per_mtok` when stated;
160
- otherwise they retain the row's standard cache-write rate.
159
+ Batch cache writes use `Price.batch_cache_write_5m_per_mtok` or
160
+ `Price.batch_cache_write_1h_per_mtok` for the matching TTL when stated;
161
+ otherwise each retains the row's standard cache-write rate.
161
162
 
162
163
  A `ModelUsage` count left `None` is unknown, not zero. A missing input or
163
164
  output count keeps the subtotal that is known, marks the result `partial`, and
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "metergraph-core"
3
- version = "0.8.6"
3
+ version = "0.8.7"
4
4
  description = "Open, effective-dated LLM pricing catalog and deterministic cost calculator for popular models across major providers and gateways, including OpenAI, Anthropic, Google Gemini, AWS Bedrock, OpenRouter, Vercel AI Gateway, and more."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -242,11 +242,16 @@ class Price:
242
242
  batch_cache_read_per_mtok: Decimal | None = None
243
243
  # OpenAI publishes a separate Batch/Flex cache-write rate.
244
244
  batch_cache_write_5m_per_mtok: Decimal | None = None
245
+ batch_cache_write_1h_per_mtok: Decimal | None = None
245
246
 
246
247
  def __post_init__(self) -> None:
247
248
  # The loader checks the rate it reads, but a row built or replaced
248
249
  # directly must not bill a negative or undefined cache component.
249
- for name in ("batch_cache_read_per_mtok", "batch_cache_write_5m_per_mtok"):
250
+ for name in (
251
+ "batch_cache_read_per_mtok",
252
+ "batch_cache_write_5m_per_mtok",
253
+ "batch_cache_write_1h_per_mtok",
254
+ ):
250
255
  rate = getattr(self, name)
251
256
  if rate is not None and not (
252
257
  isinstance(rate, Decimal) and rate.is_finite() and rate >= 0
@@ -411,6 +416,7 @@ def _billed_terms(resolved: ResolvedPrice) -> tuple[Any, ...]:
411
416
  price.batch_output_per_mtok,
412
417
  price.batch_cache_read_per_mtok,
413
418
  price.batch_cache_write_5m_per_mtok,
419
+ price.batch_cache_write_1h_per_mtok,
414
420
  price.request_fee_per_1k_usd,
415
421
  resolved.rules,
416
422
  )
@@ -565,6 +571,7 @@ def _price_tokens(
565
571
  output_rate = price.output_per_mtok
566
572
  cache_read_rate = price.cache_read_per_mtok
567
573
  cache_write_5m_rate = price.cache_write_5m_per_mtok
574
+ cache_write_1h_rate = price.cache_write_1h_per_mtok
568
575
  if batch:
569
576
  if price.batch_input_per_mtok is None or price.batch_output_per_mtok is None:
570
577
  reasons.append("batch_rate_unavailable")
@@ -577,6 +584,8 @@ def _price_tokens(
577
584
  cache_read_rate = price.batch_cache_read_per_mtok
578
585
  if price.batch_cache_write_5m_per_mtok is not None:
579
586
  cache_write_5m_rate = price.batch_cache_write_5m_per_mtok
587
+ if price.batch_cache_write_1h_per_mtok is not None:
588
+ cache_write_1h_rate = price.batch_cache_write_1h_per_mtok
580
589
 
581
590
  input_multiplier = Decimal("1")
582
591
  output_multiplier = Decimal("1")
@@ -633,12 +642,12 @@ def _price_tokens(
633
642
  / _MILLION
634
643
  )
635
644
  if cache_write_1h_count:
636
- if price.cache_write_1h_per_mtok is None:
645
+ if cache_write_1h_rate is None:
637
646
  reasons.append("cache_write_1h_rate_unavailable")
638
647
  else:
639
648
  cache_write_usd += (
640
649
  Decimal(cache_write_1h_count)
641
- * price.cache_write_1h_per_mtok
650
+ * cache_write_1h_rate
642
651
  * input_multiplier
643
652
  / _MILLION
644
653
  )
@@ -55,6 +55,7 @@ RATE_FIELDS = (
55
55
  "batch_output_per_mtok",
56
56
  "batch_cache_read_per_mtok",
57
57
  "batch_cache_write_5m_per_mtok",
58
+ "batch_cache_write_1h_per_mtok",
58
59
  "request_fee_per_1k_usd",
59
60
  )
60
61
  _PRICE_FIELDS = frozenset(
@@ -6,9 +6,9 @@
6
6
  #
7
7
  # Community updates welcome: add an alias or price entry with its provider
8
8
  # source_url and open a PR. CI validates structure and date overlaps.
9
- version: "2026-10-29.3"
9
+ version: "2026-11-02.1"
10
10
  currency: USD
11
- pricing_verified_at: "2026-10-29"
11
+ pricing_verified_at: "2026-11-02"
12
12
  models:
13
13
  - canonical_id: openai/gpt-6-sol
14
14
  publisher: openai
@@ -1623,6 +1623,7 @@ models:
1623
1623
  - channel: anthropic-api
1624
1624
  region: global
1625
1625
  effective_from: "2026-10-07"
1626
+ effective_to: "2026-10-30"
1626
1627
  input_per_mtok: 0.10
1627
1628
  output_per_mtok: 0.50
1628
1629
  cache_read_per_mtok: 0.01
@@ -1633,6 +1634,19 @@ models:
1633
1634
  rules:
1634
1635
  long_context: {threshold: 100000, input_multiplier: 5, output_multiplier: 5, threshold_counts_cached_tokens: true}
1635
1636
  source_url: https://www.anthropic.com/claude-haiku-5-5
1637
+ - channel: anthropic-api
1638
+ region: global
1639
+ effective_from: "2026-10-30"
1640
+ input_per_mtok: 0.10
1641
+ output_per_mtok: 0.50
1642
+ cache_read_per_mtok: 0.01
1643
+ cache_write_5m_per_mtok: 0.125
1644
+ cache_write_1h_per_mtok: 0.20
1645
+ batch_input_per_mtok: 0.05
1646
+ batch_output_per_mtok: 0.25
1647
+ rules:
1648
+ long_context: {threshold: 100000, input_multiplier: 5, output_multiplier: 5, threshold_counts_cached_tokens: true}
1649
+ source_url: https://platform.claude.com/docs/en/about-claude/pricing
1636
1650
  - channel: vercel-ai-gateway
1637
1651
  region: global
1638
1652
  effective_from: "2026-10-07"
@@ -3620,12 +3634,46 @@ models:
3620
3634
  - channel: moonshot-api
3621
3635
  region: global
3622
3636
  effective_from: "2026-10-24"
3637
+ effective_to: "2026-10-30"
3638
+ input_per_mtok: 2.00
3639
+ output_per_mtok: 10.00
3640
+ cache_read_per_mtok: 0.20
3641
+ cache_write_5m_per_mtok: 2.00
3642
+ rules: {input_includes_cache_read: true, input_includes_cache_write: true}
3643
+ source_url: https://platform.kimi.ai/
3644
+ # Batch input/output are 60% of the standard price, the rule the platform
3645
+ # states for this model: https://platform.kimi.ai/docs/pricing/batch
3646
+ - channel: moonshot-api
3647
+ region: global
3648
+ effective_from: "2026-10-30"
3649
+ effective_to: "2026-11-02"
3623
3650
  input_per_mtok: 2.00
3624
3651
  output_per_mtok: 10.00
3625
3652
  cache_read_per_mtok: 0.20
3626
3653
  cache_write_5m_per_mtok: 2.00
3654
+ batch_input_per_mtok: 1.20
3655
+ batch_output_per_mtok: 6.00
3656
+ batch_cache_read_per_mtok: 0.12
3657
+ batch_cache_write_5m_per_mtok: 1.20
3627
3658
  rules: {input_includes_cache_read: true, input_includes_cache_write: true}
3628
3659
  source_url: https://platform.kimi.ai/
3660
+ # Current 1h rates: https://platform.kimi.ai/docs/pricing/chat
3661
+ # Batch 1h rates: https://platform.kimi.ai/docs/pricing/batch
3662
+ - channel: moonshot-api
3663
+ region: global
3664
+ effective_from: "2026-11-02"
3665
+ input_per_mtok: 2.00
3666
+ output_per_mtok: 10.00
3667
+ cache_read_per_mtok: 0.20
3668
+ cache_write_5m_per_mtok: 2.00
3669
+ cache_write_1h_per_mtok: 4.00
3670
+ batch_input_per_mtok: 1.20
3671
+ batch_output_per_mtok: 6.00
3672
+ batch_cache_read_per_mtok: 0.12
3673
+ batch_cache_write_5m_per_mtok: 1.20
3674
+ batch_cache_write_1h_per_mtok: 2.40
3675
+ rules: {input_includes_cache_read: true, input_includes_cache_write: true}
3676
+ source_url: https://platform.kimi.ai/docs/pricing/batch
3629
3677
 
3630
3678
  - canonical_id: moonshotai/kimi-k3.1-pro-highspeed
3631
3679
  publisher: moonshotai
@@ -3698,12 +3746,46 @@ models:
3698
3746
  - channel: moonshot-api
3699
3747
  region: global
3700
3748
  effective_from: "2026-10-29"
3749
+ effective_to: "2026-10-30"
3701
3750
  input_per_mtok: 3.0
3702
3751
  output_per_mtok: 15.0
3703
3752
  cache_read_per_mtok: 0.3
3704
3753
  cache_write_5m_per_mtok: 3.0
3705
3754
  rules: {input_includes_cache_read: true, input_includes_cache_write: true}
3706
3755
  source_url: https://platform.kimi.ai/
3756
+ # Batch input/output are 60% of the standard price, the rule the platform
3757
+ # states for this model: https://platform.kimi.ai/docs/pricing/batch
3758
+ - channel: moonshot-api
3759
+ region: global
3760
+ effective_from: "2026-10-30"
3761
+ effective_to: "2026-11-02"
3762
+ input_per_mtok: 3.0
3763
+ output_per_mtok: 15.0
3764
+ cache_read_per_mtok: 0.3
3765
+ cache_write_5m_per_mtok: 3.0
3766
+ batch_input_per_mtok: 1.80
3767
+ batch_output_per_mtok: 9.00
3768
+ batch_cache_read_per_mtok: 0.18
3769
+ batch_cache_write_5m_per_mtok: 1.80
3770
+ rules: {input_includes_cache_read: true, input_includes_cache_write: true}
3771
+ source_url: https://platform.kimi.ai/
3772
+ # Current 1h rates: https://platform.kimi.ai/docs/pricing/chat
3773
+ # Batch 1h rates: https://platform.kimi.ai/docs/pricing/batch
3774
+ - channel: moonshot-api
3775
+ region: global
3776
+ effective_from: "2026-11-02"
3777
+ input_per_mtok: 3.0
3778
+ output_per_mtok: 15.0
3779
+ cache_read_per_mtok: 0.3
3780
+ cache_write_5m_per_mtok: 3.0
3781
+ cache_write_1h_per_mtok: 6.0
3782
+ batch_input_per_mtok: 1.80
3783
+ batch_output_per_mtok: 9.00
3784
+ batch_cache_read_per_mtok: 0.18
3785
+ batch_cache_write_5m_per_mtok: 1.80
3786
+ batch_cache_write_1h_per_mtok: 3.60
3787
+ rules: {input_includes_cache_read: true, input_includes_cache_write: true}
3788
+ source_url: https://platform.kimi.ai/docs/pricing/batch
3707
3789
  - channel: fireworks-api
3708
3790
  region: global
3709
3791
  effective_from: "2026-07-19"
@@ -4574,10 +4656,6 @@ models:
4574
4656
  cache_read_per_mtok: 0.16
4575
4657
  source_url: https://fireworks.ai/models/fireworks/kimi-k2p6
4576
4658
 
4577
- # Google prices this model's output by modality: $9.00 text, $17.50 video.
4578
- # The catalog carries one output rate per price row, so this records the text
4579
- # rate. A video-heavy caller is therefore under-costed here, which is the
4580
- # known limitation to revisit if that traffic ever becomes material.
4581
4659
  - channel: openrouter-api
4582
4660
  region: global
4583
4661
  effective_from: "2026-10-20"
@@ -4609,7 +4687,9 @@ models:
4609
4687
  - {provider: google, alias: gemini-omni-1.1-flash, channel: google-api}
4610
4688
  - {provider: google, alias: models/gemini-omni-1.1-flash, channel: google-api}
4611
4689
  prices:
4612
- # Uses the video output rate: video is this model's only output modality.
4690
+ # Google lists $9.00 text and $17.50 video output here; $17.50 is the
4691
+ # billed rate, the one its stated 5,792 tokens per second of 720p video
4692
+ # at about $0.10 per second resolves to.
4613
4693
  - channel: google-api
4614
4694
  region: global
4615
4695
  effective_from: "2026-08-27"
@@ -4629,6 +4709,20 @@ models:
4629
4709
  - channel: google-api
4630
4710
  region: global
4631
4711
  effective_from: "2026-10-29"
4712
+ effective_to: "2026-10-30"
4713
+ input_per_mtok: 1.50
4714
+ output_per_mtok: 17.50
4715
+ source_url: https://ai.google.dev/gemini-api/docs/pricing
4716
+ - channel: google-api
4717
+ region: global
4718
+ effective_from: "2026-10-30"
4719
+ effective_to: "2026-10-31"
4720
+ input_per_mtok: 1.5
4721
+ output_per_mtok: 9
4722
+ source_url: https://ai.google.dev/gemini-api/docs/pricing
4723
+ - channel: google-api
4724
+ region: global
4725
+ effective_from: "2026-10-31"
4632
4726
  input_per_mtok: 1.50
4633
4727
  output_per_mtok: 17.50
4634
4728
  source_url: https://ai.google.dev/gemini-api/docs/pricing
@@ -428,6 +428,17 @@ def parse_catalog(
428
428
  f"{canonical}: invalid batch_cache_write_5m_per_mtok "
429
429
  f"{batch_cache_write!r}"
430
430
  )
431
+ batch_cache_write_1h = price.get("batch_cache_write_1h_per_mtok")
432
+ batch_cache_write_1h_per_mtok = _decimal(batch_cache_write_1h)
433
+ if batch_cache_write_1h is not None and (
434
+ batch_cache_write_1h_per_mtok is None
435
+ or not batch_cache_write_1h_per_mtok.is_finite()
436
+ or batch_cache_write_1h_per_mtok < 0
437
+ ):
438
+ raise CatalogError(
439
+ f"{canonical}: invalid batch_cache_write_1h_per_mtok "
440
+ f"{batch_cache_write_1h!r}"
441
+ )
431
442
  prices.append(
432
443
  Price(
433
444
  id=f"{canonical}:{channel}:{region}:{_id_date(effective_from)}",
@@ -454,6 +465,7 @@ def parse_catalog(
454
465
  currency=currency,
455
466
  batch_cache_read_per_mtok=batch_cache_read_per_mtok,
456
467
  batch_cache_write_5m_per_mtok=batch_cache_write_5m_per_mtok,
468
+ batch_cache_write_1h_per_mtok=batch_cache_write_1h_per_mtok,
457
469
  )
458
470
  )
459
471
  return version, {key: tuple(value) for key, value in aliases.items()}, _unique_ids(prices)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metergraph-core
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: Open, effective-dated LLM pricing catalog and deterministic cost calculator for popular models across major providers and gateways, including OpenAI, Anthropic, Google Gemini, AWS Bedrock, OpenRouter, Vercel AI Gateway, and more.
5
5
  Author: Metergraph
6
6
  License-Expression: Apache-2.0
@@ -186,8 +186,9 @@ standard `cache_read_per_mtok`, as before. A standard call always uses the
186
186
  standard cache-read rate. A row with only a batch cache rate fully prices a
187
187
  cached batch call, while a cached standard call on it is `partial` with
188
188
  `cache_read_rate_unavailable`.
189
- Batch cache writes use `Price.batch_cache_write_5m_per_mtok` when stated;
190
- otherwise they retain the row's standard cache-write rate.
189
+ Batch cache writes use `Price.batch_cache_write_5m_per_mtok` or
190
+ `Price.batch_cache_write_1h_per_mtok` for the matching TTL when stated;
191
+ otherwise each retains the row's standard cache-write rate.
191
192
 
192
193
  A `ModelUsage` count left `None` is unknown, not zero. A missing input or
193
194
  output count keeps the subtotal that is known, marks the result `partial`, and