modelgates
Official ModelGates SDK for Python. Drop-in replacement for the OpenAI SDK that routes requests through ModelGates.
Install
pip install modelgates
Usage
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
cd packages/py-sdk
python -m build
python -m twine upload dist/*
Requires a PyPI account with access to the modelgates project.
Metadata
Release files for modelgates 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| modelgates-0.1.0.tar.gz | 3.6 kB | Without provenance | Details for modelgates-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| modelgates-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for modelgates-0.1.0-py3-none-any.whl |
Total release size: 7.2 kB
Release files / modelgates-0.1.0.tar.gz
| Download URL | modelgates-0.1.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f58b9c7cdeede2964bfef08ddc254b4056d986670c378eee6ac78d40a2269f1
|
|
BLAKE2b-256 checksum How to use checksums |
3f04448217d2978f04de927bec66fcb8b0c8f077c568a5944789141e338b00f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / modelgates-0.1.0-py3-none-any.whl
| Download URL | modelgates-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1cfd1e90d624152ba180f32f6da33803169ed03c9656c41ba94ffb15ee7c63c
|
|
BLAKE2b-256 checksum How to use checksums |
b6399cdee05eb5ba07651f4c41df3a6f4d731973d48489f9f9d763b7857991ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Security for modelgates 0.1.0
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.