Metadata-Version: 2.4
Name: quota-sdk
Version: 1.1.0
Summary: Official Python SDK for Quota: LLM Telemetry, Proxy & MCP Interceptor
Author: Quota
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-python
Dynamic: summary

# Quota Python SDK (`quota-sdk`)

Official Python SDK for **Quota**: Unified LLM Observability, Cost Tracking, Proxy & Model Context Protocol (MCP) Interception.

---

## 🚀 Installation

```bash
pip install quota-sdk
```

---

## ⚙️ Quickstart

```python
from quota import Quota

# 1. Initialize Quota
Quota.init(
    api_key="quota_live_YOUR_API_KEY",
    endpoint="https://api.quota.ai/collector",  # Optional (default: official endpoint)
    project="ecommerce-portal",
    agent="customer-support-bot",
    environment="production"
)
```

---

## 🧠 Model Context Protocol (MCP) Integration

### Option A: Wrap an MCP Client
```python
from quota import Quota

# Wrap any Python MCP Client (e.g. mcp client, fastmcp, etc.)
mcp_client = Quota.wrap_mcp(my_raw_mcp_client, tags=["mcp", "db-tools"])

# Calls to call_tool are transparently intercepted and logged to Quota!
result = mcp_client.call_tool(name="query_orders", user_id="usr_123")
```

### Option B: Functional Interceptor
```python
from quota import Quota
import openai

response = Quota.intercept_mcp(
    action=lambda: openai.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": "Hello!"}]
    ),
    provider="openai",
    model="gpt-4o-mini",
    tags=["mcp-action"]
)
```

### Manual Tracking
```python
Quota.track_usage({
    "provider": "google",
    "model": "gemini-2.0-flash",
    "promptTokens": 120,
    "completionTokens": 35,
    "cachedTokens": 20,
    "latencyMs": 410,
    "statusCode": 200,
    "success": True,
    "metadata": {
        "project": "bi-reports",
        "agent": "analyst-bot"
    }
})
```

---

## 🎯 Supported LLM Providers

- **OpenAI** (`gpt-4o`, `gpt-4o-mini`, `o1`, `o3-mini`, etc.)
- **Anthropic Claude** (`claude-3-5-sonnet`, `claude-3-haiku`, etc.)
- **Google Gemini** (`gemini-2.0-flash`, `gemini-1.5-pro`, etc.)
- **Groq** (`llama-3.3-70b-versatile`, `mixtral-8x7b`, etc.)
- **Mistral** (`mistral-large-latest`, `codestral`, etc.)

---

## License
MIT
