P2P Mode (Beta)Overview

P2P Mode (Decentralized API)

P2P mode is designed to let AI Power Grid run in a decentralized mode using libp2p gossipsub, with no central server required.

P2P mode is a default-off prototype, not a supported beta network. The production path today is the hosted coordinator at https://api.aipowergrid.io/v1 using Redis and authenticated worker WebSockets. The source prototype does not yet provide persistent peer identity, signed claims, replay protection, or production multi-node tests.

Why P2P?

Centralized (Default)Decentralized (P2P)
Single API serverMultiple API nodes
Redis job queueGossipsub messaging
Single point of failureNo single point of failure
You run the serverNetwork runs itself

The Vision

┌─────────────────────────────────────────────────────────────────┐
│                         P2P MESH                                │
│                   (libp2p gossipsub)                            │
│                                                                 │
│   Every node connects to every other node.                      │
│   The goal: no central server, no single point of failure —     │
│   the Grid runs itself.                                         │
└────────────┬──────────────────────────┬─────────────────────────┘
             │                          │
    ┌────────▼────────┐        ┌────────▼────────┐
    │   API Node 1    │        │   API Node 2    │    ... N nodes
    │   (anywhere)    │        │   (anywhere)    │
    └────────▲────────┘        └────────▲────────┘
             │                          │
        HTTP request               HTTP request
             │                          │
    ┌────────┴────────┐        ┌────────┴────────┐
    │     User A      │        │     User B      │
    └─────────────────┘        └─────────────────┘


    ┌─────────────────┐        ┌─────────────────┐
    │   Worker 1      │        │   Worker 2      │    ... N workers
    │   (your PC)     │        │   (cloud GPU)   │
    │                 │        │                 │
    │   Ollama/vLLM   │        │   Ollama/vLLM   │
    └────────┬────────┘        └────────┬────────┘
             │                          │
             └──────────────────────────┘
                        P2P mesh

What P2P Mode Aims to Enable

These are the design goals of P2P mode, not guarantees of the current beta:

  • No Central Server: Jobs distributed via gossipsub, not Redis
  • Permissionless: Anyone can run a worker or API node
  • Censorship Resistant: Designed so there’s no central point to shut down
  • Trustless: Deterministic claim resolution, aiming to avoid voting
  • Self-Healing: Nodes join and leave, network adapts

Design and Readiness

Prototype Requirements

  • Python 3.11+
  • libp2p and trio packages
  • At least one bootstrap node address
pip install libp2p trio

Status

P2P code exists in grid-core/grid_api/services/p2p, but the production queue does not dispatch through it. The hybrid queue is experimental and must not carry billed jobs until the trust, identity, replay, accounting, and multi-node verification gates in the readiness pages are closed.