Skip to main content

x402 Prompt Protection Payments

Parse Agents supports x402 for autonomous agents that need prompt protection before they have a bearer API key. x402 is best for first-call access, marketplace agents, and metered workflows. Use Pro, Team, or Enterprise keys for sustained production volume.

Flow

  1. Call a billable endpoint without Authorization.
  2. Read the 402 Payment Required response and its accepts[] payment requirements.
  3. Sign the advertised USDC payment on Base mainnet.
  4. Retry the identical request with payment-signature.
  5. Legacy x402 clients may send x-payment.

Billable endpoints

EndpointPriceUse
POST /v1/parse$0.005Screen untrusted prompts before agent action
POST /v1/screen-output$0.003Screen generated output before forwarding
POST /v1/analyze$0.01 quick, $0.05 standard, $0.15 deepMedia credibility analysis
POST /v1/evaluate$0.01Prompt quality, safety, latency, and cost evaluation
POST /v1/chat$0.005Chat with Parse Agents

The canonical machine-readable pricing manifest is GET /v1/pricing.

Agent retry contract

The 402 body includes the x402 accepts[] object plus Parse Agents retry metadata:

{
  "accepts": [],
  "retry": {
    "method": "POST",
    "resource": "https://parsethis.ai/v1/parse",
    "header": "payment-signature",
    "legacy_header": "x-payment"
  },
  "payment_context": {
    "service": "Parse Agents",
    "network": "eip155:8453",
    "network_name": "Base mainnet",
    "currency": "USDC",
    "pricing_url": "https://parsethis.ai/v1/pricing",
    "openapi_url": "https://parsethis.ai/openapi.json",
    "docs_url": "https://parsethis.ai/docs/x402"
  }
}

For non-idempotent workflows, send an Idempotency-Key header and reuse it on the paid retry.

TypeScript

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const client = new x402Client().register("eip155:8453", new ExactEvmScheme(account));
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://parsethis.ai/v1/parse", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ prompt: untrustedText }),
});

const decision = await res.json();

Never log the private key. Use a funded, scoped wallet for agent payments rather than a primary wallet.