← Back to SDK Overview
⚠️ The old minia2a-py 0.1.0 pip package is deprecated. It implemented the pre-V5 flow — auto-generated wallets, register granting 500 credits, and 15 per-IP trial calls. None of that exists on the server anymore. This page now documents the live way to call minia2a from Python: plain eth-account + requests. An official Python pay client is on the roadmap — until then the free-trial code below is verified working, and for paid calls use the TypeScript client/CLI or the on-chain txHash path.
🐍 Python 3.9+

minia2a from Python

Call 1,600+ pay-per-call APIs — gas, token security, web scrape, CAPTCHA, EU briefs.
No API key, no registration, no credits. 5 free trials per signed wallet, then USDC per call.

pip install eth-account requests # that's it — no minia2a package needed

⚡ Free trial call (verified)

Any wallet — even one with no funds — gets 5 free trial calls by signing an EIP-191 message. No registration. (This exact script, run against a fresh wallet, returned HTTP 200 with 4 trials remaining.)

# pip install eth-account requests
import time, requests
from eth_account import Account
from eth_account.messages import encode_defunct

acct = Account.from_key(PRIVATE_KEY)                  # your EVM private key (Base)
ts = int(time.time())
msg = f"minia2a trial:{acct.address}:x402-time:{ts}"  # service id keeps its x402- prefix
sig = acct.sign_message(encode_defunct(text=msg)).signature.hex()

r = requests.get("https://minia2a.uk/x402/time", params={"wallet": acct.address},
    headers={"X-Wallet-Signature": "0x"+sig, "X-Trial-Timestamp": str(ts)})
print(r.status_code, r.json())                        # 200; header X-Trial-Remaining: 4

Discovery & schemas are free and unauthenticated: POST /x402/find with {"q":"captcha solve"} searches the catalog; full schemas at /openapi.json. (Registry ids keep the x402- prefix — e.g. x402-time, x402-token-security.)

💸 Pay per call (USDC on Base)

After free trials, the endpoint answers HTTP 402 with a machine-readable offer (accepts[0]: amount, asset = USDC on Base, payTo). Two ways to settle from Python:

# (A) via the official TS client / CLI (npm pkg minia2a-client) — call it from a thin shell wrapper:
npm i -g minia2a-client && MINIA2A_PRIVATE_KEY=$PRIVATE_KEY minia2a call web-scrape '{"url":"https://example.com"}'

# (B) on-chain path: send USDC straight to payTo, then retry with the tx hash.
#   POST /x402/web-scrape  with  header: X-Payment-Tx: <txhash>
#   (platform verifies the on-chain USDC transfer on Base >= the offer amount)

An official Python client that signs the facilitator (permit2) path automatically is in progress. Watch the SDK overview for release.

🤖 LangChain / CrewAI integration

# Wire minia2a into LangChain tools (trial path; swap the helper for a paid one when the official client lands)
from langchain.agents import Tool
import time, requests
from eth_account import Account
from eth_account.messages import encode_defunct

ACCT = Account.from_key(PRIVATE_KEY)

def call(service, **params):
    ts = int(time.time())
    msg = f"minia2a trial:{ACCT.address}:{service}:{ts}"
    sig = ACCT.sign_message(encode_defunct(text=msg)).signature.hex()
    r = requests.post(f"https://minia2a.uk/x402/{service.replace('x402-','')}",
                      json={"wallet": ACCT.address, **params},
                      headers={"X-Wallet-Signature": "0x"+sig, "X-Trial-Timestamp": str(ts)})
    return r.json()

tools = [
    Tool(name="gas_price", func=lambda _: call("x402-gas"),
         description="Get current gas price"),
    Tool(name="token_check", func=lambda addr: call("x402-token-security", token=addr),
         description="Security-check a token address"),
    Tool(name="web_data", func=lambda url: call("x402-web-scrape", url=url),
         description="Scrape a webpage to clean text"),
]

📦 Notes

Dependencieseth-account + requests — nothing else
WalletYour own Base EVM key. The platform never sees it — only your signature.
Trials5 per signed wallet (no registration).
RegistrationOnly for publishing your own services — grants no credits. See Register.
Legacy pip packageminia2a-0.1.0.tar.gz — deprecated, pre-V5 semantics.

minia2a.uk · SDK · x402 protocol · Task index · Live Stats