Metadata-Version: 2.4
Name: latch-ai
Version: 0.1.0
Summary: Python SDK for Latch LLM Control Plane - Intelligent routing & cost optimization
Project-URL: Homepage, https://github.com/latch-llm/latch
Project-URL: Documentation, https://docs.latch.dev
Author: Latch Team
License: MIT
Keywords: ai,cost-optimization,llm,routing
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: httpx>=0.27.0
Requires-Dist: pydantic>=2.6.0
Provides-Extra: dev
Requires-Dist: mypy>=1.8.0; extra == 'dev'
Requires-Dist: pydantic-ai>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.2.0; extra == 'dev'
Provides-Extra: pydantic-ai
Requires-Dist: pydantic-ai>=1.0.0; extra == 'pydantic-ai'
Description-Content-Type: text/markdown

# Latch AI

Python SDK for the Latch LLM Control Plane - Intelligent routing & cost optimization.

## Installation

```bash
pip install latch-ai
```

## Quick Start

```python
from latch import Latch

client = Latch(api_key="lgk_your_api_key")

response = client.run(
    messages=[{"role": "user", "content": "Summarize this document..."}],
    task="summarization",
    budget=0.02,
)

print(response.content)
print(f"Cost: ${response.cost}")
print(f"Model: {response.model}")
```

## Async Usage

```python
from latch import AsyncLatch

async with AsyncLatch(api_key="lgk_your_api_key") as client:
    response = await client.run(
        messages=[{"role": "user", "content": "Hello!"}],
        task="chat",
    )
    print(response.content)
```

## Decision Only

Get routing decision without executing:

```python
decision = client.decide(
    messages=[{"role": "user", "content": "..."}],
    task="summarization",
)

print(f"Recommended model: {decision.model}")
print(f"Estimated cost: ${decision.estimated_cost}")
```

## Configuration

```python
client = Latch(
    api_key="lgk_xxx",
    base_url="https://api.latch.dev",
    timeout=30.0,
    mode="enforce",
)
```

### Modes

- `observe`: Log decisions, don't enforce
- `suggest`: Return recommendations
- `enforce`: Apply decisions, block if budget exceeded
