Pay-Per-Request APIs Powered by Kaspa's Millisecond Blockchain
Turn Kaspa into the payment layer of the internet. Autonomous agents discover services, negotiate payments, and execute transactions using HTTP 402 Payment Required and Kaspa's instant confirmations.
Perfect for Kaspathon tracks:
- Payments & Commerce: HTTP 402 payment protocol with instant settlement
- Real-Time Data: IoT-style data feeds with per-request pricing
Watch autonomous agents execute real-time payments:
git clone https://github.com/cosmasken/kaspa402
cd kaspa402
pnpm install
pnpm build
# Navigate to demo
cd examples/marketplace-demo
# Start all services
./scripts/start-all.sh
# Run the autonomous payment demo
# (First-time users: the demo will detect insufficient funds and show funding instructions)
pnpm startStart all services (registry + 4 specialized agents):
Check service status:
Stop all services:
Client → API (402) → Kaspa Payment → Kaspa Network → Verifier → API Response
Key Components:
- Agent Client: Auto-handles 402 responses with Kaspa payments
- Service Registry: Decentralized service discovery
- Payment Verifier: Cryptographic proof of payment
- Multiple Pricing Models: Fixed, usage-based, outcome-based, tiered
- Millisecond Payments: Leverages Kaspa's instant block times
- Autonomous Agents: No human intervention required
- Service Composition: Chain multiple paid services
- Real-time Settlement: No waiting for confirmations
- Open Source: MIT licensed, ready to fork and extend
| Package | Purpose |
|---|---|
@kaspa-agent-pay/core |
Kaspa integration & utilities |
@kaspa-agent-pay/agent-client |
Smart HTTP client with auto-payments |
@kaspa-agent-pay/service-agent |
Paid service implementation |
@kaspa-agent-pay/service-registry |
Service discovery |
Unlike other blockchains with multi-minute confirmations, Kaspa enables:
- True real-time payments between services
- Instant settlement without waiting
- Practical microtransactions with minimal fees
- Trustless verification with PoW security
Perfect for the real-time PoW blockchain that Kaspathon celebrates.
MIT - Build, fork, and extend freely for Kaspathon and beyond!