Use AIPG in 60 seconds

Use AIPG in 60 seconds

AI Power Grid exposes one authenticated API for open text, image, video, and audio models running across community-operated GPUs. Existing OpenAI-compatible clients can use the text API by changing two values:

Base URL: https://api.aipowergrid.io/v1
API key:  your scoped Grid key
  1. Create an API key with inference.submit and account.read. The second scope lets quote-aware clients inspect credit without granting them account-management access.
  2. Check your credit balance. Add funds only if the Console reports that you do not have enough spendable credit for the request you want to run.
  3. Inspect the public price book and current same-model comparisons, then quote the exact request when your client needs a budget guard.
  4. Check GET /v1/models for the text models currently online. Use auto when you want the Grid to choose.
  5. Run the smoke test below, then pick a client and paste its configuration.

Fastest smoke test

This makes one bounded text request. It proves the key, scopes, balance, model route, and streaming-independent response path before another framework adds its own configuration layer.

export AIPG_API_KEY="your-scoped-key"
 
curl --fail-with-body https://api.aipowergrid.io/v1/chat/completions \
  -H "Authorization: Bearer $AIPG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Reply with: Grid connected"}],
    "max_tokens": 32,
    "stream": false
  }'

An HTTP 402 means the account needs more currently spendable credit; it does not mean the key or client configuration is invalid.

⚠️

Grid requests may be processed by remote community-operated workers. Do not send secrets, credentials, personal data, or regulated content unless a separately verified confidential-compute deployment meets your requirements.

OpenAI SDK

The standard OpenAI SDK needs no AIPG-specific package.

pip install openai
export AIPG_API_KEY="your-scoped-key"
import os
from openai import OpenAI
 
client = OpenAI(
    base_url="https://api.aipowergrid.io/v1",
    api_key=os.environ["AIPG_API_KEY"],
)
 
stream = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Explain the Grid in one sentence."}],
    max_tokens=128,
    stream=True,
)
 
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)

LiteLLM

LiteLLM works today through its standard OpenAI-compatible route. Native AIPG provider and documentation pull requests are under upstream review.

pip install litellm
export AIPG_API_KEY="your-scoped-key"
import os
from litellm import completion
 
response = completion(
    model="openai/auto",
    api_base="https://api.aipowergrid.io/v1",
    api_key=os.environ["AIPG_API_KEY"],
    messages=[{"role": "user", "content": "Say hello from the Grid."}],
    max_tokens=64,
)
 
print(response.choices[0].message.content)

The native provider becomes an upstream integration only if the LiteLLM pull request is accepted and merged.

Open WebUI

Open WebUI discovers and streams Grid text models through a standard OpenAI connection. No custom plugin or AIPG fork is required.

  1. Open Admin settings -> Connections -> OpenAI.
  2. Add https://api.aipowergrid.io/v1 as the URL.
  3. Enter the scoped Grid API key and save.
  4. Select one of the discovered models.

For a multi-user deployment, prefer each user’s Direct Connection over one shared server key. Direct Connections keep the key in that user’s browser profile, which must therefore be treated as sensitive. A shared admin connection spends one Grid account’s credits for every permitted user and needs your own authentication, rate limits, and abuse controls.

The standard Open WebUI connection covers text chat and streaming. It does not expose the Grid’s native media endpoints. The first-party deployment at chat.aipowergrid.io demonstrates compatibility; it does not imply Open WebUI endorsement.

Cline

Cline has an OpenAI Compatible provider path, so it can use the Grid without a custom extension.

  1. Open Cline settings and select OpenAI Compatible.
  2. Set Base URL to https://api.aipowergrid.io/v1.
  3. Enter the scoped Grid API key.
  4. Enter a current tool-capable model ID from /v1/models.
  5. Use Cline’s connection test before starting a task.

Model discovery proves availability, not tool-call quality. Validate the model you select against your workflow before allowing autonomous changes. Cline’s OpenAI-compatible guide documents the corresponding client controls.

Continue

Store the key in ~/.continue/.env; do not commit it inside a project:

AIPG_API_KEY=your-scoped-key

Add this to ~/.continue/config.yaml:

name: AI Power Grid
version: 1.0.0
schema: v1
 
models:
  - name: AIPG Auto
    provider: openai
    model: auto
    apiBase: https://api.aipowergrid.io/v1
    apiKey: ${{ secrets.AIPG_API_KEY }}
    roles:
      - chat
      - edit
    defaultCompletionOptions:
      maxTokens: 512

Restart the IDE after changing Continue’s secret file. Choose a concrete model instead of auto when a workflow depends on a specific context window or tool behavior. Continue documents the same custom-base configuration in its OpenAI provider guide.

LangChain

LangChain uses its existing ChatOpenAI compatibility surface.

pip install langchain-openai
export AIPG_API_KEY="your-scoped-key"
import os
from langchain_openai import ChatOpenAI
 
model = ChatOpenAI(
    model="auto",
    base_url="https://api.aipowergrid.io/v1",
    api_key=os.environ["AIPG_API_KEY"],
    use_responses_api=False,
    max_tokens=256,
)
 
for chunk in model.stream("Explain decentralized inference briefly."):
    print(chunk.text, end="", flush=True)

Keep use_responses_api=False for the tested Chat Completions route. Tool calling depends on the selected worker backend. The maintained cookbook and protocol tests live in grid-provider-integrations/langchain-aipg.

Vercel AI SDK

Install the native community provider:

