Skip to main content

payagentic

Build AI agents that buy paid API data with programmable stablecoin wallets and spend-policy controls on supported USDC and USDT rails. PayAgentic SDKs connect your server to the gateway; the platform's subscriptions and transaction charges are separate from the SDK's MIT license.

Developer home · Runnable buyer + merchant example · SDK reference · Pricing · Integration support

Start with a working example

Download the local API commerce demo. It includes both sides, installation instructions, expected output and automated tests. Node.js 22+ runs the demo, including for Python and Go developers who want to inspect the HTTP payment exchange. It uses simulated authorization, moves no funds, and does not validate settlement.

For your own integration, use the quickstart, finish asynchronous wallet provisioning, and configure a test API key, gateway URL and wallet ID. The key belongs in your server environment, never browser code. Registered merchant origin and endpoint setup is required to exercise the platform transaction fee flow.

These are pre-1.0 SDKs. A source checkout may be newer than the published package; pin and test a release before upgrading. See the registry's release history for available versions.

Install

Version 0.1.1 includes the runtime dependencies missing from 0.1.0. Pin the version below for a reproducible installation. If it is not yet available in the registry, use the source-built package in the downloadable example.

pip install payagentic==0.1.1
# or
uv add payagentic==0.1.1
poetry add payagentic==0.1.1

Requires Python 3.13+.

Usage

Sync

import os
from payagentic import PayAgentic

client = PayAgentic(
    api_key=os.environ["PAYAGENTIC_API_KEY"],
    base_url=os.environ["PAYAGENTIC_BASE_URL"],
    x402_wallet_id=os.environ["PAYAGENTIC_WALLET_ID"],
)
# Or from env: PAYAGENTIC_API_KEY, PAYAGENTIC_AGENT_ID, PAYAGENTIC_BASE_URL

wallets = client.wallets.list_wallets()

# x402 paywall walker
response = client.x402.fetch(os.environ["PAYAGENTIC_RESOURCE_URL"])

Async

import os
from payagentic import AsyncPayAgentic

# Inside your async function:
async with AsyncPayAgentic(
    api_key=os.environ["PAYAGENTIC_API_KEY"],
    base_url=os.environ["PAYAGENTIC_BASE_URL"],
    x402_wallet_id=os.environ["PAYAGENTIC_WALLET_ID"],
) as client:
    wallets = await client.wallets.list_wallets()
    response = await client.x402.fetch(os.environ["PAYAGENTIC_RESOURCE_URL"])

Typed errors

Non-2xx responses raise typed exceptions you can catch by type:

from payagentic import PayAgentic, UnauthorizedError, RateLimitError, ValidationError

try:
    client.wallets.list_wallets()
except UnauthorizedError:
    ...
except RateLimitError:
    ...

Full hierarchy: PayAgenticError → {Conflict, Forbidden, Internal, Network, NotFound, RateLimit, ServiceUnavailable, Unauthorized, Validation}Error. Use payagentic.is_retryable(err) for retry classification.

Mandate signer

from payagentic import LocalMandateSigner

signer = LocalMandateSigner.from_pem("path/to/key.pem")
mandate = signer.sign({...})

Pydantic models

All request/response shapes are Pydantic v2 models, re-exported under payagentic.models:

from payagentic.models import Wallet, PaymentResponse, MandateListItem

Generated transport

The HTTP transport in src/payagentic/_generated/ is generated by openapi-python-client from the gateway's OpenAPI spec at ../../api/openapi.json. Regenerate with the monorepo's just gen-sdk-py.

src/payagentic/_generated/ is marked linguist-generated=true. Don't edit those files directly — modify the gateway's #[utoipa::path] annotations + regenerate.

Development (from the monorepo)

just gen-sdk-py    # regenerate from api/openapi.json
cd sdks/python
uv run pytest
uv run mypy src/payagentic
uv run ruff check src tests
uv build

Publishing

just release-py 0.1.1   # bumps version, builds, uv publish, tags

Needs PyPI API token in ~/.config/uv/credentials.toml or UV_PUBLISH_TOKEN env.

License

MIT

Metadata

Release files for payagentic 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for payagentic 0.1.1
File Size Uploaded Provenance Actions
payagentic-0.1.1.tar.gz 199.9 kB Without provenance Details for payagentic-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for payagentic 0.1.1
File Interpreter ABI Platform Actions
payagentic-0.1.1-py3-none-any.whl Python 3 none any Details for payagentic-0.1.1-py3-none-any.whl

Total release size: 670.5 kB

Release files / payagentic-0.1.1.tar.gz

Download URL payagentic-0.1.1.tar.gz
Size 199.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d832d4689fe69f7920966e0d6e2c4ff48c7d720ce1f46683b10a7b6abd7fd64
BLAKE2b-256 checksum
How to use checksums
80da58697879b168e336ae8b1ee59e889058cf156466fd134db8abc0f6b6f6cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / payagentic-0.1.1-py3-none-any.whl

Download URL payagentic-0.1.1-py3-none-any.whl
Size 470.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c469e25ecaa05ae9031cb164a2d285bf39c4da172833d482945cad225d8d3a7e
BLAKE2b-256 checksum
How to use checksums
da51be2eb91cc9d2b3ad157e386ba9093e002efdaeb2973a79c145e329fefbec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Security for payagentic 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page