Skip to main content

meridian-plugin-cost

Meridian V1's open-source Cost plugin provides immutable rate cards, exact Decimal pricing, deterministic allocation, versioned calculations, cost records, and reproducible explanations over logical Meridian Resources.

This distribution is a Python library and Meridian plugin. It is not a service, a Cost Catalog, or an owner of a product-private database. It never opens Usage storage: normalized aggregates are obtained through the released meridian-plugin-usage==2.0.1 public API. Cost data targets distinct structured/cost/* Resources; deployment IaC owns their physical placement and keeps Usage and Cost storage isolated.

Install

python -m pip install meridian-plugin-cost==1.0.1

Python 3.12, 3.13, and 3.14 are supported. Runtime Meridian dependencies remain pinned to their compatible 1.0.0 releases, while the official Usage distribution is pinned to 1.0.2.

Define and publish a rate card

from datetime import UTC, datetime
from decimal import Decimal

from meridian_storage.plugins.cost import (
    CostRepository,
    PricingModel,
    PublicationState,
    RateCardV1,
    RoundingPolicy,
)

cost = CostRepository(ready_meridian)
draft = RateCardV1(
    rate_card_id="cloud.api.requests",
    version=1,
    revision=1,
    provider="example-cloud",
    product="api",
    meter_id="api.requests",
    meter_version=1,
    currency="USD",
    effective_start=datetime(2026, 1, 1, tzinfo=UTC),
    effective_end=datetime(2027, 1, 1, tzinfo=UTC),
    pricing_model=PricingModel.FLAT_UNIT,
    unit_price=Decimal("0.0025"),
    rounding=RoundingPolicy(currency_scale=2, intermediate_scale=8),
    state=PublicationState.DRAFT,
    created_at=datetime(2026, 8, 26, tzinfo=UTC),
    provenance={"source": "provider-rate-sheet-2026"},
)
cost.create_rate_card(draft)
validated = cost.validate_rate_card(draft.rate_card_id, 1, expected_revision=1)
published = cost.publish_rate_card(
    draft.rate_card_id,
    1,
    expected_revision=validated.revision,
)

Lifecycle changes append immutable snapshots. Draft pricing can be replaced with optimistic revision checks; once validated, pricing is frozen. A correction uses a new rate-card version and an explicit supersession reference. Physical deletion is deliberately unsupported; retirement is the V1 delete semantic.

Calculate from released Usage aggregates

from meridian_storage.plugins.cost import CostCalculator, RepositoryUsageProvider

usage_provider = RepositoryUsageProvider(released_usage.repository)
calculator = CostCalculator(usage_provider, cost)
result = calculator.calculate(
    scope={"tenant": "acme", "environment": "prod"},
    start=start,
    end=end,
    rate_card=published.ref,
    occurred_at=end,
)

The calculation requires closed Usage aggregates and records their exact aggregate versions, fingerprints, rate-card fingerprint, allocation fingerprint, calculator version, Decimal rounding stages, explanation tree, and supersession chain. Identical inputs replay the existing result; changed inputs create a new calculation revision.

Contracts and evidence

The wheel ships Cost Schemas, plugin/schema-provider entry points, a Usage compatibility matrix, locked design revisions, JSON Schema compatibility evidence, and deterministic golden values. Optional MeridianEvidenceSink emits audit and lineage records through the registered evidence Catalog public Expression surface.

See architecture, rate cards, calculation, integration, and conformance.

Licensed under the Apache License, Version 2.0.

See compatibility evidence and current release gate.

Metadata

Release files for meridian-plugin-cost 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meridian-plugin-cost 2.0.0
File Size Uploaded
meridian_plugin_cost-2.0.0.tar.gz 64.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for meridian-plugin-cost 2.0.0
File Interpreter ABI Platform
meridian_plugin_cost-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 108.3 kB

Release files / meridian_plugin_cost-2.0.0.tar.gz

Download URL meridian_plugin_cost-2.0.0.tar.gz
Size 64.6 kB
Tags Source
SHA-256 checksum
How to use checksums
343ce9afbdd2b846772423e8b694540fe0c42e79f1f551605ae49688be85f3ce
BLAKE2b-256 checksum
How to use checksums
924e63582ad434bfd6e04ecde54d3e74d9087a886683ce405440f2816a88656a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

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 Sep 7, 2026.

Transparency log

Release files / meridian_plugin_cost-2.0.0-py3-none-any.whl

Download URL meridian_plugin_cost-2.0.0-py3-none-any.whl
Size 43.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3029692b7b3b40ece6645a9dfe7d101e7faa4911f98a2ff571d19f163a7b1e7
BLAKE2b-256 checksum
How to use checksums
466f7f0873282079348004bd651df1d4995139bc744860d31688556a1b329853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

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 Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.1

2 release files

This release

2.0.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page