Metadata-Version: 2.4
Name: custom-oss-gateway
Version: 0.1.0
Summary: A lightweight LLM gateway with routing, fallbacks, caching, and provider abstractions.
Author: Rounak
License-Expression: MIT
Project-URL: Homepage, https://github.com/Rounak-iitm/-custom-OSS-gateway-solution
Project-URL: Repository, https://github.com/Rounak-iitm/-custom-OSS-gateway-solution
Project-URL: Issues, https://github.com/Rounak-iitm/-custom-OSS-gateway-solution/issues
Keywords: llm,gateway,routing,fastapi,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.115.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.8.0
Requires-Dist: pyyaml>=6.0.1
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: build>=1.2.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"

# Custom OSS Gateway

A lightweight Python library for routing requests between LLM providers with:

- provider selection heuristics
- fallback providers
- request caching
- cost logging
- FastAPI-compatible HTTP interface

## Installation

```bash
pip install -e .
```

## Usage

```python
from gateway.config import GatewayConfig, ProviderConfig, RoutingRule, CacheConfig
from gateway.router import select_provider

config = GatewayConfig(
    providers={
        "cheap": ProviderConfig(kind="openai", model="gpt-4o-mini", api_key_env="OPENAI_API_KEY"),
        "strong": ProviderConfig(kind="openai", model="gpt-4o", api_key_env="OPENAI_API_KEY"),
    },
    routing=[
        RoutingRule(name="default", provider="cheap"),
    ],
    fallback_chain=["strong"],
    cache=CacheConfig(),
)

provider = select_provider(config, [{"role": "user", "content": "hello"}], "auto")
print(provider.model)
```
