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

# x402 Quickstart

> Make your first ELUUP x402 API request using the @x402/axios client.

Get from zero to a paid ELUUP API request using the official x402 Axios client flow described in this documentation.

## Client Setup

ELUUP's x402 endpoints require every paid request to carry a signed USDC payment authorization. You do not construct this by hand — the `@x402/axios` client library wraps your existing `axios` instance and handles the full challenge → sign → retry flow automatically.

### Install dependencies

```bash theme={null}
npm install @x402/axios @x402/evm axios viem
```

### Configure the client

```typescript theme={null}
import { wrapAxiosWithPayment, x402Client } from "@x402/axios";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import axios from "axios";
import { privateKeyToAccount } from "viem/accounts";

// The wallet that will PAY for requests. It must hold USDC on Base mainnet.
const signer = privateKeyToAccount(
  process.env.PAYER_PRIVATE_KEY as `0x${string}`,
);

const client = new x402Client();
registerExactEvmScheme(client, { signer });

const api = wrapAxiosWithPayment(
  axios.create({ baseURL: "https://api.eluup.ai" }), // use your target base URL
  client,
);
```

That's the entire setup. Every call made through `api` will:

1. Send the request without payment.
2. If the server responds `402`, read the payment requirements, sign a USDC authorization with `signer`, and automatically retry the request with the signed payment attached.
3. Return the final response — whether that's a `200` success, or a `402` if the retried payment also failed (see [HTTP 402 — Payment Required](/x402/payment-flow#http-402-payment-required) for why this does **not** throw).

### Important: never use the `payTo` wallet as your payer

The `payTo` address is ELUUP's payment-receiving wallet. Your `signer` must be a **different** wallet than `payTo`, funded with your own USDC. Attempting to pay from the same address as `payTo` is rejected with `self_send_not_allowed` (see [HTTP 402 — Payment Required](/x402/payment-flow#http-402-payment-required)).

### Fund your wallet correctly

Before making any paid request, confirm:

<Warning>
  * Your `signer` wallet holds **USDC on Base mainnet** (`eip155:8453`) — not a testnet, and not USDC on another chain.
  * The balance covers at least the price of the request you're making (see [Pricing](/x402#pricing)).
</Warning>

***

**x402 docs:** [Overview](/x402) · [Quickstart](/x402/quickstart) · [Payment Flow](/x402/payment-flow) · [API Reference](/x402/api-reference) · [Errors & Troubleshooting](/x402/errors) · [Examples](/x402/examples)
