Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.2 instead.
Reason given by maintainers: Missing direct httpx runtime dependency; use 0.1.2 or newer.

AI Power Grid — Python SDK

Open-model, OpenAI-compatible inference across community-operated GPUs.

Release status: grid-sdk is staged for its initial PyPI publication. The install command below becomes available when the first verified release is published; until then, use the OpenAI SDK with the Grid base URL shown below.

The Grid API speaks the OpenAI protocol, so this SDK is a thin layer over the official openai package: it points at the Grid, reads your key from the environment, and adds Grid-specific conveniences. Everything you know from the OpenAI SDK works unchanged.

Install

pip install grid-sdk

Quick start

Sign in at the Grid developer console, create an API key, then set it as AIPG_API_KEY:

from grid_sdk import Grid

client = Grid()  # reads AIPG_API_KEY from the environment

stream = client.chat.completions.create(
    model="gpt-oss-120b",
    messages=[{"role": "user", "content": "Explain AI Power Grid in one line."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)

See what's online

The Grid's available models change as workers connect and disconnect. Don't hardcode a model blindly — ask which ones are servable right now:

client = Grid()
print(client.online_models())
# ['gpt-oss-120b', 'qwen3-27b', ...]

An empty list means no workers are connected — requests will 503 until one is.

Credits

credits = client.grid.credits()
print(credits["total_spendable_usd"])

This is Core's canonical promotional, daily-free, and purchased account view. The SDK does not maintain a local free-use counter.

Async

import asyncio
from grid_sdk import AsyncGrid

async def main():
    client = AsyncGrid()
    resp = await client.chat.completions.create(
        model="gpt-oss-120b",
        messages=[{"role": "user", "content": "Hi"}],
    )
    print(resp.choices[0].message.content)

asyncio.run(main())

Video, img2img, ControlNet, LoRAs — the full Grid

The OpenAI-compatible surface covers text and basic txt2img. For the full media parameter surface, use client.grid, which calls the synchronous /v1 image and video endpoints:

client = Grid()

# Video:
result = client.grid.video(
    prompt="a timelapse of a city at night",
    model="LTX-2.3",
    width=768, height=512, seconds=4, fps=24,
)

# img2img / ControlNet / LoRAs — anything the workers support:
result = client.grid.image(
    prompt="make it watercolor",
    models=["FLUX.2 Klein 4B FP8"],
    source_image="<base64>",
    loras=[{"name": "watercolor", "model": 1.0}],
)

# Or full control with a raw payload:
result = client.grid.generate({"prompt": "...", "models": [...], "params": {...}})

client.grid waits for the synchronous Grid response and returns the finished OpenAI-shaped result. Use timeout for long media jobs; there is no SDK submit/poll mode on this /v1 client.

It's just OpenAI underneath

Grid subclasses openai.OpenAI, so anything the OpenAI SDK does — images, tool calling, structured output, the full .chat/.images/.models surface — works here too. You can also point existing OpenAI code at the Grid by setting base_url="https://api.aipowergrid.io/v1" if you'd rather not switch packages.

Config

Grid(api_key=...) Explicit key (overrides env)
AIPG_API_KEY Env var read when no key is passed
Grid(base_url=...) Override the endpoint (default https://api.aipowergrid.io/v1)

Links

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grid_sdk-0.1.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grid_sdk-0.1.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file grid_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: grid_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for grid_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 06d94ff8ba28d7354808e3f2ce56199c1fd6009a151cd954691244374ee4fbdf
MD5 6d0f49fb85fe9a5fc587422e2bde8cec
BLAKE2b-256 644e91911c3f183374bd055d7fc7d429279c8a58bbbfeed95e0145ca0037402b

See more details on using hashes here.

Provenance

The following attestation bundles were made for grid_sdk-0.1.1.tar.gz:

Publisher: release.yml on AIPowerGrid/grid-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grid_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: grid_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for grid_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44db4d5efc10ac54a42602add09915e9f5d74fc6e0f8f685388fcb3f2df02abe
MD5 cfd6cf467d78cd0854198aeea20aa018
BLAKE2b-256 3d3aaa0625a488c0d8b97f6b9146085a841ec35f521295b68932ad0951b80eb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for grid_sdk-0.1.1-py3-none-any.whl:

Publisher: release.yml on AIPowerGrid/grid-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page