--- id: metronome-sdk version: "4.10.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # metronome-sdk — The official Python library for the metronome API License: permissive · Maintenance: active · Downloads: 492.3K/mo ## 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 above — 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 pip install metronome-sdk uv add metronome-sdk 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_current - Install friction: low - Maintenance: active - Downloads: 492.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags metronome api client, python billing api, usage ingestion sdk, async http client, typed rest api wrapper, metronome python library, api client with types, billing-api, async-http, typed-client [View on SkillFed](https://skillfed.io/packages/metronome-sdk) · [View on PyPI](https://pypi.org/project/metronome-sdk/)