The Metronome SDK is the official Python library for interacting with the Metronome API, designed for integrating metered billing and usage-based pricing into applications. It provides access to endpoints for managing customers, contracts, usage, invoices, and more. The library is currently at version 4.4.0 and follows a rapid release cadence with frequent updates and bug fixes.
pip install metronome-sdkVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the Metronome client using an API key from an environment variable and then demonstrates listing existing customers and creating a new one. Ensure you have a `METRONOME_API_KEY` environment variable set with your actual Metronome API key for successful API calls.
Remove `minimum_config` from any Rate or Override objects in your API requests (e.g., when creating/editing contracts, plans, or prices). Review your contract and pricing configurations.
Remove `priority` from any parameters sent when creating or updating contracts, and adjust code that expects `priority` in contract responses.
Update your API calls and data models to no longer include or expect the `use_list_prices` field on Rate objects, particularly when defining or updating pricing plans.
When calling the preview events API, ensure you are no longer passing `customer_id` as a request parameter.
If your code assumes a single invoice object from the Preview Events API, update it to iterate over the returned list of invoices, even if it expects only one.
Update calls to affected list endpoints (e.g., `client.customers.list()`) to correctly handle pagination by checking `response.next_page` and `response.items` for results. Direct access to `.items` will only provide the current page's results.