You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typed TypeScript SDK for claw402.ai — pay-per-call data APIs via x402 micropayments.
200+ endpoints covering crypto market data, US stocks, China A-shares, forex, global time-series, and AI (OpenAI/Anthropic/DeepSeek/Qwen). No API key, no signup, no subscription — just a Base wallet with USDC.
Install
npm install NoFxAiOS/claw402-js
Quick Start
import{Claw402}from"claw402"constclient=newClaw402({privateKey: process.env.WALLET_PRIVATE_KEYas `0x${string}`,})// Crypto: Fund flow — $0.001/callconstflow=awaitclient.coinank.fund.realtime({productType: "SWAP"})console.log(flow)// US Stocks: Latest quote — $0.001/callconstquote=awaitclient.alpaca.quotes.latest({symbols: "AAPL,TSLA"})console.log(quote)// US Stocks: Market snapshot — $0.002/callconstsnap=awaitclient.polygon.snapshot.all({tickers: "AAPL"})console.log(snap)// China A-shares — $0.001/callconststocks=awaitclient.tushare.cn.stockBasic({listStatus: "L"})console.log(stocks)// Forex time-series — $0.001/call (use getTimeSeries, not timeSeries which is a sub-resource)constts=awaitclient.twelvedata.getTimeSeries({symbol: "EUR/USD",interval: "1h"})console.log(ts)// AI: OpenAI chat — $0.01/callconstresp=awaitclient.openai.openai.chat({messages: [{role: "user",content: "Hello"}]})console.log(resp)// AI: Anthropic Claude — $0.015/callconstmsg=awaitclient.anthropic.anthropic.messages({messages: [{role: "user",content: "Hello"}]})console.log(msg)
Features
Typed methods — every endpoint has a dedicated TypeScript method with inline type hints
Automatic x402 payment — signs EIP-3009 USDC transfers locally, never sends your key
11 provider groups — crypto, US stocks, China stocks, forex, global data, and AI
Zero config — just a private key, no API keys or registration
// Time series (use getTimeSeries, NOT timeSeries — timeSeries is a sub-resource)constts=awaitclient.twelvedata.getTimeSeries({symbol: "EUR/USD",interval: "1h",outputsize: 3})// RSI indicatorconstrsi=awaitclient.twelvedata.indicator.rsi({symbol: "AAPL",interval: "1day",timePeriod: 14})// Real-time priceconstprice=awaitclient.twelvedata.price({symbol: "BTC/USD"})// Metalsconstgold=awaitclient.twelvedata.metals.price({symbol: "XAU/USD"})