Skip to main content Switch to mobile version metergraph-core 0.9.4 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.
pip install metergraph-core==0.9.4 Copy PIP instructions
Calculate the cost of an LLM call from its model, provider, tokens, region, and date. metergraph-core ships an open, effective-dated model pricing catalog and a deterministic Python cost engine.
python -m pip install metergraph-core Usage
Use calculate_cost() when you already have token counts:
from metergraph_core import ModelUsage, load_catalog catalog = load_catalog(region="global") result = catalog.calculate_cost( model="gpt-5.4-mini", provider="openai", at="2026-08-17T00:00:00Z", usage=ModelUsage(input_tokens=1000, output_tokens=200), ) print(result.status, result.cost, result.currency) The result identifies the applied model and price. Check status before using its cost as a complete total: missing usage or unsupported rates can make a result partial or unpriced.
Azure Foundry pricing requires a caller-declared deployment mapping with its underlying model version, SKU, and Azure resource region. Pass those facts to price_foundry_deployment() as identity={"deployment": "my-deployment", "model": "gpt-6-luna", "version": "2026-09-22", "sku": "GlobalStandard", "region": "eastus"}, with requested_deployment="my-deployment" from the request and token usage. The method checks the declared SKU and requires the requested deployment to match the mapping before applying the verified catalog rate. It does not independently verify the deployment configuration with Azure. A generic provider="azure" call stays unpriced because its deployment type is unknown. Batch and cache-write usage remain partial where the catalog lacks a matching rate.
Served OpenAI priority/fast and Vertex priority calls use model-specific catalog rates where verified. Priority coverage starts on November 22, 2026. Requested Priority that falls back to standard uses standard pricing. Search fees are priced separately from the token tier.
Choose the API for your input
For price lookup, token-only response pricing, missing-data rules, gateway billing evidence, and model metadata, see the pricing and model reference.
Serving real-time requests
Prepare catalogs once before accepting traffic. Request handlers then call catalogs.current() and use the same pricing methods shown above. Choose one of the following lifecycle options.
Let the catalog own its refresh thread
from metergraph_core import Catalogs catalogs = Catalogs(region="global", refresh_seconds=300) catalogs.start() try: print(catalogs.current().version) finally: catalogs.stop() Use your own scheduler or threads
prepare() and refresh() are synchronous and create no threads. Prepare before serving; run refreshes outside request handlers. This example schedules one refresh on an executor owned by the application:
from concurrent.futures import ThreadPoolExecutor from metergraph_core import Catalogs catalogs = Catalogs(region="global") catalogs.prepare() try: with ThreadPoolExecutor(max_workers=1) as executor: refresh = executor.submit(catalogs.refresh) print(catalogs.current().version) refresh.result() finally: catalogs.stop() Both options enable prepared-only reads. Without either option, current() loads and refreshes on demand. The default source is the bundled catalog; custom loaders can supply changing data. See the lifecycle contract for refresh failures, custom sources, read-only values, and shutdown behavior.
Reference and contributions
Pricing and model reference: loading, regional and dated prices, provider responses, retrieval fees, model families, routes, training policy, billing evidence, and reliability.
Catalog maintenance: data files and versions, official sources, reviewed deltas, refresh tooling, and provider contributions.
Core contains the shared datasets and pricing rules for Metergraph. Core does not own HTTP routes, database access, authentication, ingestion, or dashboards; these belong to the applications using it.
Released: Nov 27, 2026
Both files in this release have provenance metadata.
View provenance details
Apache-2.0 View SPDX License List
llm pricing cost token-pricing model-catalog llm-pricing model-pricing token-cost cost-calculation openai anthropic gemini bedrock openrouter vercel-ai-gateway finops
Development Status 4 - Beta
Intended Audience Developers
Operating System OS Independent
Programming Language Python :: 3
Topic Scientific/Engineering :: Artificial Intelligence
Software Development :: Libraries :: Python Modules
Release files for metergraph-core 0.9.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 271.6 kB
Release files / metergraph_core-0.9.4.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Release files / metergraph_core-0.9.4-py3-none-any.whl
Security for metergraph-core 0.9.4
Both files in this release have been uploaded with provenance metadata.
With provenance metergraph_core-0.9.4.tar.gz Nov 27, 2026
With provenance metergraph_core-0.9.4-py3-none-any.whl Nov 27, 2026
Attestation for metergraph_core-0.9.4.tar.gz
Attestation for metergraph_core-0.9.4-py3-none-any.whl
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Nov 27, 2026 2 release files Full provenance
Nov 26, 2026 2 release files Full provenance
Nov 23, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 19, 2026 2 release files Full provenance
Nov 18, 2026 2 release files Full provenance
Nov 17, 2026 2 release files Full provenance
Nov 14, 2026 2 release files Full provenance
Nov 13, 2026 2 release files Full provenance
Nov 12, 2026 2 release files Full provenance
Nov 11, 2026 2 release files Full provenance
Nov 10, 2026 2 release files Full provenance
Nov 6, 2026 2 release files Full provenance
Nov 2, 2026 2 release files Full provenance
Oct 29, 2026 2 release files Full provenance
Oct 28, 2026 2 release files Full provenance
Oct 27, 2026 2 release files Full provenance
Oct 25, 2026 2 release files Full provenance
Oct 23, 2026 2 release files Full provenance
Oct 21, 2026 2 release files Full provenance
Oct 21, 2026 2 release files Change of provenance
Oct 20, 2026 2 release files Full provenance
Oct 16, 2026 2 release files Full provenance
Oct 13, 2026 2 release files Full provenance
Oct 12, 2026 2 release files Full provenance
Oct 9, 2026 2 release files Full provenance
Oct 7, 2026 2 release files Full provenance
Oct 6, 2026 2 release files Full provenance
Sep 30, 2026 2 release files Full provenance
Sep 29, 2026 2 release files Full provenance
Sep 28, 2026 2 release files Full provenance
Sep 27, 2026 2 release files Full provenance
Sep 25, 2026 2 release files Full provenance
Sep 24, 2026 2 release files Full provenance
Sep 20, 2026 2 release files Full provenance
Sep 19, 2026 2 release files Full provenance
Sep 18, 2026 2 release files Full provenance
Sep 12, 2026 2 release files Full provenance
Sep 11, 2026 2 release files Full provenance
Sep 7, 2026 2 release files Full provenance
Sep 6, 2026 2 release files Full provenance
Sep 4, 2026 2 release files Full provenance
Sep 3, 2026 2 release files Full provenance
Sep 2, 2026 2 release files Full provenance
Sep 1, 2026 2 release files Full provenance
Aug 27, 2026 2 release files Full provenance
Aug 26, 2026 2 release files Full provenance
Aug 25, 2026 2 release files Full provenance
Aug 24, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from fc0d8e6











