metergraph-core 0.2.24__tar.gz → 0.2.27__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.4
2
2
  Name: metergraph-core
3
- Version: 0.2.24
3
+ Version: 0.2.27
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.24"
3
+ version = "0.2.27"
4
4
  description = "Reusable MeterGraph catalog and deterministic billing engine"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -8,6 +8,7 @@ from .catalog import (
8
8
  ResolvedPrice,
9
9
  counts_cache_read_in_input,
10
10
  direct_channel_for_provider,
11
+ normalize_provider,
11
12
  )
12
13
  from .billing import (
13
14
  BillingDecision,
@@ -43,6 +44,7 @@ __all__ = [
43
44
  "RetrievalPrice",
44
45
  "counts_cache_read_in_input",
45
46
  "direct_channel_for_provider",
47
+ "normalize_provider",
46
48
  "load_catalog",
47
49
  "normalize_gateway_evidence",
48
50
  "parse_catalog",
@@ -14,6 +14,7 @@ _PROVIDER_ALIASES = {
14
14
  "aws-bedrock": "bedrock",
15
15
  "gemini": "google",
16
16
  "google-genai": "google",
17
+ "moonshot": "moonshotai",
17
18
  "perplexity": "perplexity-ai",
18
19
  "xai": "x-ai",
19
20
  }
@@ -34,6 +35,15 @@ _DIRECT_CHANNEL_BY_PROVIDER = {
34
35
  "deepseek": "deepseek-api",
35
36
  "perplexity-ai": "perplexity-api",
36
37
  "x-ai": "xai-api",
38
+ "alibaba": "alibaba-api",
39
+ # Amazon publishes no first-party inference API: its own models are sold
40
+ # through Bedrock, so a trace naming "amazon" was billed on Bedrock.
41
+ "amazon": "aws-bedrock",
42
+ "meta": "meta-api",
43
+ "minimax": "minimax-api",
44
+ "mistral": "mistral-api",
45
+ "moonshotai": "moonshot-api",
46
+ "zai": "zai-api",
37
47
  }
38
48
 
39
49
 
@@ -85,7 +95,7 @@ def counts_cache_read_in_input(
85
95
  return pair in _INPUT_INCLUDES_CACHE_READ_PAIRS
86
96
 
87
97
 
88
- def _normalize_provider(provider: str) -> str:
98
+ def normalize_provider(provider: str) -> str:
89
99
  """Fold a provider spelling through metergraph-core's provider-alias map
90
100
  (e.g. ``aws``/``amazon-bedrock`` -> ``bedrock``, ``google-genai`` ->
91
101
  ``google``) so identity and channel lookups accept every spelling the
@@ -101,7 +111,7 @@ def direct_channel_for_provider(provider: Any) -> str | None:
101
111
  channel."""
102
112
  if not isinstance(provider, str):
103
113
  return None
104
- return _DIRECT_CHANNEL_BY_PROVIDER.get(_normalize_provider(provider))
114
+ return _DIRECT_CHANNEL_BY_PROVIDER.get(normalize_provider(provider))
105
115
 
106
116
 
107
117
  def _coerce_datetime(at: Any) -> datetime: