SDKs & Tools
Python SDK
bolthub: L402 client for AI agents in Python.
Install
pip install bolthubMinimal dependencies. Only one runtime dependency (
httpx). No other third-party packages in your supply chain.
Quick start
from bolthub import L402Client, LndWallet
wallet = LndWallet(
host="https://your-lnd-node:8080",
macaroon="0201036c6e...",
)
client = L402Client(wallet, budget_sats=10_000)
resp = client.get(
"https://acme.gw.bolthub.ai/v1/market-data",
params={"symbol": "BTC"},
)
data = resp.json()Wallet adapters
LND
from bolthub import LndWallet
wallet = LndWallet(
host="https://your-lnd-node:8080",
macaroon="admin-macaroon-hex",
timeout_seconds=30,
)LNbits
from bolthub import LnbitsWallet
wallet = LnbitsWallet(
url="https://lnbits.example.com",
admin_key="your-admin-key",
)Custom wallet
Implement the WalletAdapter protocol:
class MyWallet:
def pay_invoice(self, bolt11: str) -> str:
preimage = my_payment_logic(bolt11)
return preimageBudget guards
client = L402Client(
wallet,
max_per_request_sats=100, # reject invoices over 100 sats
budget_sats=10_000, # total spending cap
)
print(client.total_spent) # sats spent so far
print(client.remaining_budget) # sats remaining