Pay for any API with USDC. The x402 payment SDK for AI agents.
No API keys. No accounts. No KYC. Just a Base wallet with USDC.
pip install x402-agent-kitimport asyncio
from x402_agent_kit import SignalFuse
sf = SignalFuse(wallet_key="0xYOUR_PRIVATE_KEY")
signal = asyncio.run(sf.get_signal("BTC"))
print(signal)That's it. The client handles x402 payment negotiation automatically -- it intercepts the 402 response, signs a USDC payment on Base, and retries.
PayableClient works with any x402-enabled endpoint, not just SignalFuse:
from x402_agent_kit import PayableClient
client = PayableClient("0xYOUR_PRIVATE_KEY")
# Any x402 API -- the client handles payment automatically
resp = await client.get("https://some-x402-api.com/data")
print(resp.json())
# Or use a base URL
client = PayableClient("0xKEY", base_url="https://some-x402-api.com")
resp = await client.get("/data")SignalFuse is a trading signal API built on x402. The SignalFuse class is a convenience wrapper:
sf = SignalFuse(wallet_key="0xKEY")
signal = await sf.get_signal("ETH") # Latest signal for ETH
regime = await sf.get_regime() # Macro regime classification
sentiment = await sf.get_sentiment("SOL") # Sentiment data
batch = await sf.get_batch(["BTC", "ETH", "SOL"]) # Multiple symbolsfrom crewai import Agent
from crewai.tools import BaseTool
from x402_agent_kit import SignalFuse
import asyncio
class SignalFuseTool(BaseTool):
name: str = "signalfuse_signal"
description: str = "Fetch a trading signal for a crypto symbol via x402."
wallet_key: str
def _run(self, symbol: str) -> dict:
sf = SignalFuse(wallet_key=self.wallet_key)
return asyncio.run(sf.get_signal(symbol))
tool = SignalFuseTool(wallet_key="0xKEY")
agent = Agent(role="Trader", goal="Find signals", tools=[tool])See examples/crewai_tool.py for the full example.
from langchain_core.tools import BaseTool
from x402_agent_kit import SignalFuse
import asyncio
class SignalFuseTool(BaseTool):
name: str = "signalfuse_signal"
description: str = "Fetch a trading signal for a crypto symbol via x402."
wallet_key: str
def _run(self, symbol: str) -> dict:
sf = SignalFuse(wallet_key=self.wallet_key)
return asyncio.run(sf.get_signal(symbol))
tool = SignalFuseTool(wallet_key="0xKEY")See examples/langchain_tool.py for the full example.
x402 is a payment protocol built on HTTP status code 402 (Payment Required). When a server returns 402, the client automatically signs a USDC payment on Base and retries the request. The server verifies the payment and returns data.
This means:
- No API keys -- your wallet IS your identity
- No accounts -- no signup forms, no email verification
- No KYC -- permissionless access to any x402 API
- Pay per request -- no subscriptions, no tiers, no overage charges
- Works everywhere -- any HTTP client that supports x402
Compare this to traditional API payment flows (Stripe, MoonPay, etc.) where you need to create an account, add a payment method, manage API keys, handle webhooks for billing events, and deal with subscription tiers. With x402, your agent just needs a wallet with USDC.
- SignalFuse -- Trading signals via x402
- x402 Protocol -- The payment protocol spec
- Base -- The L2 network used for payments
MIT