Use 402.report from Python
Route your Python AI agents' HTTP through 402.report and wire their MCP client to your spend — LangChain, CrewAI, OpenAI Agents SDK, LlamaIndex, or any httpx/OpenAI client — with one API key.
The report402 Python SDK routes your agents' HTTP through the
402.report proxy — so every x402 (HTTP 402) challenge and payment is observed — and hands your MCP
client your spend, forensics, and preflight ("is this safe to pay?") tools. 402.report is
non-custodial: it observes, it never holds or settles funds.
1. Install
pip install report402 # core config helpers (dependency-free)
pip install "report402[http]" # + the built-in httpx ProxyClient
Set your key as REPORT402_API_KEY (create one in the dashboard).
2. Route your agent's HTTP through the proxy
Any client that takes a base_url + default headers (the OpenAI SDK, an httpx.Client, …):
from report402 import proxy_client_config
cfg = proxy_client_config(api_key="ag_...", target="https://api.example.com")
# -> {"base_url": "https://proxy.402.report",
# "headers": {"x-402report-key": "ag_...", "x-402report-target": "https://api.example.com"}}
Or the built-in client:
from report402 import ProxyClient
with ProxyClient("ag_...") as http:
r = http.get("https://api.example.com/premium") # the x402 challenge + payment are observed
LangChain · CrewAI · OpenAI Agents SDK · LlamaIndex: point the agent's tool HTTP at the proxy —
wrap calls in ProxyClient, or pass proxy_client_config(...)'s base_url + headers to whatever
httpx/OpenAI client the tool uses. Nothing else in your agent changes.
3. Give the agent its spend as MCP tools
from report402 import mcp_http_config, mcp_client_json
mcp_http_config("ag_...") # {"url": ".../mcp", "headers": {"Authorization": "Bearer ag_..."}}
mcp_client_json("ag_...") # a full {"mcpServers": {...}} block for Claude Desktop / Cursor / VS Code
Hand mcp_http_config(...) to the official mcp Streamable-HTTP
client. The tools are read-only — spend summaries, per-domain/agent breakdowns, forensics, and the
preflight check_endpoint / check_payee safety checks.
4. (Optional) present an agent identity
If your agent carries a verifiable identity (a DID, name, or attestation), present it and the proxy relays it to origins for fine-grained attribution — 402.report consumes identity, it never issues it:
proxy_client_config("ag_...", target="https://api.example.com", agent="did:example:my-bot")
ProxyClient("ag_...", agent="did:example:my-bot")