Metadata-Version: 2.4
Name: llama-index-llms-trustedrouter
Version: 0.1.0
Summary: llama-index llms TrustedRouter integration
Project-URL: Homepage, https://trustedrouter.com
Project-URL: Repository, https://github.com/Lore-Hex/llama-index-llms-trustedrouter
Project-URL: Issues, https://github.com/Lore-Hex/llama-index-llms-trustedrouter/issues
Author-email: Joseph Perla <jperla@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: llama-index,llm,openai-compatible,router,trustedrouter
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: <4.0,>=3.10
Requires-Dist: llama-index-core<0.15,>=0.14.3
Requires-Dist: llama-index-llms-openai-like<0.8,>=0.7.0
Description-Content-Type: text/markdown

# LlamaIndex LLMs Integration: TrustedRouter

[TrustedRouter](https://trustedrouter.com) is an OpenAI-compatible LLM router that serves many models behind one endpoint through an open-source, verifiable attested gateway. It does not log prompts or outputs by default.

This package provides a `TrustedRouter` LLM class for [LlamaIndex](https://github.com/run-llama/llama_index), implemented as a thin `OpenAILike` subclass.

## Installation

```bash
pip install llama-index-llms-trustedrouter
```

## Usage

Set your API key:

```bash
export TRUSTEDROUTER_API_KEY=***
```

```python
from llama_index.llms.trustedrouter import TrustedRouter

llm = TrustedRouter(model="trustedrouter/zdr")

resp = llm.complete("Who is Paul Graham?")
print(resp)
```

Streaming and chat work like any other OpenAI-like LLM:

```python
from llama_index.core.llms import ChatMessage

resp = llm.chat([ChatMessage(role="user", content="Tell me a joke")])
print(resp)

for chunk in llm.stream_complete("Count to five"):
    print(chunk.delta, end="")
```

## Configuration

| Argument | Environment variable | Default |
| --- | --- | --- |
| `api_key` | `TRUSTEDROUTER_API_KEY` | required |
| `api_base` | `TRUSTEDROUTER_API_BASE` | `https://api.trustedrouter.com/v1` |
| `model` | | `trustedrouter/zdr` |

Explicit constructor arguments take precedence over environment variables.

## Models

Model routes include `trustedrouter/auto`, `trustedrouter/zdr` (zero data retention), and `trustedrouter/confidential`, plus individually addressable models. See the live catalog at [`https://trustedrouter.com/v1/models`](https://trustedrouter.com/v1/models).

## Why a separate repository

LlamaIndex [no longer accepts new integration packages](https://github.com/run-llama/llama_index/blob/main/CONTRIBUTING.md) in its main repository; new integrations are maintained in their own repositories and published to PyPI independently. This package follows that guidance, and the import path is unchanged from any in-tree integration.

## License

MIT
