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.2,<3 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==2.0.1

Python 3.12, 3.13, and 3.14 are supported. Runtime Meridian dependencies use compatible public API ranges with Core >=1.1.0,<2 and Usage >=2.0.2,<3. Exact release-validation selections and artifact hashes live in requirements/validation.lock.

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.1

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.1
File Size Uploaded
meridian_plugin_cost-2.0.1.tar.gz 122.9 kB Details

Built distribution (wheel)

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

Total release size: 166.7 kB

Release files / meridian_plugin_cost-2.0.1.tar.gz

Download URL meridian_plugin_cost-2.0.1.tar.gz
Size 122.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cba361bc00d08fe5580ccc1d51e5a703da92bc92c540ed83919fc4b64b5f7c70
BLAKE2b-256 checksum
How to use checksums
de8f9abb4bae7f67fab5b4a439cafafe8ebd5badda9ec1a2219f4802d25cf7aa
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 8, 2026.

Transparency log

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

Download URL meridian_plugin_cost-2.0.1-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0badb46427754ce2002cb30cbfded7b5c0c4f26ff96a99d50b0c9f970f3f9f04
BLAKE2b-256 checksum
How to use checksums
5effe4e78ca2fde7e6c070da388d0e39e777258b6fbd13afa324fbebafed9a28
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 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

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