Skip to main content

grid-ai-sdk

Drop-in cost-optimizing proxy for OpenAI-compatible LLM clients.

Install

pip install grid-ai-sdk

The Python module remains grid_ai for clean imports — pip install grid-ai-sdk installs the package, from grid_ai import Grid uses it.

Use

import openai
from grid_ai import Grid

grid = Grid(
    api_key="grd_live_...",
    provider_keys={"openai": "sk-..."},
)
client = grid.wrap(openai.OpenAI())

resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Summarize this."}],
)
print(resp["_grid"])
# {'routed_to': 'gpt-4o-mini', 'provider': 'openai', 'cost_usd': 0.000045,
#  'saved_usd': 0.000201, 'routing_ms': '94ms', 'complexity': 'low'}

BYOK

Pass your own provider API keys via provider_keys. Grid never stores them.

Supported providers in v1: openai, deepseek, mistral, anthropic.

Streaming

For v1, streamed requests (stream=True) bypass grid and go directly through your wrapped client. Streamed grid routing lands in v1.1.

Quality override

Force a complexity tier for any request:

grid = Grid(api_key="grd_live_...", provider_keys=..., quality_override="high")

Or per-call by passing extra_headers={"X-Grid-Quality": "high"} to your client.

Metadata

Release files for grid-ai-sdk 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grid-ai-sdk 1.0.1
File Size Uploaded Provenance Actions
grid_ai_sdk-1.0.1.tar.gz 2.7 kB Without provenance Details for grid_ai_sdk-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for grid-ai-sdk 1.0.1
File Interpreter ABI Platform Actions
grid_ai_sdk-1.0.1-py3-none-any.whl Python 3 none any Details for grid_ai_sdk-1.0.1-py3-none-any.whl

Total release size: 5.9 kB

Release files / grid_ai_sdk-1.0.1.tar.gz

Download URL grid_ai_sdk-1.0.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c1f5e7fcaf7f620b3a04114706864c378f14e98e1ebdf345b8c27cd19e3b4190
BLAKE2b-256 checksum
How to use checksums
59e196aec2fd89e4d67db523e9e0104c35baaaeba964d1133f486399f5de7511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / grid_ai_sdk-1.0.1-py3-none-any.whl

Download URL grid_ai_sdk-1.0.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2389792d8f7bd44115e2e98624a82671f18d37bf51742ef6f804ded095b4cb7a
BLAKE2b-256 checksum
How to use checksums
a01d2148400dcfcc383a9f10b60a6ebd8bf6fd8870b8ce51c968c2f57f85b648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for grid-ai-sdk 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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