@ax402/sdk
v0.0.3
Published
Ax402 platform control-plane SDK
Keywords
Readme
@ax402/sdk
TypeScript client for the Ax402 control plane — manage APIs, endpoints, domains, analytics, and gateway configuration from Node.js or the browser.
Payment signing uses x402 via optional @ax402/sdk/buyer. This package covers platform automation, not the protocol itself.
Install
npm install @ax402/sdkBuyer helpers (optional):
npm install @x402/fetch @x402/evm viemQuick start
import { Ax402Client } from "@ax402/sdk";
const client = new Ax402Client({
baseUrl: process.env.AX402_BASE_URL!,
apiKey: process.env.AX402_API_KEY!,
});
const apis = await client.apis.list();Create an API key in the Ax402 dashboard.
Subpaths
| Import | Purpose |
|--------|---------|
| @ax402/sdk | Control-plane client + platform helpers |
| @ax402/sdk/buyer | Pay gateway URLs (BuyerClient, payAndFetch) |
| @ax402/sdk/platform | Token/network helpers (buildUsdcAccept, gatewayURL, …) |
| @ax402/sdk/scopes | API key scope presets |
| @ax402/sdk/shell | Shell-oriented helpers for CLI tooling |
Control plane
Resources on Ax402Client: auth, keys, apis, endpoints, domains, openapi, stats, settlements, billing, income, exchangeRates, config.
import { buildUsdcAccept, usdcToAtomic } from "@ax402/sdk";
const accept = buildUsdcAccept({ priceUsdc: 0.1, payTo: "0xYourWallet" });Buyer
Pay wrapped gateway URLs — not the control plane.
import { buyerClientFromEnv } from "@ax402/sdk/buyer";
const client = await buyerClientFromEnv();
const { response, payment } = await client.pay({
url: "https://my-api.ax402.io/v1/echo?test=1",
});Browser wallet: createEvmSignerFromBrowserProvider() + BuyerClient.create(signer).
Environment
| Variable | Purpose |
|----------|---------|
| AX402_BASE_URL | Control plane URL (default https://api.ax402.io) |
| AX402_API_KEY | Scoped API key (ax402_live_...) |
| AX402_EVM_PRIVATE_KEY | Signs x402 payments for buyer helpers |
Links
License
Apache-2.0
