HTTP/1.1 402 PAYMENT REQUIRED agent402.base.eth · BASE · SOLANA · POLYGON · ARBITRUM · STELLAR · ROBINHOOD · USDC · USDG
Agent402 / tools / route-execute

Route and execute

$0.01 per call · USDC via x402 · POST /api/route/execute

Describe a task (or name a slug) and the Smart Order Router resolves the best-matching tool and RUNS it in the same call — one flat $0.01 price covering any tool listed at $0.005 or less, receipt included. Skips the find-then-call round trip: one payment, one request, result + receipt. Pricier tools return a self-correcting 409 pointing at their direct route.

Input

FieldTypeDescription
taskstringPlain-language task, e.g. "sha256 hash of a string" — resolved via the same ranker as /api/find. Provide task OR slug.
slugstringExact tool slug to execute (skips ranking). Provide task OR slug.
paramsobjectInput for the resolved tool, matching its inputSchema (default {})
maxUsdnumberRefuse tools listed above this underlying price (default and ceiling: $0.005)

Example output

{
  "receipt": {
    "slug": "hash",
    "route": "POST /api/hash",
    "underlyingPriceUsd": 0.001,
    "paidUsd": 0.01,
    "routingFeeUsd": 0.009,
    "seller": "internal",
    "resolvedBy": "slug"
  },
  "result": {
    "algo": "sha256",
    "hex": "…",
    "base64": "…"
  }
}

Try it — see the 402 challenge (free)

curl -i -X POST https://agent402.tools/api/route/execute \
  -H "Content-Type: application/json" \
  -d '{"slug":"hash","params":{"text":"agent402","algo":"sha256"}}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/route/execute", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "slug": "hash",
    "params": {
      "text": "agent402",
      "algo": "sha256"
    }
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools