← Back to Plugins
Integration

Get402 Agent Payment

Actarus-77 By Actarus-77 👁 58 views ▲ 0 votes

Pay-per-request API via HTTP 402. Let any AI agent pay for API access in USDC on Base. 1% fee, 99% to providers. Companion plugin for OpenClaw, Hermes, Claude Code, and any LLM agent.

GitHub

Install

npm install get402-sdk

Configuration Example

{
  "tools": {
    "get402-pay": { "timeoutSec": 30 }
  }
}

README

<p align="center">
  <img src="https://img.shields.io/badge/HTTP-402-red?style=flat-square&labelColor=111" alt="HTTP 402"/>
  <img src="https://img.shields.io/badge/USDC-Base-blue?style=flat-square&labelColor=111" alt="USDC on Base"/>
  <img src="https://img.shields.io/badge/AI%20Agent-Ready-green?style=flat-square&labelColor=111" alt="AI Agent Ready"/>
  <br>
  <br>
  <strong>get402 Agent Payment</strong><br>
  Pay-per-request API via HTTP 402 β€” for AI agents.<br>
  <br>
  <a href="https://get402.net">Website</a> β€’
  <a href="https://get402.net/demo">Live Demo</a> β€’
  <a href="https://get402.net/quickstart">Quick Start</a>
</p>

---

# πŸ€– get402 Agent Payment

**Let any AI agent pay for API access using USDC on Base.**

get402 implements **HTTP 402 Payment Required** β€” the HTTP status code that was reserved for digital payments but never standardized. Now it's real, and your agents can use it.

## How It Works

```
Agent calls API β†’ API returns HTTP 402 with wallet address β†’ 
Agent pays USDC β†’ Agent retries with tx hash β†’ API returns data

                     99% to provider  |  1% to get402
```

### For Any Agent

| Agent Type | Integration |
|------------|-------------|
| **OpenClaw** | Add the payment tool to your agent config |
| **Hermes** | Load the skill: `/skill get402-agent-payment` |
| **Claude Code** | Use x402 middleware in your API |
| **Codex / OpenAI** | Auto-handle 402 via fetch wrapper |
| **Custom LLM** | Curl + wallet = done |

## Quick Start

### 1. Sign Up

Get your API key at [https://dashboard.get402.net](https://dashboard.get402.net)

### 2. Configure Your Wallet

In Settings, add your **Base wallet address**. All payments go directly to you.

### 3. Protect Your Endpoint (as provider)

```ts
import { x402 } from "get402-sdk/express";

app.post("/api/analyze", x402({ price: 0.01 }), handler);
// β†’ Returns HTTP 402 until paid, then returns data
```

### 4. Pay for API Access (as agent)

```bash
# Agent calls your API
curl -X POST https://api.get402.net/demo/analyze \
  -H "Content-Type: application/json" \
  -d '{"text":"Analyze this"}'

# β†’ HTTP 402 Payment Required
# β†’ Payment details: 0.01 USDC on Base to provider's wallet

# Agent pays via Phantom/USDC wallet
# Then retries with the transaction hash:

curl -X POST https://api.get402.net/demo/analyze \
  -H "Content-Type: application/json" \
  -H "X-Payment-Tx: 0x<transaction_hash>" \
  -d '{"text":"Analyze this"}'

# β†’ 200 OK with analysis result
```

## For OpenClaw Agents

Add to your `openclaw.json`:

```json
{
  "tools": {
    "get402-pay": { "timeoutSec": 30 }
  }
}
```

Then agent workflows can autonomously:
1. Call an API β†’ receive HTTP 402
2. Pay via configured USDC wallet
3. Retry and get the result

## For Hermes Agents

Load the skill in-session:

```
/skill get402-agent-payment
```

Or preload in `config.yaml`:

```yaml
skills:
  preload:
    - get402-agent-payment
```

## SDK Installation

```bash
npm install get402-sdk
```

### Framework Wrappers

**Express.js:**
```ts
import { x402 } from "get402-sdk/express";
app.post("/api/data", x402({ price: 0.01 }), handler);
```

**Fastify:**
```ts
import { x402Plugin } from "get402-sdk/fastify";
app.register(x402Plugin);
app.get("/api/data", { preHandler: [app.x402({ price: 0.01 })] }, handler);
```

**Next.js App Router:**
```ts
import { withX402 } from "get402-sdk/nextjs";
export const POST = withX402({ price: 0.01 }, handler);
```

## Pricing

| Tier | Price | Transactions/mo | Fee |
|------|-------|----------------|-----|
| **Free** | $0 | 20 | 1% |
| **Starter** | $9/mo | 1,000 | 1% |
| **Pro** | $49/mo | 10,000 | 1% |
| **Enterprise** | Custom | Unlimited | Custom |

**99% of every transaction goes to the API provider.** get402 takes 1%.

## Supported Networks

| Network | Status |
|---------|--------|
| **Base** (USDC) | βœ… Live |
| Solana | πŸ”œ Coming soon |

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent   │────▢│  Your    │────▢│  get402   │────▢│  Provider β”‚
β”‚ (LLM)    β”‚     β”‚  API     β”‚     β”‚  Gateway  β”‚     β”‚  Wallet   β”‚
β”‚          β”‚     β”‚          β”‚     β”‚           β”‚     β”‚  (USDC)   β”‚
β”‚  ← 402   β”‚     β”‚  ← x402  β”‚     β”‚  ← verify β”‚     β”‚           β”‚
β”‚  β†’ Pay   β”‚     β”‚  β†’ Data  β”‚     β”‚  β†’ track  β”‚     β”‚  99% β†’   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Links

- [Website](https://get402.net)
- [Live Demo](https://get402.net/demo)
- [Quickstart](https://get402.net/quickstart)
- [Documentation](https://api.get402.net/docs)
- [Dashboard](https://dashboard.get402.net)

## License

MIT β€” use it, build on it, ship it.

<p align="center">
  <small>
    Built for the HTTP 402 revolution.<br>
    <a href="https://get402.net">get402.net</a>
  </small>
</p>
integration

Comments

Sign in to leave a comment

Loading comments...