Python SDK for pay -- payment infrastructure for AI agents
Project description
pay-skill
Python SDK for pay -- payment infrastructure for AI agents. USDC on Base.
Install
pip install pay-skill
Optional keychain support (reads key stored by pay CLI):
pip install pay-skill[keychain]
Requires Python 3.10+.
Quick Start
from payskill import Wallet
wallet = Wallet.create() # OS keychain (same key as CLI)
# Pay another agent $5
result = wallet.send("0xprovider...", 5.0, memo="task-42")
print(result.tx_hash)
# Open a metered tab
tab = wallet.open_tab("0xprovider...", 20.0, max_charge_per_call=0.50)
# x402 request (SDK handles payment automatically)
response = wallet.request("https://api.example.com/data")
print(response.json())
Wallet Initialization
# OS keychain (recommended -- same key as CLI)
wallet = Wallet.create()
# Environment variable (CI/containers)
wallet = Wallet() # reads PAYSKILL_KEY env var
# Explicit key (testing only)
wallet = Wallet(private_key="0x...")
# Env var only
wallet = Wallet.from_env()
# Testnet
wallet = Wallet(testnet=True)
# or set PAYSKILL_TESTNET=1
Amounts
All amounts are in dollars by default. Use {"micro": int} for micro-USDC precision:
wallet.send("0x...", 5.0) # $5.00
wallet.send("0x...", {"micro": 5000000}) # $5.00 (micro-USDC)
wallet.open_tab("0x...", 20.0, 0.10) # $20 tab, $0.10/call max
All Methods
# Direct payment
result = wallet.send(to, amount, memo?)
# Tabs
tab = wallet.open_tab(provider, amount, max_charge_per_call)
tab = wallet.close_tab(tab_id)
tab = wallet.top_up_tab(tab_id, amount)
tabs = wallet.list_tabs()
tab = wallet.get_tab(tab_id)
charge = wallet.charge_tab(tab_id, amount)
# x402 paid HTTP
response = wallet.request(url, method=, body=, headers=)
# Wallet
bal = wallet.balance() # Balance(total, locked, available)
st = wallet.status() # Status(address, balance, open_tabs)
# Discovery (no auth needed)
services = wallet.discover("weather")
# or standalone:
from payskill import discover
services = discover("weather")
# Funding
url = wallet.create_fund_link(message="Need funds")
url = wallet.create_withdraw_link()
# Webhooks
wh = wallet.register_webhook(url, events=["payment.completed"])
webhooks = wallet.list_webhooks()
wallet.delete_webhook(webhook_id)
# Testnet
result = wallet.mint(100) # mint $100 testnet USDC
Error Handling
from payskill import (
PayError,
PayValidationError,
PayNetworkError,
PayServerError,
PayInsufficientFundsError,
)
try:
wallet.send("0x...", 5.0)
except PayInsufficientFundsError as e:
print(e.balance, e.required)
url = wallet.create_fund_link(message="Need funds")
except PayValidationError as e:
print(e.field) # which field failed
except PayServerError as e:
print(e.status_code)
except PayNetworkError:
print("Server unreachable")
OWS (Open Wallet Standard)
pip install pay-skill[ows]
wallet = Wallet.from_ows(wallet_id="my-agent")
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pay_skill-0.2.4.tar.gz.
File metadata
- Download URL: pay_skill-0.2.4.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aac6782a54354259e752fc734ef6a4cd1724ae64a93db103f50b543dac56f634
|
|
| MD5 |
2b5f8b88c4ea51a7371e7142508a3bed
|
|
| BLAKE2b-256 |
243eeacfdc238beac9632c900f9046022e3af0cbaedc69a31b042ae377234cf3
|
Provenance
The following attestation bundles were made for pay_skill-0.2.4.tar.gz:
Publisher:
release.yml on pay-skill/pay-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pay_skill-0.2.4.tar.gz -
Subject digest:
aac6782a54354259e752fc734ef6a4cd1724ae64a93db103f50b543dac56f634 - Sigstore transparency entry: 1323529104
- Sigstore integration time:
-
Permalink:
pay-skill/pay-sdk@5ba8b07052afd0407da932174c42cf48f95a44d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pay-skill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ba8b07052afd0407da932174c42cf48f95a44d1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pay_skill-0.2.4-py3-none-any.whl.
File metadata
- Download URL: pay_skill-0.2.4-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a40ce1c3694e61bbc88be5863f791e3c1ce4ff056909b1a2b8f1f4412b3d9a0e
|
|
| MD5 |
238dfa857699ed7c42bf9d3d5b4d4531
|
|
| BLAKE2b-256 |
927c590ee3c198ff0496f33f47aaa1826cea59f5e4df59df2b974b0e815097ea
|
Provenance
The following attestation bundles were made for pay_skill-0.2.4-py3-none-any.whl:
Publisher:
release.yml on pay-skill/pay-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pay_skill-0.2.4-py3-none-any.whl -
Subject digest:
a40ce1c3694e61bbc88be5863f791e3c1ce4ff056909b1a2b8f1f4412b3d9a0e - Sigstore transparency entry: 1323529151
- Sigstore integration time:
-
Permalink:
pay-skill/pay-sdk@5ba8b07052afd0407da932174c42cf48f95a44d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pay-skill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ba8b07052afd0407da932174c42cf48f95a44d1 -
Trigger Event:
workflow_dispatch
-
Statement type: