Nginx module for the x402 HTTP micropayment protocol.
ngx-x402 is an early-stage Rust project in the AI payments / x402 ecosystem, focused on nginx, rust, x402. It currently has 0 GitHub stars and 0 forks, and sits alongside related tools like Nginx-X402, r402, os-moda.
Nginx module for the x402 HTTP micropayment protocol. Acts as a reverse proxy that adds x402 payment gates in front of existing APIs without modifying the backend.
proxy_passpay_to addresses per location block/metrics endpoint for observability# First-time setup: copy the example config and edit x402_pay_to with your wallet address
cp nginx.conf.example nginx.conf
docker-compose up
load_module /usr/lib/nginx/modules/libngx_x402.so;
http {
server {
location /api/weather {
x402 on;
x402_amount 0.001;
x402_pay_to 0xYourWalletAddress;
x402_facilitator_url https://x402.org/facilitator;
x402_network base-sepolia;
x402_description "Weather API";
proxy_pass http://backend:3000/api/weather;
}
}
}
| Directive | Example | Description |
|---|---|---|
x402 |
on/off |
Enable x402 payment verification |
x402_amount |
0.001 |
Payment amount (dollar-denominated) |
x402_pay_to |
0xAbC... |
Receiving wallet address |
x402_facilitator_url |
https://... |
Facilitator service URL |
x402_network |
base-sepolia |
Network name or CAIP-2 ID |
x402_network_id |
8453 |
Chain ID (takes precedence over network) |
x402_asset |
0x... |
Custom token address (defaults to USDC) |
x402_asset_decimals |
18 |
Token decimals (default: 6 for USDC) |
x402_description |
"Weather API" |
Endpoint description |
x402_resource |
/api/weather |
Resource path (auto-detected if omitted) |
x402_timeout |
10 |
Facilitator timeout in seconds |
x402_ttl |
60 |
Payment authorization validity in seconds |
x402_facilitator_fallback |
error/pass |
Behavior on facilitator failure |
x402_redis_url |
redis://... |
Redis URL for dynamic config |
x402_replay_ttl |
86400 |
Replay prevention TTL in seconds |
# Override price for a path
redis-cli SET /api/weather 0.005
# Price takes effect on next request (no nginx reload needed)
sudo apt-get install -y build-essential clang libclang-dev nginx
cargo build --release --features export-modules
The compiled module will be at target/release/libngx_x402.so.
Apache-2.0
Pure Rust implementation of Nginx module for x402 HTTP micropayment protocol.
Rust SDK for the x402 payment protocol.
An operating system built for AI agents — talk to your NixOS server instead of SSH-ing in. Typed, audited tool access with atomic rollback on every change. Research-grade; run it on a disposable box, not production.
Agent behavior that compiles
An open SDK for agentic payments. Let AI agents make payments, hold funds, and move money across chains with policy enforcement and human approval built in.
x402 payments in Rust: verify, settle, and monitor payments over HTTP 402 flows
Context-aware agentic LLM gateway & router that optimize your agentic workflows with every runs, works with any harnesses, any models, any workflows.
Production-ready x402 facilitator server.
Alephant is an open-source AI Agent Gateway for routing, tracking, and controlling LLM usage across AI agents, members, and workflows, and for publishing agent capabilities as paid endpoints with x402 and MPP payment rails.