The 2sio Python SDK handles the entire x402 probe → sign → retry loop, so calling a paid API is one method call. Here is the whole thing.
Install the SDK, put an EVM wallet key in your environment, and call any endpoint. The SDK probes, signs the USDC payment, retries, and returns the data:
# pip install 2sio
import os
from twosio import TwoS
client = TwoS(private_key=os.environ["EVM_PRIVATE_KEY"])
res = client.weather.zip(zip="94103")
print(res.data) # real forecast
print(res.cost_usd) # USDC charged
print((res.settlement or {}).get("tx_hash"))Pass trial=True to make a free real call (one per endpoint per hour) — handy in tests or to verify a response shape before funding a wallet:
from twosio import TwoS # No key, no wallet needed for a trial call: client = TwoS(trial=True) res = client.validate.iban(iban="GB82WEST12345698765432") print(res.data) # real validation result, marked meta.trial
To settle on Solana instead of Base, install the Solana extra and pass a Solana key. Same method calls, different rail:
pip install "2sio[svm]"
Call a live x402 API right now — no signup.
Browse the full endpoint directory, grab the quickstart, or read the llms.txt manifest. Every endpoint is keyless and pay-per-call.