aifinpay-agent (Python)
Version 2.1.1: agent identity (EVM and Solana addresses from one seed), native
request authentication, and linking an agent to its owner's dashboard.
Python cannot pay AiFinPay merchants yet. Live AIFP-1 payments settle on the Polygon v1.4 splitter, and that executor exists only in the Node SDK (
@aifinpay/agent,fetchPaid) and the MCP server (@aifinpay/mcp,payable_fetch). To pay from a Python agent, run the MCP server or call the Node SDK. Legacy paidcall()is disabled.
Canonical domain aifinpay.io (aifinpay.company only redirects there). A
wallet address alone does not mean a payment route is enabled. The keypair is
generated locally and never leaves your process.
Install
pip install aifinpay-agent
Development setup
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt -e .
Quick start
from aifinpay.unified_agent import AiFinPayAgent
agent = AiFinPayAgent.from_seed(SEED_HEX) # 32-byte seed you keep private
print("EVM address:", agent.evm_address) # fund with POL on Polygon to pay (via MCP/Node)
Link the agent to its owner's dashboard
At https://dash.aifinpay.io → My Agents → Add agent by address the owner gets a challenge. Sign it and hand back the signature:
signature = agent.sign_dashboard_claim(challenge)
sign_dashboard_claim signs only AiFinPay-claim:polygon:<this address>:<nonce>
and refuses any other text. The owner then sees the agent's balance, payments
and receipts.
Loading an existing keypair
# from solana-keygen JSON file
agent = Agent.from_keypair_file("~/agent-wallet.json")
# from base58 secret string
agent = Agent.from_secret_b58("3RvZm7Gw...")
How x402 auth works under the hood
agent.pay(url):
- Sends the request unauthenticated.
- On
402, inspects the response and picks a facilitator adapter:- AiFinPay —
protocol: "AiFinPay vX"field in JSON body, oragreement_hash+treasury_vaultfingerprint - Coinbase x402 —
PAYMENT-REQUIREDHTTP header
- AiFinPay —
- Builds the right auth payload:
- AiFinPay → reads
x-noncefrom the 402 body (no extra round-trip), computesSHA-256("AiFinPay-x402:{nonce}:{pubkey}"), signs with Ed25519, setsx-agent-pubkey,x-nonce,x-signatureheaders - Coinbase x402 → builds a
PaymentPayload, base64-encodes, setsPAYMENT-SIGNATURE(detection and parsing only; Python does not settle)
- AiFinPay → reads
- Retries the original request with the auth attached.
The server verifies the signature and serves the resource if the agent is entitled to it. Paying for access is a separate step (see the note at the top).
Privacy
- The server never sees your private key. Period.
- Nonces are consumed on use; replay-resistant.
- All payments are public and on-chain (Polygon mainnet).
License
MIT.
Release files for aifinpay-agent 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aifinpay_agent-2.1.1.tar.gz | 49.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aifinpay_agent-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 87.0 kB
Release files / aifinpay_agent-2.1.1.tar.gz
| Download URL | aifinpay_agent-2.1.1.tar.gz |
|---|---|
| Size | 49.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc6e079190b34cacef9b0a942d1576d344eff415863ae3d9254b4b43c931b55a
|
|
BLAKE2b-256 checksum How to use checksums |
4c52620a373247472af39d6dda86dbcf631251ea424c0c879f07df6c5759656f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / aifinpay_agent-2.1.1-py3-none-any.whl
| Download URL | aifinpay_agent-2.1.1-py3-none-any.whl |
|---|---|
| Size | 37.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
877d1d6956f439d3ab100e1ed60196f65d57991d97c2ea846e557afdd3461afb
|
|
BLAKE2b-256 checksum How to use checksums |
760505e3fb6f69efa5bc706cf0748889bfee89273553d01767aab4fac67eb540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|