Metadata-Version: 2.4
Name: nolma
Version: 0.1.0
Summary: AI gateway SDK — cost control, session tracing, and security for LLM agents
Home-page: https://nolma.ai
Author: LumyteAI
Author-email: hello@lumyteai.com
Project-URL: Documentation, https://docs.nolma.ai
Project-URL: Source, https://github.com/lumyteai/nolma
Project-URL: Changelog, https://github.com/lumyteai/nolma/releases
Keywords: llm,openai,anthropic,ai,cost,monitoring,gateway
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.9
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 :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.24.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# nolma

AI gateway SDK — cost control, session tracing, and security for LLM agents.

One URL change. See every dollar your AI agents spend.

## Installation

```bash
pip install nolma
```

## Quick start

```python
from nolma import Nolma

nolma = Nolma(api_key="nm_live_abc123")

@nolma.session(name="support-bot", user_id="user_42")
async def my_agent(query: str):
    # Your LLM calls go here — Nolma tracks everything
    ...
```

## Session decorator

Wraps your agent function with automatic session tracking via `contextvars`:

```python
@nolma.session(name="research-agent", user_id="user_123")
async def research(topic: str):
    result = await llm_call(topic)
    return result
```

## Context manager

```python
async with nolma.start_session(name="email-drafter") as ctx:
    print(ctx.session_id)  # sess_abc123...
    result = await draft_email(input)
```

## Header injection

Pass Nolma headers to any LLM SDK:

```python
import anthropic

client = anthropic.Anthropic(
    base_url=nolma.gateway_url + "/anthropic",
    default_headers=nolma.get_headers(),
)
```

## Signals (Nolma Lens)

Track what users do with LLM outputs:

```python
nolma.signal(session_id, action="accepted")
nolma.signal(session_id, action="edited", edit_distance=42)
nolma.signal(session_id, action="regenerated")
```

## Context scanning (Nolma Shield)

Detect injection attacks in RAG content:

```python
result = await nolma.scan_context(
    content=retrieved_doc,
    source="rag",
    agent="support-bot",
)
if result["decision"] == "BLOCK":
    raise SecurityError("Injection detected")
```

## Documentation

Full docs at [docs.nolma.ai](https://docs.nolma.ai)

## License

MIT
