For Developers

For Developers

Build on The Grid. Access decentralized AI inference, launch tokens, and integrate with the AIPG ecosystem.


Quick Start

  1. Get an API key at api.aipowergrid.io/register
  2. Call the streaming API — it’s OpenAI compatible
from openai import OpenAI
 
client = OpenAI(
    base_url="https://api.aipowergrid.io/v1",
    api_key="your-grid-api-key",
)
 
stream = client.chat.completions.create(
    model="grid/llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "What is AI Power Grid?"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

That’s it. Any tool that works with OpenAI works with The Grid.


API Endpoints

Streaming API (New)

Real token-by-token streaming. Full docs →

EndpointFormatDescription
POST /v1/chat/completionsOpenAIText gen with streaming
POST /v1/messagesAnthropicText gen with streaming
POST /v1/images/generationsOpenAIImage generation
GET /v1/modelsOpenAIList models currently online

Authentication: Authorization: Bearer YOUR_KEY or apikey: YOUR_KEY

Legacy API (v2)

Poll-based generation. Still supported for backward compatibility.

EndpointDescription
POST /api/v2/generate/text/asyncSubmit text generation
GET /api/v2/generate/text/status/{id}Poll for text results
POST /api/v2/generate/asyncSubmit image generation
GET /api/v2/generate/status/{id}Poll for image results
GET /api/v2/status/modelsList all models

Authentication: apikey: YOUR_KEY header

Swagger docs: api.aipowergrid.io/api


SDK

Use the standard OpenAI SDK

The API is OpenAI-compatible, so you don’t need a custom SDK — point the official openai package (or any OpenAI client in any language) at the Grid base URL. Query /v1/models for the list of models currently online and use one of those names.

Python:

pip install openai
from openai import OpenAI
client = OpenAI(base_url="https://api.aipowergrid.io/v1", api_key="your-key")

JavaScript/TypeScript:

npm install openai
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.aipowergrid.io/v1', apiKey: 'your-key' });

curl:

curl -N https://api.aipowergrid.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"grid/llama-3.3-70b-versatile","messages":[{"role":"user","content":"Hi"}],"stream":true}'

Discord Bots

Pre-built bots powered by The Grid.

BotPurposeRepo
Image BotGenerate images in Discordgrid-discord-image-bot
News BotAI-powered news summariesgrid-discord-news-bot
AigarthChat with AI in Discordaigarth-chatbot

Token Factory

Launch your own AI-powered token with built-in access to The Grid.

Read the full Token Factory documentation →

  • Deploy an ERC-20 on Base
  • Your token = compute credits for AI generation
  • Revenue share from usage
  • Access to all Grid models and workers

Smart Contracts

All contracts on Base Mainnet (Chain ID: 8453).

Core

ContractAddress
AIPG Token0xa1c0deCaFE3E9Bf06A5F29B7015CD373a9854608
StakingVault0x3ED14A6D5A48614D77f313389611410d38fd8277
Grid Proxy0x79F39f2a0eA476f53994812e6a8f3C8CFe08c609

Grid Modules (via Proxy)

ModuleAddress
ModelVault0xf2A3bA5C4b56E85e022c5079B645120CE7B6d199
RecipeVault0x58Dc9939FA30C6DE76776eCF24517721D53A9eA0
JobAnchor0x1aee3a3e4F2C05814d86cF2426Cf20Ed5c1bfa32
WorkerRegistry0x0a3075b1787070210483d3e4845fE58d41c28438
RoleManager0x59144e0730638f652B9717379c5CA634da7CE926

Network

PropertyValue
ChainBase Mainnet
Chain ID8453
RPChttps://mainnet.base.org
Explorerbasescan.org

Repositories

RepoPurpose
system-coreGrid API server (Flask + FastAPI)
grid-inference-workerText/LLM worker
comfy-bridgeImage worker (ComfyUI)
aipg-documentationThese docs

Support