{"slug": "title-show-hn-i-turned-my-homelab-gpu-into-a-paid-api-on-base-mainnet", "title": "Title: Show HN: I turned my homelab GPU into a paid API on Base mainnet", "summary": "A developer has launched a self-hosted API on Base mainnet that sells LLM inference for USDC via the x402 HTTP 402 payment protocol, with a live endpoint running on a single RTX 5090 GPU and pricing starting at $0.01 per call. The reference implementation, released under an MIT license, includes a facilitator, FastAPI paywall middleware, and an MCP server, and has already processed its first external settlement of 0.12 USDC.", "body_md": "**A self-hosted x402 paywall + facilitator for selling LLM inference over HTTP —\nrunning live on Base mainnet, paid in USDC, on a homelab GPU.**\n\nThis repo is the reference implementation behind a live endpoint. Any human or\nAI agent with a crypto wallet can buy a completion in one HTTP round-trip:\nno accounts, no API keys, no signup. Payment verifies on-chain *before* the\nmodel runs; settlement happens *after* — a failed request is never charged.\n\n```\n$0.01  POST /premium/llm    27B open-weights model, 4K token cap\n$0.05  POST /premium/deep   8K tokens — double the thinking budget on the same 27B\n$0.10  POST /premium/vl     30B vision model, image understanding\nfree   GET  /premium/balance  live on-chain earnings (transparency endpoint)\nfree   POST /premium/trial    3 calls per wallet, sybil-limited by EIP-191 signature\n```\n\nx402 (HTTP 402 \"Payment Required\", revived by Coinbase) lets software pay\nsoftware. This repo is the smallest serious stack we found that does it\n**self-hosted end to end**:\n\n`x402_facilitator.py`\n\n— your own facilitator (verify + settle). No hosted service, no middleman cut, no regional blocks.`x402_paywall.py`\n\n— FastAPI middleware: 402 with payment requirements → buyer signs → facilitator verifies → handler runs → settlement receipt in the response body (`X-PAYMENT-RESPONSE`\n\n).`x402_mcp_server.py`\n\n— MCP wrapper so Claude/desktop agents can purchase natively.`scripts/x402_client_demo.py`\n\n— a working buyer in ~90 lines.\n\n```\nbuyer agent ──POST /premium/llm──▶ Caddy (path allowlist) ──▶ FastAPI paywall\n                                   ▲                            │\n                                   │ 402 + payment requirements │ verify via\n                                   │                            ▼ facilitator\n                              wallet signs ──────────────▶ on-chain (Base)\n                                                                │\n                                            handler runs AFTER verify\n                                            settles AFTER success (≥400 cancels)\n```\n\nSecurity posture (the interesting part for homelab operators):\n\n- The public internet reaches\n**only** the paywall routes. A reverse-proxy path allowlist 404s everything else — the rest of the machine (fleet control, admin API, this repo's private origin) is unreachable by design. - Wallet keys are age-encrypted at rest, decrypted in memory only.\n- Prompts are not logged or retained. The response dies with the connection.\n- Token caps per tier bound worst-case compute cost per call; every call is prepaid, so abuse is self-funding (it pays us).\n\n```\npip install fastapi uvicorn x402 c web3\n# receive + facilitator wallets: age-encrypted JSON, decrypted at startup\nage-encrypt your wallet json → vault/x402_receive_wallet.age\nuvicorn app:app --port 8900   # app wires the middleware onto your routes\n```\n\nPoint a buyer at it:\n\n```\npython3 scripts/x402_client_demo.py \"$URL/premium/llm\" \"Write a haiku about payments\"\n```\n\n- Live on Base mainnet (chain 8453), USDC settlement.\n- First real external settlement: 0.12 USDC and counting — see the balance endpoint on the live deployment.\n- Hardware: one RTX 5090 running an AWQ-quantized 27B. ~70% gross margin per $0.01 call after electricity.\n\nThis is homelab infra, not an SLA product: best-effort uptime, one GPU,\nno data-retention paperwork — because there is no data retention.\nPositioning is exactly that: **best-effort, cheap, keyless, and honest.**\n\nLicense: MIT.", "url": "https://wpnews.pro/news/title-show-hn-i-turned-my-homelab-gpu-into-a-paid-api-on-base-mainnet", "canonical_source": "https://github.com/Runuk/argo-x402-reference", "published_at": "2026-08-30 04:54:56+00:00", "updated_at": "2026-08-30 05:22:07.313385+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-infrastructure", "ai-products", "ai-tools", "ai-agents"], "entities": ["Base", "Coinbase", "FastAPI", "Caddy", "RTX 5090", "USDC", "x402", "MCP"], "alternates": {"html": "https://wpnews.pro/news/title-show-hn-i-turned-my-homelab-gpu-into-a-paid-api-on-base-mainnet", "markdown": "https://wpnews.pro/news/title-show-hn-i-turned-my-homelab-gpu-into-a-paid-api-on-base-mainnet.md", "text": "https://wpnews.pro/news/title-show-hn-i-turned-my-homelab-gpu-into-a-paid-api-on-base-mainnet.txt", "jsonld": "https://wpnews.pro/news/title-show-hn-i-turned-my-homelab-gpu-into-a-paid-api-on-base-mainnet.jsonld"}}