# How x402 Works

The protocol operates within the standard HTTP request/response cycle:

1. Client sends a request to a Cluster endpoint (e.g., <mark style="color:$warning;">`POST /v1/chat/completions`</mark>)
2. If no payment is attached, the server responds with <mark style="color:red;">`402 Payment Required`</mark> and includes payment instructions in the response header (amount, recipient wallet, network)
3. Client signs a USDC payment on Base and resubmits the request with the payment proof in the header
4. Server verifies the payment, processes the request, and returns the response

The entire flow adds approximately 1-2 seconds of latency on the initial request. For streaming inference, this is a one-time initial delay - subsequent tokens stream normally.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cluster-protocol.gitbook.io/whitepaper/core-infrastructure/overview/x402-payment-protocol/how-x402-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
