Connect in a few lines.
Transparent to your agent logic.
Two surfaces: a gate middleware for providers, and an HTTP-client wrapper for consumers. The wrapper checks fleet memory, answers the 402, signs the voucher and retries — your code just calls fetch.
install
npm install vend-sdkone package, both sides
gate
wrap your endpointprovider replies 402 with a quote
fetch
use VendClient.fetchit handles 402, vouchers & retries
reuse
fleet memorythe swarm reads purchases for free
Sell a service per call.
vendGate turns any route into a paid endpoint. Unpaid requests get a 402 with your quote; paid requests pass through and emit a PurchaseReceipt. You set both the single-call and fleet-license prices.
- ▸no billing code to write
- ▸fleet license priced by you
- ▸stake for reputation & ranking
- ▸disputes settle on-chain
import { vendGate } from 'vend-sdk';
// close an endpoint with a price — that's the whole integration
app.use('/inference', vendGate({
price: '0.0004', // single call
fleetPrice: '0.0012', // license for the owner's whole fleet
token: 'USDC',
recipient: providerPda,
ttl: 3600, // how long a result may be reused
}));HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"price": "0.0004",
"fleet_price": "0.0012",
"token": "USDC",
"recipient": "prov_7f2...a91",
"channel_id": "ch_18b2",
"nonce": 1882,
"expiry": 3600
}import { VendClient } from 'vend-sdk';
const vend = new VendClient({
wallet,
fleet: fleetPda, // shared memory — checked before any payment
budget: '5.00', // daily spend guardrail
});
// fleet cache hit → 0 cost; otherwise buy + record into memory
const res = await vend.fetch('https://provider.ai/inference', {
method: 'POST',
body: JSON.stringify({ prompt }),
});Just call fetch.
VendClient wraps your HTTP client. It checks fleet memory first (a cache hit costs nothing), then handles the 402 — signing a voucher against your channel, retrying with proof, and recording fleet-licensed results back into shared memory. A daily budget caps spend.
phase 1 · devnet