metergraph-core 0.2.57__tar.gz → 0.2.58__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 (18) hide show
  1. {metergraph_core-0.2.57/src/metergraph_core.egg-info → metergraph_core-0.2.58}/PKG-INFO +1 -1
  2. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/pyproject.toml +1 -1
  3. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/catalog.py +16 -6
  4. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/data/models.yaml +29 -1
  5. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/data/prices.yaml +11 -0
  6. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/loader.py +1 -0
  7. {metergraph_core-0.2.57 → metergraph_core-0.2.58/src/metergraph_core.egg-info}/PKG-INFO +1 -1
  8. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/MANIFEST.in +0 -0
  9. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/README.md +0 -0
  10. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/setup.cfg +0 -0
  11. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/__init__.py +0 -0
  12. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/billing.py +0 -0
  13. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/models.py +0 -0
  14. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core/retrieval.py +0 -0
  15. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core.egg-info/SOURCES.txt +0 -0
  16. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core.egg-info/dependency_links.txt +0 -0
  17. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/src/metergraph_core.egg-info/requires.txt +0 -0
  18. {metergraph_core-0.2.57 → metergraph_core-0.2.58}/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.2.57
3
+ Version: 0.2.58
4
4
  Summary: Reusable MeterGraph catalog and deterministic billing engine
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "metergraph-core"
3
- version = "0.2.57"
3
+ version = "0.2.58"
4
4
  description = "Reusable MeterGraph catalog and deterministic billing engine"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -209,19 +209,24 @@ class Price:
209
209
  # imply one: google-vertex-ai serves Anthropic's models beside Google's,
210
210
  # and the two report cache reads differently.
211
211
  publisher: str | None = None
212
+ # A fixed fee charged once per call on top of tokens, in USD per 1,000
213
+ # calls: a gateway billing a model's built-in search per request.
214
+ request_fee_per_1k_usd: Decimal | None = None
212
215
 
213
216
 
214
217
  @dataclass(frozen=True, slots=True)
215
218
  class CostComponents:
216
- """A priced call's cost by what it paid for. The four parts sum to the
217
- call's ``cost_usd`` exactly: each is quantized and the rounding residue
218
- lands in the input part, so a consumer that stores them can rebuild the
219
- total without a second rounding."""
219
+ """A priced call's cost by what it paid for. The parts sum to the call's
220
+ ``cost_usd`` exactly: each is quantized and the rounding residue lands in
221
+ the input part, so a consumer that stores them can rebuild the total
222
+ without a second rounding. ``request_usd`` is a per-call fee, zero on
223
+ every row that has none."""
220
224
 
221
225
  input_usd: Decimal
222
226
  output_usd: Decimal
223
227
  cache_read_usd: Decimal
224
228
  cache_write_usd: Decimal
229
+ request_usd: Decimal = Decimal("0")
225
230
 
226
231
 
227
232
  @dataclass(frozen=True, slots=True)
@@ -456,15 +461,20 @@ def _price_tokens(
456
461
  )
457
462
  if rules.get("uncaptured_fees"):
458
463
  reasons.append("uncaptured_fees")
464
+ request_usd = (
465
+ Decimal("0")
466
+ if price.request_fee_per_1k_usd is None
467
+ else price.request_fee_per_1k_usd / Decimal(1000)
468
+ )
459
469
 
460
470
  # The total is rounded once, as it always was; the parts are rounded
461
471
  # each and the residue goes to input, so they sum to the total exactly.
