For Developers
Build on The Grid. Access decentralized AI inference, launch tokens, and integrate with the AIPG ecosystem.
Quick Start
- Get an API key at api.aipowergrid.io/register
- 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 →
| Endpoint | Format | Description |
|---|---|---|
POST /v1/chat/completions | OpenAI | Text gen with streaming |
POST /v1/messages | Anthropic | Text gen with streaming |
POST /v1/images/generations | OpenAI | Image generation |
GET /v1/models | OpenAI | List models currently online |
Authentication: Authorization: Bearer YOUR_KEY or apikey: YOUR_KEY
Legacy API (v2)
Poll-based generation. Still supported for backward compatibility.
| Endpoint | Description |
|---|---|
POST /api/v2/generate/text/async | Submit text generation |
GET /api/v2/generate/text/status/{id} | Poll for text results |
POST /api/v2/generate/async | Submit image generation |
GET /api/v2/generate/status/{id} | Poll for image results |
GET /api/v2/status/models | List 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 openaifrom openai import OpenAI
client = OpenAI(base_url="https://api.aipowergrid.io/v1", api_key="your-key")JavaScript/TypeScript:
npm install openaiimport 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.
| Bot | Purpose | Repo |
|---|---|---|
| Image Bot | Generate images in Discord | grid-discord-image-bot |
| News Bot | AI-powered news summaries | grid-discord-news-bot |
| Aigarth | Chat with AI in Discord | aigarth-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
| Contract | Address |
|---|---|
| AIPG Token | 0xa1c0deCaFE3E9Bf06A5F29B7015CD373a9854608 |
| StakingVault | 0x3ED14A6D5A48614D77f313389611410d38fd8277 |
| Grid Proxy | 0x79F39f2a0eA476f53994812e6a8f3C8CFe08c609 |
Grid Modules (via Proxy)
| Module | Address |
|---|---|
| ModelVault | 0xf2A3bA5C4b56E85e022c5079B645120CE7B6d199 |
| RecipeVault | 0x58Dc9939FA30C6DE76776eCF24517721D53A9eA0 |
| JobAnchor | 0x1aee3a3e4F2C05814d86cF2426Cf20Ed5c1bfa32 |
| WorkerRegistry | 0x0a3075b1787070210483d3e4845fE58d41c28438 |
| RoleManager | 0x59144e0730638f652B9717379c5CA634da7CE926 |
Network
| Property | Value |
|---|---|
| Chain | Base Mainnet |
| Chain ID | 8453 |
| RPC | https://mainnet.base.org |
| Explorer | basescan.org |
Repositories
| Repo | Purpose |
|---|---|
| system-core | Grid API server (Flask + FastAPI) |
| grid-inference-worker | Text/LLM worker |
| comfy-bridge | Image worker (ComfyUI) |
| aipg-documentation | These docs |
Support
- Discord: discord.gg/W9D8j6HCtC
- GitHub Issues: Open issues on the relevant repo
- Models online: api.aipowergrid.io/v1/models