Skip to main content

Pay gateway URLs andautomate the control plane

TypeScript, Go, and Python packages mirror the control-plane OpenAPI contract and include buyer clients for paying gateway hostnames. CLI and MCP tooling extend the same APIs for scripts and agents.

Workflow

From install to paid gateway call

Whether you ship a backend service, an agent, or a CI job, the SDK path is the same — install, pay a gateway URL, then automate dashboard tasks with scoped keys.

01

Install the SDK

Add the TypeScript, Go, or Python package plus buyer dependencies for your runtime. Each language ships buyer modules and a control-plane client from the same repository.

02

Call a gateway URL

Point buyer clients at a priced hostname. Unpaid requests return HTTP 402 with machine-readable payment requirements the SDK can parse and sign.

03

Sign, settle, and retry

The client signs the authorization, settles through the gateway facilitator path, and retries with PAYMENT-SIGNATURE until upstream returns 200.

04

Automate the control plane

Use the main SDK entry with scoped API keys to manage APIs, endpoints, domains, and analytics from CI pipelines or agent workflows.

Capabilities

SDKs, CLI, and agent tooling

Buyer clients for gateway URLs, control-plane automation for sellers, and terminal plus MCP surfaces for developers and agents.

Buyer clients

TypeScript, Go, and Python modules share the same pay-and-fetch flow against gateway hostnames — from apps, agents, and scripts.

Control plane automation

Mirror the seller OpenAPI contract for APIs, endpoints, domains, and keys. Same routes the dashboard uses, callable from code.

CLI and workbench

Inspect gateway URLs, pay from the terminal, and run shell commands in the dashboard workbench for interactive debugging.

MCP server

Expose control-plane and buyer actions as agent tools for Cursor and compatible hosts — built from the SDK repository.

Scoped API keys

Automate with keys limited to the scopes you choose — read stats, write endpoints, manage domains, and run buyer flows.

x402 payment flows

Buyer clients handle exact and batch-settlement schemes returned by the facilitator, including 402 challenge parsing and retries.

Languages

TypeScript, Go, and Python

Each language ships buyer modules and a control-plane client. Install the package, pay a staging echo URL, then wire automation with scoped API keys.

TypeScript

TypeScript

Control-plane CRUD, buyer client, browser automation

Read the TypeScript docs

Install

pnpm add @axlabs/ax402-sdk
# Buyer deps
pnpm add @x402/fetch @x402/evm viem

Buyer example

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

const client = await buyerClientFromEnv();
const { response } = await client.pay({
  url: "https://echo.staging.ax402.io/echo/get?test=1",
});
Go

Go

CI/CD, gateway automation, buyer flows

Read the Go docs

Install

go get github.com/AxLabs/ax402-sdk/go

Buyer example

import "github.com/AxLabs/ax402-sdk/go/buyer"

client, _ := buyer.NewFromPrivateKey(ctx, privateKey)
resp, _ := client.Get(ctx, gatewayURL)
Python

Python

Agents, async control plane, buyer client

Read the Python docs

Install

pip install "ax402-sdk[buyer]"

Buyer example

from ax402_sdk.buyer import BuyerClient

client = BuyerClient.from_env()
response = client.get(gateway_url)

Automate your gateway from code

Start with buyer clients against staging echo URLs, then wire control-plane automation with scoped API keys.