TypeScript SDK

@axlabs/ax402-sdk mirrors the control-plane OpenAPI contract. The frontend dashboard uses this package via the pnpm workspace.

Install

pnpm add @axlabs/ax402-sdk

Control plane

import { Ax402Client } from "@axlabs/ax402-sdk";

const client = new Ax402Client({
  baseUrl: "http://api.localhost:8090",
  apiKey: process.env.AX402_API_KEY,
});

await client.apis.create({ name: "My API", slug: "myapi", ... });
await client.endpoints.create(apiId, { method: "GET", path_pattern: "/v1/*", accepts: [...] });

Buyer module

import { buyerClientFromEnv, payAndFetch } from "@axlabs/ax402-sdk/buyer";

const res = await payAndFetch("https://myapi.localhost:8090/v1/data");
console.log(res.status, res.settlement);

Scope presets

Import from the SDK: readonly, apiManager, analytics — use when creating API keys for automation.

Tests

cd packages/typescript && pnpm test