# Setup

AI agents can access Pixel Studio APIs using **x402-proxy** - a CLI tool that auto-pays x402 endpoints without any crypto code.

## Quick Start for AI Agents

### Install x402-proxy

```bash
npx x402-proxy --version
```

x402-proxy works like curl but automatically pays HTTP 402 responses. No wallet setup needed - it creates one automatically.

### Make Your First Request

```bash
npx x402-proxy -X POST \
  -H "Content-Type: application/json" \
  -d '{"textureDescription":"weathered red brick with moss","textureType":"brick"}' \
  https://ps.codejar.net/api/texture-generator/generate
```

The tool will:
1. Detect the payment requirement (402 response)
2. Automatically pay using your wallet
3. Return the response

### Wallet Setup

On first run, x402-proxy will walk you through wallet setup:

```bash
npx x402-proxy setup
```

This creates a BIP-39 mnemonic that derives both EVM (Base) and Solana keypairs. You'll need to fund your wallet with USDC on Base chain.

Check wallet status:

```bash
npx x402-proxy wallet
npx x402-proxy status
```

### Claude Code / AI Agent Integration

For AI agents, use the MCP proxy mode:

```bash
npx x402-proxy mcp add pixel-studio https://ps.codejar.net/mcp
```

Or manually add to your AI client's MCP config:

```json
{
  "mcpServers": {
    "pixel-studio": {
      "command": "npx",
      "args": ["-y", "x402-proxy", "mcp", "https://ps.codejar.net/mcp"]
    }
  }
}
```

### Environment Variables (Optional)

Override wallet per-instance:

```bash
X402_PROXY_WALLET_MNEMONIC="your bip39 mnemonic here" npx x402-proxy ...
```

### More Information

See the [x402-proxy documentation](https://github.com/cascade-protocol/x402-proxy) for:
- Library usage in Node.js
- OpenClaw plugin integration
- MPP streaming payment support
- Protocol negotiation details
