Use with ChatGPT & Claude
Free services work with a plain HTTP tool. Paid services need an x402 wrapper that holds a wallet — the model never signs.
The key idea
A chat model can call HTTP tools, but it cannot sign crypto payments. So free services work with any HTTP tool, while paid services need a small wrapper that holds a funded wallet and does the x402 pay-and-retry. The model just calls a clean tool with deviceId, serviceId, and params.
Plain ChatGPT / Claude (discovery + free services)
Register two HTTP tools / Custom GPT Actions and you are done — no wallet:
GET https://device-controller.0xbs.org/public/device/{deviceId}— discoveryPOST https://device-controller.0xbs.org/quote/device/{deviceId}/service/{serviceId}— call
Claude — MCP tool (paid services)
Expose an MCP tool whose handler runs the x402 wrapper and holds the wallet key. Input schema: { deviceId, serviceId, params, username?, password? }.
// mcp handler (holds AGENT_EVM_PRIVATE_KEY / AGENT_SOLANA_PRIVATE_KEY)
import { createSigner, wrapFetchWithPayment, decodeXPaymentResponse,
type MultiNetworkSigner } from "x402-fetch";
export async function callDeviceService({ deviceId, serviceId, params, username, password }) {
const evm = await createSigner("base", process.env.AGENT_EVM_PRIVATE_KEY!);
const svm = await createSigner("solana", process.env.AGENT_SOLANA_PRIVATE_KEY!);
const fetchWithPay = wrapFetchWithPayment(
fetch, { evm, svm } as MultiNetworkSigner, 1_000_000n);
const res = await fetchWithPay(
`https://device-controller.0xbs.org/quote/device/${deviceId}/service/${serviceId}`,
{ method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ params, username, password }) });
const xpr = res.headers.get("x-payment-response");
return { result: await res.json(),
settlement: xpr ? decodeXPaymentResponse(xpr) : null };
}ChatGPT — Custom GPT Action (paid services)
Host the same wrapper behind a public URL and register it as an Action. The Action backend holds the wallet key and performs the x402 flow; the GPT only passes deviceId, serviceId, params.
Agent frameworks
Coinbase AgentKit, LangChain/LangGraph, and similar already ship x402 tools. Give the agent a funded wallet and point its x402 tool at the call URL — the model can pay autonomously.
Prefer a machine-readable spec? Point your agent at skills.md — it documents the whole flow in one fetchable file. See also skills.md.