Infernet CLI/TUI Implementation Plan

🧠 Core Concept: Infernet

Infrastructure + Inference + Network

A peer-to-peer network where anyone can provide inference capacity and consume AI services with X402 micropayments.

πŸ“‹ Implementation Plan

Based on the diagram.json analysis and Infernet concept, here’s the adapted development plan:

Phase 1: Core Infernet Client Foundation

1. Node Discovery & Selection System

  • Current: Basic API form for single endpoint
  • Target: Multi-node discovery and selection interface
  • Implementation:
    • Model selection screen showing available inference nodes
    • Pricing comparison (USDC/token rates)
    • Reputation and latency metrics display
    • Auto-selection by best price/quality ratio

2. X402 Payment Integration

  • Current: Basic auth config
  • Target: Seamless micropayment system
  • Implementation:
    • Wallet connection interface (Wallet API v2)
    • X402 payment flow for inference requests
    • Real-time payment status tracking
    • USDC balance monitoring

3. Enhanced Configuration System

  • Current: Generic server/theme config
  • Target: Infernet-specific configuration
  • Implementation:
    • Wallet address management
    • Payment preferences (max price per token/image)
    • Preferred models and node selection criteria
    • .env support for wallet private keys and RPC endpoints

Phase 2: Inference Request Management

4. Smart Query System

  • Current: Simple API requests
  • Target: AI inference with automatic node selection
  • Implementation:
    • Multi-model support (llama-3.3, mistral-7b, stable-diffusion)
    • Automatic best-price node discovery
    • Request templates for common AI tasks
    • Token/cost estimation before execution

5. Node Registry Integration

  • Current: Static endpoint configuration
  • Target: Dynamic node discovery from Base smart contract
  • Implementation:
    • Smart contract integration for node registry
    • Real-time node availability checking
    • Node metadata display (models, pricing, reputation)
    • Automatic registry updates

6. Session & Status Management

  • Current: Basic request/response
  • Target: Persistent inference sessions
  • Implementation:
    • Node connection status monitoring
    • Session management for multi-turn conversations
    • Ping system for node availability
    • Failover to backup nodes

Phase 3: Advanced Features

7. Pre-written Request Templates

  • Target: Quick access to common AI tasks
  • Implementation:
    • Template library (code generation, image creation, text analysis)
    • Parameter substitution from config
    • Custom template creation and sharing
    • Template marketplace integration

8. Payment & Transaction History

  • Target: Complete payment transparency
  • Implementation:
    • Transaction history screen
    • Cost analytics (spending per model/node)
    • Payment receipt management
    • Budget controls and alerts

9. Node Provider Tools

  • Target: Support for running inference nodes
  • Implementation:
    • Node registration interface
    • Pricing configuration
    • Model deployment management
    • Earnings tracking

Phase 4: TUI Screen Implementation

New Screens Required:

  1. Node Browser - Discover and compare inference nodes
  2. Wallet Manager - Connect wallet, view balance, manage payments
  3. Inference Studio - Send prompts, manage conversations
  4. Transaction History - Payment history and cost analytics
  5. Node Registration - Register your own inference node
  6. Template Library - Pre-built AI request templates
  7. Settings Enhanced - Infernet-specific configuration

Phase 5: Integration Components

10. Blockchain Integration

  • Smart contract interaction for node registry
  • Wallet API v2 integration
  • X402 payment protocol implementation
  • Base network configuration

11. AI Model Support

  • Llama 3.3 integration
  • Mistral 7B support
  • Stable Diffusion image generation
  • Custom model plugin system

πŸ› οΈ Technical Architecture Updates

Current Structure Enhancement:

ein-cli/
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ infernet/          # New: Infernet protocol client
β”‚   β”œβ”€β”€ wallet/            # New: Wallet integration
β”‚   β”œβ”€β”€ nodes/             # New: Node discovery & management
β”‚   β”œβ”€β”€ payments/          # New: X402 payment handling
β”‚   └── templates/         # New: Request templates
β”œβ”€β”€ tui/screens/
β”‚   β”œβ”€β”€ node_browser.go    # New: Node discovery interface
β”‚   β”œβ”€β”€ wallet.go          # New: Wallet management
β”‚   β”œβ”€β”€ inference.go       # New: AI interaction screen
β”‚   β”œβ”€β”€ history.go         # Enhanced: Transaction history
β”‚   └── node_setup.go      # New: Node provider interface

Configuration Enhancement:

type InfernetConfig struct {
    Wallet      WalletConfig      `json:"wallet"`
    Nodes       NodeConfig        `json:"nodes"`
    Models      ModelPreferences  `json:"models"`
    Payments    PaymentConfig     `json:"payments"`
    Templates   []RequestTemplate `json:"templates"`
}

🎯 MVP Deliverables

Hackathon Demo Flow:

  1. Launch TUI β†’ Main menu shows Infernet options
  2. Connect Wallet β†’ Wallet API v2 integration
  3. Browse Nodes β†’ Discover inference providers
  4. Select Model β†’ Choose llama-3.3 with best price
  5. Send Prompt β†’ β€œExplain Web3 in simple terms”
  6. Auto Payment β†’ X402 micropayment processed
  7. View Result β†’ AI response displayed
  8. Check History β†’ Transaction and usage analytics

Success Metrics:

  • Successful X402 payments for inference
  • Multi-node price comparison
  • Sub-5-second inference with payment
  • Complete transaction transparency
  • Intuitive TUI navigation

πŸš€ Implementation Priority

Week 1: Core infrastructure (wallet, nodes, payments) Week 2: TUI screens and user experience
Week 3: Templates, history, and polish Week 4: Demo preparation and testing

This plan transforms the generic API client into a specialized Infernet client that democratizes AI access through decentralized inference and micropayments.

Ver tambien: ein-cli Docs, CLI PRS, project-architecture