skillfed

metronome-sdk

The official Python library for the metronome API

metronome-sdk v4.10.0 492.3K downloads/30d#6,361 on PyPI4
Permissive license Apache-2.0 Active released

What it is and what it does

Metronome SDK is the official Python client for the Metronome billing and usage API. It wraps the REST API with full type annotations (TypedDicts for requests, Pydantic models for responses), offering both synchronous and asynchronous clients powered by httpx. The library handles authentication via bearer token, provides auto-paginating iterators for list endpoints, and includes error handling for connection and API status issues.

Typical use is ingesting usage events (with transaction IDs, customer IDs, timestamps, and custom properties), querying contracts and products, and managing billing configurations. The async client can optionally use aiohttp as its HTTP backend for improved concurrency. All responses include helper methods for JSON serialization and dictionary conversion, and the library supports modern Python versions from 3.9 onward.

Use it for:

  • Ingest usage events (CPU seconds, API calls, storage) into Metronome for billing calculations.
  • Query contracts and products with automatic pagination across result sets.
  • Build billing integrations in async applications using AsyncMetronome with httpx or aiohttp.
  • Manage customer billing configurations and retrieve typed responses with IDE autocomplete.
  • Handle API errors gracefully with specific exception types for connection and status failures.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Python client library for the Metronome REST API with full type definitions, supporting both synchronous and asynchronous operations via httpx.

Yes. This is the official, actively maintained SDK for a billing platform API, with low install friction, permissive licensing, no known vulnerabilities, and comprehensive type support. Install it if you need to integrate with Metronome's usage ingestion or billing APIs from Python.

Install

metronome-sdk on PyPI

pip

pip install metronome-sdk

uv

uv add metronome-sdk

poetry

poetry add metronome-sdk

Installing metronome-sdk

Before you install

Low install friction with a pure-Python wheel. Actively maintained with a recent release 22 days ago. Supports modern Python versions (3.9 through 3.14) and declares all dependencies explicitly.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most production environments.

Quickstart

pip install metronome-sdk

import os
from metronome import Metronome

client = Metronome(
    bearer_token=os.environ.get("METRONOME_BEARER_TOKEN")
)

client.v1.usage.ingest(
    usage=[{
        "transaction_id": "90e9401f-0f8c-4cd3-9a9f-d6beb56d8d72",
        "customer_id": "team@example.com",
        "event_type": "heartbeat",
        "timestamp": "2024-01-01T00:00:00Z",
        "properties": {"cpu_seconds": 60}
    }]
)

Requires METRONOME_BEARER_TOKEN environment variable or explicit bearer_token parameter to authenticate with the Metronome API.

Verify before relying

  • Whether the library's auto-pagination handles all edge cases and rate-limit scenarios correctly.
  • Performance characteristics when ingesting high-volume usage events or handling large paginated responses.
  • Stability and feature completeness of the MCP Server integration mentioned in the description.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 6 — anyio, distro, httpx, pydantic, sniffio, typing-extensions
Maintenance actively maintained — 22 days since the last release
Last repo commit
First released
Downloads 492,267/month — #6,361 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: metronome_sdk-4.10.0-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

metronome api clientpython billing apiusage ingestion sdkasync http clienttyped rest api wrappermetronome python libraryapi client with types
billing-apiasync-httptyped-client

More Python Modules packages