Buyer-Side Local Proxy

One small file, run on your machine. Your agents and frameworks call http://127.0.0.1:8787/<endpoint> — plain HTTP, no x402 code anywhere in your stack — and the proxy forwards each call to the fleet, signing the payment itself when an endpoint answers 402. Free-trial calls pass straight through and cost nothing. Your key stays on your machine: it is read from an environment variable, never stored, never logged, never sent to us (only the signature on your own payment leaves the machine, exactly as in any x402 client).

Install & run (2 minutes)

curl -O https://api.mekongtradeintel.com/tools/mekong-proxy.py
pip install requests eth-account   # only needed for PAID calls;
                                   # trial forwarding is stdlib-only
export X402_PAYER_KEY=0x...        # your Base wallet key (holds a little USDC on Base)
python3 mekong-proxy.py            # listens on 127.0.0.1:8787

# call any fleet endpoint through it:
curl -X POST http://127.0.0.1:8787/tokenprice \
     -H 'Content-Type: application/json' -d '{"ticker":"ETH"}'
curl http://127.0.0.1:8787/catalogue   # all slugs + live prices
curl http://127.0.0.1:8787/health      # payer, cap, catalogue size

No key? Leave X402_PAYER_KEY unset: the proxy runs in trial-only mode — trial-served calls work, and 402 responses come back untouched so you can see exactly what a paid call would cost before funding anything.

Use it from a framework

Register the local URL as the tool/API endpoint — the framework never learns x402 exists:

# LangChain / CrewAI / OpenAI SDK / anything HTTP:
#   tool URL = http://127.0.0.1:8787/tokenprice   (POST {"ticker": "ETH"})
#   tool URL = http://127.0.0.1:8787/brief        (POST {"topic": "bitcoin"})
#   tool URL = http://127.0.0.1:8787/websearch    (POST {"query": "..."})
# Full slug list + live prices: GET http://127.0.0.1:8787/catalogue
# Find the right slug for a job: https://api.mekongtradeintel.com/tools/endpoint-search.html

Configuration

Env varDefaultWhat it does
X402_PAYER_KEY—Your payer wallet key. Env only, never stored or logged.
MEKONG_PROXY_PORT8787Local listen port.
MEKONG_PROXY_HOST127.0.0.1Listen host. Keep it on localhost — the proxy can spend your money.
X402_DAILY_CAP_USD1.00Daily spend cap (UTC). The proxy blocks BEFORE signing once a payment would pass the cap; every paid attempt counts at list price in ./mekong-proxy-ledger.json.
MEKONG_API_BASEhttps://api.mekongtradeintel.comFleet base URL (rarely changed).

How payment works

The proxy uses the same proven payment core as the fleet's code generator and framework snippets: forward → on HTTP 402 parse the PAYMENT-REQUIRED header → sign an EIP-712 TransferWithAuthorization (USD Coin domain, chainId 8453, USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) → retry once with the Payment-Signature header. Settlement is on Base via the CDP facilitator; the facilitator pays gas, your wallet pays only the call price to 0x198f3895551B309fF5C5F59e690FB0823d10EA93. Responses carry an X-Mekong-Proxy header stating what was paid.

Scope, honestly: this is a minimal single-file proxy for THIS fleet (catalogue + payment requirements come from the fleet itself, live). It is not a general x402 gateway, it holds no accounts, and it does not retry failed payments. Machine-readable summary: GET /clinic/proxy-info. Prefer not to run anything? The credit pack path needs no local code at all. Fleet status: status broadcast.