modern-treasury
The official Python library for the Modern Treasury API
What it is and what it does
Modern Treasury is the official Python SDK for the Modern Treasury REST API, a financial operations platform. It wraps HTTP calls to manage counterparties, external accounts, payments, and other treasury functions, offering both sync and async clients powered by httpx. The library includes full type hints (TypedDict for requests, Pydantic models for responses) and auto-paginating iterators for list endpoints, so you can work with typed data and let the SDK handle pagination automatically.
The package is designed for Python 3.9+ applications that need to integrate with Modern Treasury's API. It requires credentials (organization_id and api_key) passed as environment variables or constructor arguments. Dependencies are lightweight and standard (httpx for HTTP, pydantic for validation, anyio and sniffio for async support). The library handles error cases with specific exception types (APIConnectionError, RateLimitError, APIStatusError) and supports file uploads via bytes or PathLike objects.
Use it for:
- Create and manage counterparties (vendors, customers) in a financial system programmatically.
- Build async payment processing workflows that fetch and process paginated lists of transactions.
- Integrate treasury operations (external accounts, payments) into a Python web application or backend service.
- Automate document uploads associated with financial entities using the file upload interface.
- Handle API errors gracefully with typed exception classes for connection, rate limit, and status errors.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a typed Python client library for the Modern Treasury REST API, with both synchronous and asynchronous interfaces for managing financial operations like counterparties and external accounts.
Yes. This is the official SDK for Modern Treasury's API, actively maintained with no known vulnerabilities, low install friction, and permissive licensing. Install it if you need to integrate with Modern Treasury in Python 3.9+. The typed interface and async support make it suitable for both simple scripts and production services.
Install
modern-treasury on PyPI
pip
pip install modern-treasuryuv
uv add modern-treasurypoetry
poetry add modern-treasuryInstalling modern-treasury
Before you install
Low friction: pure Python wheel with six common dependencies (httpx, pydantic, anyio, distro, sniffio, typing-extensions). Actively maintained—last commit 2026-08-13, released 2026-07-27, no known vulnerabilities.
License in practice
MIT license (permissive): you can use, modify, and distribute this library freely in commercial and private projects, with minimal restrictions.
Quickstart
pip install modern-treasury
import os
from modern_treasury import ModernTreasury
client = ModernTreasury(
organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"),
api_key=os.environ.get("MODERN_TREASURY_API_KEY"),
)
counterparty = client.counterparties.create(name="my first counterparty")
print(counterparty.id)
Requires Python 3.9 or later; API credentials (organization_id and api_key) must be set via environment variables.
Verify before relying
- Whether aiohttp backend option (mentioned in docs) is included in the base install or requires a separate extra.
- Rate limiting and retry behavior specifics beyond the error types documented.
- File upload streaming behavior and memory footprint for large files.
Package facts
| License | MIT (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 — 18 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 635,814/month — #5,633 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: modern_treasury-1.79.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
metronome-sdkProvides a Python client library for the…
permissive · top 15,000 on PyPI
openlayerProvides a typed Python client for the…
permissive · top 15,000 on PyPI
dodopaymentsProvides a Python client library for the Dodo…
permissive · top 15,000 on PyPI
conductor-pyA typed Python client for the Conductor API…
permissive · top 15,000 on PyPI
lithicProvides a typed Python client for the Lithic…
permissive · top 15,000 on PyPI
telnyxProvides a Python client library for the Telnyx…
permissive · top 15,000 on PyPI
letta-clientProvides a Python client library for the Letta…
permissive · top 15,000 on PyPI
composio-clientA Python client library for the Composio REST…
permissive · top 5,000 on PyPI
prelude-python-sdkProvides a typed Python client for the Prelude…
permissive · top 5,000 on PyPI
orb-billingA Python client library for the Orb billing…
permissive · top 5,000 on PyPI