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==1.0.0 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.0

Python 3.12, 3.13, and 3.14 are supported. Runtime Meridian and Usage dependencies are pinned to their compatible 1.0.0 releases.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meridian_plugin_cost-1.0.0.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meridian_plugin_cost-1.0.0-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file meridian_plugin_cost-1.0.0.tar.gz.

File metadata

  • Download URL: meridian_plugin_cost-1.0.0.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for meridian_plugin_cost-1.0.0.tar.gz
Algorithm Hash digest
SHA256 db89a7426221d64d70f141cb3beb062f461370b99d6397969471b6c5bbe6ebb8
MD5 e91a27d9d54acfa730e9dbd4a9dd1f10
BLAKE2b-256 b0bf0d235ac9a7c53b63062e740624f7cec3a908d8487abb9b46e50e0d5ce147

See more details on using hashes here.

Provenance

The following attestation bundles were made for meridian_plugin_cost-1.0.0.tar.gz:

Publisher: release.yml on zephytiju/MeridianPluginCost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file meridian_plugin_cost-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for meridian_plugin_cost-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e86890490b0cd3dd924221bf715fc14967146e122968d2fa4f3b9fdfb99bd47
MD5 3e5765b70c9ed30a130a6aa0b8e0205b
BLAKE2b-256 9c7ee443d5e656745c9c985b2ecd9a10ca65d31e107a756453517e9710b2bcde

See more details on using hashes here.

Provenance

The following attestation bundles were made for meridian_plugin_cost-1.0.0-py3-none-any.whl:

Publisher: release.yml on zephytiju/MeridianPluginCost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page