Metadata-Version: 2.4
Name: sievellm
Version: 0.3.0
Summary: Smart AI router — filters requests to the right model, saving 40-80% on costs
Project-URL: Homepage, https://github.com/kyledensley/sieve
Author: Kyle Densley
License-Expression: MIT
Keywords: ai,cost-optimization,llm,openai,router,sieve
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: openai>=1.0.0
Provides-Extra: all
Requires-Dist: anthropic>=0.18.0; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.18.0; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: anthropic>=0.18.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# Sievellm

**Smart AI router — automatically routes to the right model.**

> 🚧 **Early Development** — Works, feedback welcome!

Stop overpaying for AI. Sievellm uses AI to detect query complexity and routes simple questions to cheap models, complex ones to capable models — saving you 40-80% on API costs.

![Sieve Demo](demo.gif?v=3)

## Why Sievellm?

| | LiteLLM | Sievellm |
|--|---------|----------|
| Setup | Docker, Postgres, YAML | `pip install sievellm` |
| Routing | Manual rules you configure | **AI auto-detects complexity** |
| Code | Proxy server + config | One line: `route("question")` |

## Installation

```bash
pip install sievellm
```

## Quick Start

```python
from sieve import route

# Simple query → automatically routes to cheap model (gpt-4o-mini)
response = route("What is 2+2?")
print(response)  # 4
print(f"Model: {response.model_used}")  # gpt-4o-mini
print(f"Cost: ${response.cost_usd:.6f}")  # ~$0.000007

# Complex query → automatically routes to capable model (gpt-4-turbo)
response = route("Explain the trade-offs between microservices and monoliths")
print(f"Model: {response.model_used}")  # gpt-4-turbo
```

## Setup

```bash
export OPENAI_API_KEY="sk-..."
```

## How It Works

1. **AI Classification** — Uses GPT-4o-mini to rate query complexity (costs ~$0.00001)
2. **Smart Routing** — Routes to cheap/mid/expensive tier based on complexity
3. **Cost Tracking** — Returns actual cost per request

## Options

```python
from sieve import Router

router = Router(
    smart_routing=True,   # AI-powered (default) or keyword-based
    force_tier="cheap",   # Force a specific tier (optional)
)
```

## Roadmap

- [x] AI-powered complexity detection
- [ ] Anthropic Claude support
- [ ] Multi-provider routing (cheapest across OpenAI + Anthropic + Google)
- [ ] Streaming responses
- [ ] Budget limits & alerts

## License

MIT
