Build / Crypto
Pay-per-call agent (x402)
A bot that pays for its own API calls in USDC on Base. No signup, no key.

What it does
A script that calls the API with no key. The server answers 402 Payment Required with an x402 offer. Your agent signs a USDC payment on Base from its own wallet and retries. The first payment settles immediately, later small calls accrue to a $1.00 tab. Payment terms are at /.well-known/x402.json. Proven with the official Python x402 v2 client.
- Never paste a wallet private key into code. Load it from a secret store.
- Fund the wallet with only what the agent should spend.
GetFixn sells data, not trading advice. Nothing here is investment advice. Forecasts can be wrong. You are responsible for your own strategies and for following the rules of any exchange or market you use. No profit, return or accuracy is promised, and nothing on this page shows trading results.
API calls
Set your key once: export TFX_KEY=tfx_live_.... Free previews need no key.
Discover payment terms
curl https://data.truefixr.com/.well-known/x402.json
Call with no key, expect 402
curl -i "https://data.truefixr.com/v1/data?dataset=address&lat=32.78&lon=-96.80"
Code (Python)
Cut down on purpose. Print the real response keys on your first call before you map fields.
import os
import requests
URL = "https://data.truefixr.com/v1/data"
PARAMS = {"dataset": "address", "lat": 32.78, "lon": -96.80}
def sign_payment(offer: dict) -> dict:
"""Use the official x402 client with your own wallet to build the payment header
from the offer. Left as a stub here: follow the x402 client docs for your language."""
raise NotImplementedError
def call():
r = requests.get(URL, params=PARAMS, timeout=60)
if r.status_code == 402:
offer = r.json() # the x402 offer: asset USDC, network Base, amount, payTo
headers = sign_payment(offer)
r = requests.get(URL, params=PARAMS, headers=headers, timeout=60)
r.raise_for_status()
return r.json()
if __name__ == "__main__":
print(call())