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 in beta. The primary, default path today is the hosted API at https://api.aipowergrid.io/v1 — the coordinator is centralized. The decentralized mode described below is the goal P2P is building toward, not the current default.

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

Quick Start

Requirements

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

Status

P2P mode is currently in beta. The hybrid queue allows running both Redis and P2P simultaneously during transition.