Grid SDK — drop-in cost-optimizing proxy for OpenAI-compatible LLM clients.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grid_ai_sdk-1.0.1.tar.gz.
File metadata
- Download URL: grid_ai_sdk-1.0.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1f5e7fcaf7f620b3a04114706864c378f14e98e1ebdf345b8c27cd19e3b4190
|
|
| MD5 |
55e9f2b47afa21eb88d2e9811bda27f2
|
|
| BLAKE2b-256 |
59e196aec2fd89e4d67db523e9e0104c35baaaeba964d1133f486399f5de7511
|
File details
Details for the file grid_ai_sdk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: grid_ai_sdk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2389792d8f7bd44115e2e98624a82671f18d37bf51742ef6f804ded095b4cb7a
|
|
| MD5 |
e843b42c93a218e883f82d1d24664400
|
|
| BLAKE2b-256 |
a01d2148400dcfcc383a9f10b60a6ebd8bf6fd8870b8ce51c968c2f57f85b648
|