Skip to Content
Quick Start

Quick Start

From zero to your first AI call in about two minutes.

1. Create an API key

Sign in at console.aipowergrid.io  — Google, GitHub, or a wallet. Durable production keys belong to an authenticated human account; there is no anonymous key-issuance flow. Your key is shown once; store it in a local secret manager or environment variable, not chat.

export AIPG_API_KEY="your-key-here"

2. Check what’s online

The Grid runs on community workers, so the live model list changes as workers connect and disconnect. Always start here:

curl https://api.aipowergrid.io/v1/models

An empty data array means no streaming workers are connected right now — chat requests will return 503 until one comes online. Image generation runs on a separate worker pool and keeps working either way.

3. Make your first call

The API is OpenAI-compatible — any OpenAI client works. Pick a model from the step-2 list:

curl -N https://api.aipowergrid.io/v1/chat/completions \ -H "Authorization: Bearer $AIPG_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-oss-120b", "messages": [{"role": "user", "content": "Explain AI Power Grid in one sentence."}], "stream": true }'

Python (pip install openai):

from openai import OpenAI client = OpenAI( base_url="https://api.aipowergrid.io/v1", api_key="your-key", ) stream = client.chat.completions.create( model="gpt-oss-120b", # use a model from /v1/models messages=[{"role": "user", "content": "Hello, Grid!"}], stream=True, ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="", flush=True)

JavaScript (npm install openai):

import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://api.aipowergrid.io/v1', apiKey: 'your-key', }); const stream = await client.chat.completions.create({ model: 'gpt-oss-120b', messages: [{ role: 'user', content: 'Hello, Grid!' }], stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ''); }

4. Generate an image

curl https://api.aipowergrid.io/v1/images/generations \ -H "Authorization: Bearer $AIPG_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "a lighthouse in a thunderstorm, cinematic"}'

Returns a URL to the finished image (typically 10–60s depending on worker load).

Where next