l402-kit is an open-source middleware that implements the L402 protocol — the open standard for pay-per-call API monetization using the Bitcoin Lightning Network.Add 3 lines of code. Callers pay in sats. You receive in seconds. Works with TypeScript, Python, Go, and Rust.
┌─────────────────────────────────────────────────────────────────┐│ ││ Cliente / Agente IA ││ │ ││ │ 1. GET /sua-api ││ ▼ ││ Sua API (l402-kit) ──── 2. Cria invoice ───► ShinyDapps API ││ │ (Blink wallet) ││ │ 3. Retorna: 402 + invoice BOLT11 ││ ▼ ││ Cliente paga ──────────────────────────────► Lightning Network ││ │ (< 1 segundo) ││ │ 4. Envia preimage como prova criptográfica ││ ▼ ││ Sua API verifica: SHA256(preimage) == hash ✓ ││ │ ││ │ 5. Split automático: ││ │ → 99.7% ──────────────────────► Seu Lightning Addr ││ │ → 0.3% ──────────────────────► ShinyDapps (taxa) ││ │ ││ │ 6. Sua API responde: 200 OK + dados ││ ▼ ││ Cliente recebe o conteúdo │└─────────────────────────────────────────────────────────────────┘
Transparência total: ShinyDapps recebe o pagamento e envia 99.7% para seu Lightning Address automaticamente. A taxa de 0.3% é o que mantém o projeto vivo. O split é determinístico e verificável — nenhum segredo, nenhum intermediário.