Proxy Gateway X402 enables unrestricted pay-per-use internet access via the x402 protocol with direct USDC payments on Base L2, requiring no custody or KYC.
# Proxy Gateway x402
> ๐ **Agent-to-Agent Commerce Proxy** โ Unrestricted internet access with pay-per-use via x402 protocol. No custody, no KYC, direct USDC payments.
[](https://github.com/yourname/proxy-gateway-x402)
[](https://x402.org)
[](https://base.org)
[](LICENSE)
## โก Key Features
| Feature | Benefit |
|---------|---------|
| ๐ฐ **Pay-Per-Use** | Only pay when you use, no subscriptions |
| ๐ **x402 Protocol** | Agent-to-Agent commerce, automatic payments |
| ๐ฆ **No Custody** | Funds go directly to developer, no middleman |
| ๐ **No KYC** | Crypto-native, no identity verification |
| โก **Instant** | Sub-second confirmation on Base L2 |
| ๐ก๏ธ **Self-Host** | Full source code, deploy your own |
---
## ๐ฐ Pricing
| Item | Details |
|------|---------|
| **Price** | 0.001 USDC per request |
| **Token** | USDC |
| **Network** | Base (Ethereum L2) |
| **Gas** | ~$0.0001 per transaction |
---
## ๐ Quick Start
### For Users
#### 1. Install the Skill
```bash
clawhub install proxy-gateway-x402
```
#### 2. Set Up Auto-Pay (Recommended)
```bash
# Set your private key for automatic payments
export USER_EVM_PRIVATE_KEY=0xYourPrivateKey
# โ ๏ธ Security: Use a dedicated wallet with limited funds
```
#### 3. Use the Proxy
```python
import requests
import json
# Method 1: Auto-pay (if USER_EVM_PRIVATE_KEY is set)
response = requests.post(
"https://proxy-gateway-x402.easky.cn/api/v1/fetch",
json={
"url": "https://api.github.com/users/github",
"method": "GET"
}
)
print(response.json()["content"])
# Method 2: Manual payment
# First call returns 402 Payment Required
response = requests.post(
"https://proxy-gateway-x402.easky.cn/api/v1/fetch",
json={"url": "https://example.com/api", "method": "GET"}
)
# Response: {"error": "Payment Required", "x402": {...}}
# Pay 0.001 USDC to the specified address
# Then retry with payment proof
response = requests.post(
"https://proxy-gateway-x402.easky.cn/api/v1/fetch",
headers={"X-Payment-Response": json.dumps({"tx_hash": "0x..."})},
json={"url": "https://example.com/api", "method": "GET"}
)
```
---
## ๐ง For Developers
### Deploy Your Own Instance
#### 1. Clone & Install
```bash
git clone https://github.com/yourname/proxy-gateway-x402.git
cd proxy-gateway-x402
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
#### 2. Configure Environment
```bash
cp .env.example .env
# Edit .env with your settings:
# - DEVELOPER_WALLET: Your wallet to receive payments
# - PRICE_PER_REQUEST: Set your price (default: 0.001)
# - X402_CHAIN: base or base-sepolia (for testing)
```
#### 3. Run
```bash
# Development
uvicorn app.main:app --reload --port 8080
# Production
uvicorn app.main:app --host 0.0.0.0 --port 8080
```
### Docker Deployment
```bash
docker build -t proxy-gateway-x402 .
docker run -d \
-p 8080:8080 \
-e DEVELOPER_WALLET=0xYourWallet \
-e PRICE_PER_REQUEST=0.001 \
proxy-gateway-x402
```
---
## ๐ API Reference
### POST /api/v1/fetch
Fetch any URL through the proxy.
**Headers:**
- `X-Payment-Response` (optional): Payment proof JSON `{"tx_hash": "0x..."}`
**Request Body:**
```json
{
"url": "https://api.example.com/data",
"method": "GET",
"headers": {"Authorization": "Bearer token"},
"body": null,
"region": "us"
}
```
**Response (Success):**
```json
{
"success": true,
"content": "...",
"status_code": 200,
"payment": {
"verified": true,
"tx_hash": "0x...",
"amount": "0.001",
"token": "USDC"
}
}
```
**Response (402 Payment Required):**
```json
{
"success": false,
"error": "Payment Required",
"x402": {
"version": "0.1.0",
"scheme": "exact",
"network": "base",
"required": {
"amount": "0.001",
"token": "USDC",
"recipient": "0x..."
}
}
}
```
### GET /api/v1/price
Query current pricing.
**Response:**
```json
{
"price": "0.001",
"token": "USDC",
"network": "base",
"recipient": "0x..."
}
```
---
## ๐ก๏ธ Security
### For Users
โ ๏ธ **Private Key Safety**
- Use a hardware wallet or dedicated hot wallet
- Never use your main wallet for auto-pay
- Set daily spending limits on your wallet
- Monitor transactions regularly
โ ๏ธ **Payment Verification**
- All payments are verified on-chain
- Transactions cannot be forged or replayed
- Payment proofs are cached for 5 minutes
### For Developers
โ ๏ธ **Smart Contract Risks**
- USDC contract is standard ERC-20
- No custom smart contracts in this implementation
- All verification happens on-chain
---
## โ ๏ธ Disclaimer
**This is experimental software.** Use at your own risk.
- No refunds for failed requests
- Network fees are paid by the user
- Developer receives payments directly, no escrow
- This is NOT financial advice
---
## ๐ Links
- [x402 Protocol](https://x402.org)
- [Base Network](https://base.org)
- [USDC on Base](https://www.circle.com/en/usdc/developers/base)
---
## ๐ License
MIT License - See [LICENSE](LICENSE)
---
Built with โค๏ธ for the Agent Commerce ecosystem.
don't have the plugin yet? install it then click "run inline in claude" again.