Metadata-Version: 2.4
Name: modelgates
Version: 0.1.0
Summary: Official ModelGates SDK for Python
License: MIT
Project-URL: Homepage, https://modelgates.ai
Project-URL: Repository, https://github.com/modelgates/modelgates
Project-URL: Issues, https://github.com/modelgates/modelgates/issues
Keywords: modelgates,ai,sdk,openai,llm,chat,embeddings
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: openai>=1.0.0
Requires-Dist: httpx>=0.24.0

# modelgates

Official ModelGates SDK for Python. Drop-in replacement for the OpenAI SDK that routes requests through [ModelGates](https://modelgates.ai).

## Install

```bash
pip install modelgates
```

## Usage

```python
from modelgates import ModelGates

client = ModelGates(
    api_key="sk-mg-...",
    # optional attribution headers
    referer="https://your-site.com",
    title="Your App Name",
)

# Chat completions
completion = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(completion.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

# Embeddings
embedding = client.embeddings.create(
    model="openai/text-embedding-3-small",
    input="Hello world",
)

# List models (ModelGates-specific)
models = client.list_models()
print([m["name"] for m in models["data"]])

# Rankings
rankings = client.list_rankings("trending")
```

## Publish

```bash
cd packages/py-sdk
python -m build
python -m twine upload dist/*
```

Requires a PyPI account with access to the `modelgates` project.
