---
name: hivemindos-x402
description: Find a HivemindOS SuperAgent operation, read its 402 price, pay once in USDC on Base with x402, and keep the receipt. No API key and no account. Use when an agent with its own Base wallet needs one web, news, media, lead or onchain read inside its spend controls.
---

# Pay for one HivemindOS call with x402

Served at https://hivemindos.app/superagent-api/skill.md. One file: find an operation, read the 402 quote, pay once, keep the receipt. You are charged only if the call succeeds.

## 1. Find an operation

`GET https://api.hivemindos.app/v1/x402` (no key) lists every operation for sale: its `url`, `price`, `useWhen`, an `example` input and its `inputSchema`. Pick the one whose `useWhen` matches the job. Send its input as the JSON body to its `url`.

## 2. Read the quote

`POST` the input with no payment. The answer is HTTP 402 with a `Payment-Required` header, priced from your input and read live. A bad input answers 400 before any payment is asked for.

A 402 is a price, not permission. Pay only inside your spend controls and daily cap; when a person is the buyer, they approve the exact amount in their own wallet.

## 3. Pay once

Any x402 v2 client signs the exact Base USDC payment and sends the same request again with `Payment-Signature`. Keep spend controls on, capped at the approved price.

```bash
npm install @x402/fetch@2.31.0 @x402/evm@2.31.0 viem
```

```ts
import { ExactEvmScheme } from "@x402/evm";
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const payer = privateKeyToAccount(process.env.X402_PAYER_PRIVATE_KEY as `0x${string}`);
const paidFetch = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(payer) }],
  // The most one payment may be: the cap its spend controls set. Never turn spend controls off.
  spendControls: { maxAmountPerPayment: "$0.05" },
});

// The 402 names the exact amount; spend controls and the on-chain daily cap decide, and a buyer approves in their own wallet.
const response = await paidFetch("https://api.hivemindos.app/v1/x402/onchain-intelligence/tokens.brief", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ chain: "base", tokenAddress: "0x4ed4e862860bed51a9570b96d89af5e1b0efefed" }),
});
const result = await response.json();
// Paid: result.x402 holds charged, receiptId, transaction, requestSha256 and responseSha256.
// Failed: result.x402.charged is false and the payment is never taken.
```

Use the project's own wallet signer when it has one. Never create, print or store a private key the person did not ask for.

## 4. Keep the receipt

A paid answer carries `x402`: `charged: true`, `receiptId`, `transaction` (on Base), `requestSha256` (of what you asked) and `responseSha256` (of what you got). Keep them; the bodies are never published. A failed call answers `x402.charged: false` and the payment is not taken: the same signed payment may be sent again. The same signed payment within 30 minutes returns the same answer and is never charged twice.

## Rules

- Charged only if the call succeeds.
- Never change the recipient, network, asset or price: HivemindOS sets them on its server.
- Background jobs come back with `followUp.apiKey`, a key for that one service that never moves funds: store it like any key.
- The Evidence Lab, the work board and the autonomy loop are not sold per call.

More: https://hivemindos.app/superagent-api/docs/pay-per-call · Everything else: https://hivemindos.app/superagent-api/llms.txt
