Metadata-Version: 2.4
Name: keiro
Version: 0.12.24
Summary: Python client and CLI for the Keiro eb1 API.
Author: Keiro Engineering
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://docs.keirolabs.ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <3.14,>=3.11
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.32.2
Requires-Dist: PyYAML>=6.0.1
Requires-Dist: rich>=13.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.3.2; extra == "dev"
Requires-Dist: ruff>=0.12.0; extra == "dev"

# Keiro

Python client and command-line interface for the Keiro eb1 API.

## Install

Keiro requires Python 3.11 or later.

```bash
python -m pip install keiro
```

## Quickstart

Configure your API credentials:

```bash
keiro setup
```

Then send a prompt:

```python
from keiro import models

answer = models("eb1-preview", "What is machine learning?")
print(answer)
```

## Models

| Model | Description |
| --- | --- |
| `eb1-preview` | Balanced default for general-purpose reasoning and coding. |
| `eb1-frontier-preview` | Highest-capability option for complex tasks. |
| `eb1-fast-preview` | Lower-latency option for interactive work. |
| `eb1-efficient-preview` | Cost-efficient option for routine and high-volume work. |

## Prompt-first API

The `models` facade returns text directly for the common case:

```python
from keiro import models

answer = models("eb1-preview", "Explain dependency injection with a short example.")
print(answer)
```

Use `models.response()` when you also need response metadata:

```python
from keiro import models

response = models.response("eb1-preview", "Summarize the benefits of type hints.")
print(response.text)
print(response.usage)
```

Create a reusable binding when several prompts share the same model and parameters:

```python
from keiro import models

concise = models.instance("eb1-fast-preview", max_tokens=200)
print(concise("Explain immutable data."))
print(concise("Explain idempotency."))
```

Stream text as it arrives:

```python
from keiro import models

for chunk in models.stream("eb1-preview", "Draft a concise project update."):
    print(chunk, end="", flush=True)
```

Call `models.close()` when a long-running process is finished with the shared client connection.

## CLI usage

Run an interactive session:

```bash
keiro
```

Send a one-shot prompt or select a model:

```bash
keiro "Explain semantic versioning."
keiro -m eb1-fast-preview "Summarize this text."
```

Pipe context from another command:

```bash
git diff | keiro "Review this change for correctness."
```

List the models available to your account or open the browser client:

```bash
keiro models
keiro gui
```

Run `keiro --help` for the complete command reference.

## Configuration

`keiro setup` validates your API key and saves the client configuration under
`~/.keiro/`. Run it again whenever you need to replace your credentials.

For programmatic configuration, pass credentials directly to `Client`:

```python
from keiro import Client

with Client(
    api_key="your-api-key",
    base_url="https://api.keirolabs.ai/v1",
) as client:
    response = client.chat(
        messages=[{"role": "user", "content": "Explain binary search."}],
        model="eb1-preview",
    )
    print(response["choices"][0]["message"]["content"])
```

Explicit `Client` arguments take precedence over saved configuration.

## Requirements

- Python 3.11, 3.12, or 3.13
- A Keiro API key
- Network access to the Keiro API
