Metadata-Version: 2.4
Name: grid-ai-sdk
Version: 1.0.1
Summary: Grid SDK — drop-in cost-optimizing proxy for OpenAI-compatible LLM clients.
Project-URL: Homepage, https://grid-ai.onrender.com
Author-email: Grid <noreply@grid-ai.dev>
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27
Description-Content-Type: text/markdown

# 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

```python
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:

```python
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.