npm install ai @aipowergrid/ai-sdk-provider
import { streamText } from 'ai';
import { aipg } from '@aipowergrid/ai-sdk-provider';
 
const result = streamText({
  model: aipg('auto'),
  prompt: 'Explain the Grid in one sentence.',
  maxOutputTokens: 128,
});
 
for await (const chunk of result.textStream) process.stdout.write(chunk);

Keep AIPG_API_KEY server-side. Never expose it through a NEXT_PUBLIC_* variable or a client component. @aipowergrid/[email protected] also provides typed image and experimental video models, a music helper, discovery, quotes, and credit inspection. Its upstream AI SDK documentation pull request is still under maintainer review; npm publication does not imply Vercel endorsement.

ElizaOS

Install the published community plugin:

elizaos plugins add @aipowergrid/plugin-aipg
export AIPG_API_KEY="your-scoped-key"

The plugin exposes Grid-backed text model handlers plus explicit text, image, video, audio, model-discovery, and credit-status actions. Keep the key in the agent runtime environment, not in character files, prompts, or action parameters. @aipowergrid/[email protected] is public; its ElizaOS registry entry remains under upstream review and the package does not imply an ElizaOS partnership.

n8n

Install @aipowergrid/[email protected] from Settings -> Community Nodes, then create an AI Power Grid API credential with a scoped key that has account.read and inference.submit. The native node discovers online models and exposes completed text, image, video, and audio generation.

The public package has npm provenance from its dedicated source repository and passes n8n’s official community package scanner and Creator Portal automated review. The required uncut demonstration video has been submitted and the package is now Under Review in the Creator Portal. It is not yet an n8n-verified community node and does not imply n8n endorsement.

When community packages are disabled, the built-in HTTP Request node is a working fallback:

  1. Create a reusable Header Auth credential.
  2. Set the header name to Authorization and value to Bearer YOUR_GRID_KEY.
  3. Create a POST request to https://api.aipowergrid.io/v1/chat/completions.
  4. Send a JSON body:
{
  "model": "auto",
  "messages": [{"role": "user", "content": "Summarize this workflow."}],
  "max_tokens": 128,
  "stream": false
}

Use n8n’s encrypted credential store rather than placing the key in node parameters or workflow JSON.

Grid CLI and local MCP

The maintained grid-skill repository provides a CLI and local stdio MCP server for model discovery, quotes, credit inspection, and text, image, video, and audio generation. Install the current public release from npm:

npm install --global @aipowergrid/mcp
 
aipg login
aipg models
aipg quote --model "Krea 2 Turbo" --modality image

Configure an MCP client to launch the locally installed stdio server:

{
  "mcpServers": {
    "aipowergrid": {
      "command": "aipg-mcp",
      "env": {
        "GRID_API_KEY": "${GRID_API_KEY}"
      }
    }
  }
}

Use the client’s local secret store when available; interpolation syntax varies by client. The local stdio server accepts a durable scoped key from secret storage. MCP clients that support remote Streamable HTTP and OAuth 2.1 can use:

https://api.aipowergrid.io/v1/mcp

The remote service performs browser consent and accepts only short-lived, audience-bound user tokens. It will not relay durable Grid API keys between systems. Tokens expire after 15 minutes and have no refresh token.

Shipping a public integration?

Builders turning one of these configurations into a public integration, reusable example, or working demo can apply for $5-$20 of bounded builder credits. Applications are reviewed manually, credits expire after 60 days, and applying does not guarantee a grant. The public application must not contain API keys, Grid account IDs, wallet material, private data, or other credentials.

Native distribution status

ToolCurrent statusWhat that means
LiteLLMProvider and docs PRs under upstream reviewThe compatible configuration above works now; native acceptance still belongs to LiteLLM maintainers.
DifyCloud and Community Edition credentialed E2E passedThe Marketplace submission is under upstream review; acceptance remains with Dify’s maintainers.
ElizaOS@aipowergrid/[email protected] publishedThe registry PR remains under upstream review.
Vercel AI SDK@aipowergrid/[email protected] publishedNative text, image, video, and music helpers work; the upstream docs PR remains under review.
n8n@aipowergrid/[email protected] published with dedicated-repo provenance; scanner and automated portal review passedDemo submitted; Creator Portal status is Under Review. The HTTP Request fallback also works.
Grid CLI + MCP@aipowergrid/[email protected] publishedCLI, local stdio MCP, browser login, and the authenticated remote HTTP MCP resource are live.
Open WebUIStandard connection testedNo provider-specific plugin is required.
ClineStandard OpenAI Compatible configurationNo provider-specific plugin is required.
ContinueStandard OpenAI provider with a custom API baseKeep the key in Continue’s secret storage.
LangChainStandard client path and maintained cookbook testedUse ChatOpenAI today.

Track source, reproducible tests, release gates, and upstream links in the public provider integrations repository. An open pull request, staged package, or first-party test is not a partnership, endorsement, or upstream adoption.

Authentication and billing

  • inference.submit authorizes generation.
  • account.read is also required when an integration reads credit status or quotes on behalf of the account.
  • Keep keys server-side unless a tool explicitly implements a personal browser connection and you accept that storage model.
  • An HTTP 402 means the account lacks enough usable credit for the quoted request. Fund that account in the Grid console.
  • Model availability follows connected workers and can change. A discovered model is not an uptime guarantee.

For raw endpoint shapes, streaming events, and media contracts, continue to the Generation API reference.