> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tachyon.pe/llms.txt
> Use this file to discover all available pages before exploring further.

# Guide: x402 micropayments for agents and APIs

> Point any standard x402 stack at Tachyon's facilitator so agent-to-API payments settle confidentially.

<Warning>
  **Tachyon-branded x402 packages are WIP.** The fast path today is to use any off-the-shelf x402 middleware/client and configure the facilitator URL to [`https://facilitator.tachyon.pe`](https://facilitator.tachyon.pe). The facilitator speaks the standard x402 protocol and settles through Tachyon confidentially.
</Warning>

x402 is the HTTP-native payment standard for agents and APIs. Tachyon runs a facilitator that turns every payment into a confidential intent, the merchant's settlement address rotates per payment, the amount stays off-chain-visible, and clients can fund from any supported source chain.

## Merchant side, protect an endpoint

Any x402-compatible middleware works. Point its `facilitator` configuration at `https://facilitator.tachyon.pe`:

```ts theme={null}
import express from "express";
import { paymentMiddleware } from "x402-express"; // or any x402 middleware

const app = express();

app.use(
  paymentMiddleware({
    facilitator: "https://facilitator.tachyon.pe",
    receivingChain: "base",       // one of Tachyon's supported chains
    receivingToken: USDC_BASE,    // any supported asset
    pricing: {
      "/llm/inference": "0.001",  // USD per call
      "/data/tick":      "0.0001",
    },
  })
);

app.get("/llm/inference", (req, res) => {
  res.json({ output: runModel(req.body) });
});
```

The middleware returns `402` with a payment challenge when no proof is attached, verifies the proof when one is attached, and lets the request through on success.

### You don't expose your wallet address

Tachyon's facilitator routes each payment to a fresh stealth address owned by the merchant's Safe on the receiving chain. Sweep with the relayer's [`POST /recipient/relay-proxy`](/api/relayer) (or the SDK helper when it ships), no long-lived hot wallet on the receiving chain.

## Client agent side, pay a 402-protected endpoint

Use any x402 client; point it at the same facilitator:

```ts theme={null}
import { x402Client } from "x402-fetch"; // or any x402 client

const client = x402Client({
  facilitator: "https://facilitator.tachyon.pe",
  funding: { chain: "ethereum", token: USDC_ETH }, // any supported source chain + asset
});

const response = await client.fetch("https://api.example.com/llm/inference", {
  method: "POST",
  body: JSON.stringify({ prompt: "..." }),
});
```

The client transparently:

* Detects a `402` response
* Hands the challenge to `facilitator.tachyon.pe`
* Pays via a confidential intent (settled to a fresh stealth address on the merchant's chosen chain)
* Retries the original request with proof of payment

You see only the final `200` response. No on-chain action reveals which merchant the agent paid or the amount.

## Cross-chain funding

The client picks `funding.chain` and `funding.token`. The merchant picks `receivingChain` and `receivingToken`. The facilitator handles any cross-chain routing required.

If the client's funding chain isn't one of Tachyon's [directly supported chains](/concepts/supported-chains), hop via Near Intents or Relay first.

## Limits and behavior

* Per-call payment amounts are typically very small (sub-cent to few cents).
* Each call gets a fresh stealth address; no payment is linkable to another.
* Platform-wide intent throughput applies, see [rate limits](/reference/rate-limits).

<Card title="x402 facilitator URL" icon="globe" href="https://facilitator.tachyon.pe">
  Point any x402 client at this URL.
</Card>

<Card title="Relayer HTTP API" icon="server" href="/api/relayer">
  Endpoints you'll hit directly for merchant-side sweeps.
</Card>
