Metadata-Version: 2.4
Name: zylora
Version: 0.1.0
Summary: Serverless GPU functions — deploy ML models with a decorator
Project-URL: Homepage, https://zylora.dev
Project-URL: Documentation, https://docs.zylora.dev
Project-URL: Repository, https://github.com/zylora-dev/zylora-python
Project-URL: Issues, https://github.com/zylora-dev/zylora-python/issues
Author-email: Zylora <hello@zylora.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: deploy,gpu,inference,ml,serverless
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
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: cloudpickle>=3.0
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.22; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="logo-dark.png">
    <source media="(prefers-color-scheme: light)" srcset="logo-light.png">
    <img alt="Zylora" src="logo-dark.png" height="48">
  </picture>
</p>

# zylora

> Serverless GPU functions — deploy ML models with a decorator, scale to zero, pay per GPU-second.

[![PyPI](https://img.shields.io/pypi/v/zylora)](https://pypi.org/project/zylora/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)

## Quickstart

```bash
pip install zylora
```

### Define a GPU function

```python
import zylora

@zylora.fn(gpu="H100")
def embed(text: str) -> list[float]:
    from transformers import AutoModel
    model = AutoModel.from_pretrained("BAAI/bge-large-en-v1.5")
    return model.encode(text).tolist()
```

### Deploy

```bash
zy deploy
```

### Invoke

```python
# Local (development)
result = embed("hello world")

# Remote (deployed)
result = embed.remote("hello world")

# Batch
results = embed.map(["hello", "world", "foo"])

# Streaming (for LLMs)
for token in generate.stream("Tell me a joke"):
    print(token, end="", flush=True)

# Async
job = embed.remote_async("hello")
result = job.result()
```

### Client API (without decorator)

```python
from zylora import Zylora

zy = Zylora()
result = zy.invoke("embed", {"text": "hello"})
```

## Authentication

Set your API key via environment variable:

```bash
export ZYLORA_API_KEY="zy_live_..."
```

Or use the CLI:

```bash
zy login
```

## Configuration

### `@zylora.fn()` options

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `gpu` | `str` | *required* | GPU type: `t4`, `l4`, `rtx4090`, `a100_40gb`, `a100_80gb`, `l40s`, `h100`, `h200`, `b200`, `mi300x` |
| `name` | `str` | function name | Custom function name |
| `packages` | `list[str]` | `[]` | pip packages to install |
| `model` | `str` | `None` | Model to download during build |
| `timeout` | `int` | `300` | Execution timeout (seconds) |
| `min_instances` | `int` | `0` | Minimum warm instances |
| `max_instances` | `int` | `10` | Maximum concurrent instances |
| `concurrency` | `int` | `1` | Requests per instance |
| `image` | `str` | `None` | Custom base Docker image |
| `runtime` | `str` | `"python312"` | Python runtime version |
| `routing` | `str` | `"cost_optimized"` | Routing strategy |
| `visibility` | `str` | `"private"` | Function visibility |

## Documentation

Full documentation: [docs.zylora.dev](https://docs.zylora.dev)

## License

MIT
