SDK Examples
Call POST /run over x402 on Base, Solana, or Monad from Python, TypeScript, Agentic Wallet CLI, or MCP hosts.
Every x402 v2 SDK handles 402 -> sign -> retry automatically in a single POST call.
Pay from any runtime
pip install 'x402[evm,requests]' eth-account requestsimport os
from eth_account import Account
from x402.client import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm.exact.client import ExactEvmScheme
account = Account.from_key(os.environ["X402_BUYER_PRIVATE_KEY"])
client = x402ClientSync()
client.register("eip155:8453", ExactEvmScheme(signer=account))
session = x402_requests(client)
resp = session.post(
"https://x402.miroshark.xyz/run",
json={"prompt": "How will developers react if OpenAI releases GPT-6 next month?"},
timeout=120,
)
data = resp.json()["data"]
print("Run ID:", data["run_id"], "| follow:", data["wait_url"])