The @2sio/sdk TypeScript client wraps the x402 probe → sign → retry loop behind a typed method call. Works in Node and any modern JS runtime.
Install the SDK, set an EVM wallet key, and call any endpoint. The result includes the data, the USDC cost, and the settlement tx:
// npm i @2sio/sdk
import { TwoS } from '@2sio/sdk'
// Fund any EVM wallet with a little USDC on Base. No signup, no API key.
const client = new TwoS({ privateKey: process.env.EVM_PRIVATE_KEY as `0x${string}` })
const res = await client.weather.zip({ zip: '94103' })
console.log(res.data) // real National Weather Service forecast
console.log(res.costUsd) // what this call cost, in USDC
console.log(res.settlement?.txHash) // on-chain settlement txConstruct the client in trial mode for a free real call (one per endpoint per hour) — no wallet needed:
import { TwoS } from '@2sio/sdk'
const client = new TwoS({ trial: true }) // no key needed
const res = await client.validate.iban({ iban: 'GB82WEST12345698765432' })
console.log(res.data) // real result, marked meta.trialYou do not have to use the SDK. The wire flow is a plain fetch that gets a 402, a signed payment header, and a retry — the same shape the SDK automates. See the cURL guide for the raw envelope, or the facilitator guide for how settlement works.
Call a live x402 API right now — no signup.
Browse the full endpoint directory, grab the quickstart, or read the llms.txt manifest. Every endpoint is keyless and pay-per-call.