462
- cost = (input_usd + output_usd + cache_read_usd + cache_write_usd).quantize(
472
+ cost = (input_usd + output_usd + cache_read_usd + cache_write_usd + request_usd).quantize(
463
473
  _COST_QUANTUM, rounding=ROUND_HALF_UP
464
474
  )
465
475
  parts = [
466
476
  part.quantize(_COST_QUANTUM, rounding=ROUND_HALF_UP)
467
- for part in (input_usd, output_usd, cache_read_usd, cache_write_usd)
477
+ for part in (input_usd, output_usd, cache_read_usd, cache_write_usd, request_usd)
468
478
  ]
469
479
  parts[0] += cost - sum(parts)
470
480
  return cost, reasons, CostComponents(*parts)
@@ -1,4 +1,4 @@
1
- version: '2026-10-08'
1
+ version: '2026-10-09'
2
2
  models:
3
3
  - canonical_id: openai/gpt-5.6-sol
4
4
  display_name: GPT-5.6 Sol
@@ -696,6 +696,30 @@ models:
696
696
  pricing_channel: vercel-ai-gateway
697
697
  execution_profiles:
698
698
  - default
699
+ - canonical_id: anthropic/claude-sonnet-4.6
700
+ display_name: Claude Sonnet 4.6
701
+ publisher: anthropic
702
+ released: '2026-02-17' # https://alternativeto.net/news/2026/2/anthropic-s-claude-sonnet-4-6-launches-with-faster-speeds-and-1m-token-context
703
+ routes:
704
+ - key: default:anthropic/claude-sonnet-4.6
705
+ id: anthropic/claude-sonnet-4.6
706
+ provider: vercel
707
+ model_id: anthropic/claude-sonnet-4.6
708
+ pricing_channel: vercel-ai-gateway
709
+ execution_profiles:
710
+ - default
711
+ - canonical_id: xai/grok-4.3
712
+ display_name: Grok 4.3
713
+ publisher: xai
714
+ released: '2026-04-30' # https://artificialanalysis.ai/articles/xai-launches-grok-4-3-with-improved-agentic-performance-and-lower-pricing
715
+ routes:
716
+ - key: default:xai/grok-4.3
717
+ id: xai/grok-4.3
718
+ provider: vercel
719
+ model_id: xai/grok-4.3
720
+ pricing_channel: vercel-ai-gateway
721
+ execution_profiles:
722
+ - default
699
723
  execution_profiles:
700
724
  - id: default
701
725
  routes:
@@ -754,6 +778,8 @@ execution_profiles:
754
778
  - default:anthropic:claude-opus-4-8
755
779
  - default:anthropic:claude-sonnet-5
756
780
  - default:anthropic:claude-haiku-4-5
781
+ - default:anthropic/claude-sonnet-4.6
782
+ - default:xai/grok-4.3
757
783
  - id: bedrock
758
784
  routes:
759
785
  - bedrock:anthropic/claude-sonnet-5
@@ -811,6 +837,8 @@ offer_groups:
811
837
  - default:xai/grok-4.7
812
838
  - default:moonshotai/kimi-k2.7-code
813
839
  - default:zai/glm-5.3
840
+ - default:anthropic/claude-sonnet-4.6
841
+ - default:xai/grok-4.3
814
842
  - id: fireworks
815
843
  credential: FIREWORKS_API_KEY
816
844
  routes:
@@ -2029,6 +2029,7 @@ models:
2029
2029
  - {provider: x-ai, alias: grok-latest, channel: xai-api}
2030
2030
  - {provider: bedrock, alias: xai.grok-4.3, channel: aws-bedrock}
2031
2031
  - {provider: vercel, alias: spacexai/grok-4.3, channel: vercel-ai-gateway}
2032
+ - {provider: xai, alias: xai/grok-4.3, channel: vercel-ai-gateway}
2032
2033
  - {provider: litellm, alias: grok-4.3, channel: xai-api}
2033
2034
  - {provider: litellm, alias: grok-4.3-latest, channel: xai-api}
2034
2035
  - {provider: unknown, alias: grok-4.3, channel: xai-api}
@@ -2077,6 +2078,7 @@ models:
2077
2078
  - {provider: litellm, alias: sonar, channel: perplexity-api}
2078
2079
  - {provider: perplexity-ai, alias: perplexity/sonar, channel: perplexity-api}
2079
2080
  - {provider: unknown, alias: sonar, channel: perplexity-api}
2081
+ - {provider: vercel, alias: perplexity/sonar, channel: vercel-ai-gateway}
2080
2082
  prices:
2081
2083
  - channel: perplexity-api
2082
2084
  region: global
@@ -2086,6 +2088,15 @@ models:
2086
2088
  rules:
2087
2089
  uncaptured_fees: true
2088
2090
  source_url: https://docs.perplexity.ai/docs/getting-started/pricing
2091
+ # The gateway bills Sonar's built-in search per call, so the row carries
2092
+ # it as a request fee and the call is priced in full.
2093
+ - channel: vercel-ai-gateway
2094
+ region: global
2095
+ effective_from: "2026-10-11"
2096
+ input_per_mtok: 0.25
2097
+ output_per_mtok: 2.50
2098
+ request_fee_per_1k_usd: 2.50
2099
+ source_url: https://vercel.com/ai-gateway/models/sonar
2089
2100
 
2090
2101
  - canonical_id: openai/gpt-5-mini
2091
2102
  publisher: openai
@@ -305,6 +305,7 @@ def parse_catalog(
305
305
  ),
306
306
  batch_input_per_mtok=_decimal(price.get("batch_input_per_mtok")),
307
307
  batch_output_per_mtok=_decimal(price.get("batch_output_per_mtok")),
308
+ request_fee_per_1k_usd=_decimal(price.get("request_fee_per_1k_usd")),
308
309
  rules=_freeze(price.get("rules") or {}),
309
310
  effective_from=effective_from,
310
311
  effective_to=effective_to,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metergraph-core
3
- Version: 0.2.57
3
+ Version: 0.2.58
4
4
  Summary: Reusable MeterGraph catalog and deterministic billing engine
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.10