Skip to content

Routstr Core DocumentationΒΆ

Welcome to the official documentation for Routstr Core - a FastAPI-based reverse proxy that enables Bitcoin micropayments for OpenAI-compatible APIs using the Cashu eCash protocol.

What is Routstr Core?ΒΆ

Routstr Core is a payment proxy that sits between API clients and OpenAI-compatible services. It enables:

  • Pay-per-request billing using Bitcoin eCash tokens
  • Seamless integration with existing OpenAI clients
  • Privacy-preserving payments through the Cashu protocol
  • Flexible pricing models with per-token or per-request billing
  • Multi-provider support for various AI model providers

Key FeaturesΒΆ

  • πŸͺ™ Cashu Wallet Integration - Accept Lightning payments and redeem eCash tokens
  • πŸ”‘ API Key Management - Secure key storage with balance tracking
  • πŸ’° Dynamic Pricing - Model-based pricing with live BTC/USD conversion
  • πŸŽ›οΈ Admin Dashboard - Web interface for balance and key management
  • 🌐 Nostr Discovery - Find providers through decentralized relay network
  • πŸ‹ Docker Support - Easy deployment with optional Tor hidden service
  • ⚑ Lightning Fast - Minimal latency overhead for API requests

How It WorksΒΆ

sequenceDiagram
    participant Client
    participant Routstr as Routstr Proxy
    participant DB as Database
    participant Upstream as AI Provider
    participant Wallet as Cashu Wallet

    Client->>Routstr: API Request + eCash Token
    Routstr->>Wallet: Validate & Redeem Token
    Wallet-->>Routstr: Token Value (sats)
    Routstr->>DB: Store/Update Balance
    Routstr->>Upstream: Forward API Request
    Upstream-->>Routstr: API Response + Usage Data
    Routstr->>DB: Deduct Actual Cost
    Routstr-->>Client: API Response

Use CasesΒΆ

  • AI Application Developers - Add Bitcoin payments to your AI apps without managing infrastructure
  • API Resellers - Resell API access with custom pricing and profit margins
  • Privacy-Focused Users - Access AI models without revealing personal information
  • Micropayment Experiments - Test new business models with instant, small payments

Getting HelpΒΆ

  • πŸ“– Browse the User Guide for detailed usage instructions
  • πŸ› Report issues on GitHub
  • πŸ’¬ Join the community discussions
  • πŸ”§ Check the API Reference for technical details

LicenseΒΆ

Routstr Core is open source software licensed under the GPLv3. See the LICENSE file for details.