Metadata-Version: 2.4
Name: prysm1
Version: 0.2.0
Summary: PRYSM — universal AI routing, OpenAI drop-in. One API, every model, always the best one.
Project-URL: Homepage, https://prysm1.com
Project-URL: Documentation, https://docs.prysm1.com
Author: PRYSM
License: Proprietary
Keywords: agents,ai,gateway,llm,openai,prysm,routing
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27
Requires-Dist: openai>=1.40
Provides-Extra: yaml
Requires-Dist: pyyaml>=6.0; extra == 'yaml'
Description-Content-Type: text/markdown

# prysm1 — PRYSM Python SDK

**One API, every model, always the best one.** An OpenAI drop-in: change one line,
get intelligent routing across 21 models, cost guardrails (AgentGuard), declarative
config (BRAIN.md), and cryptographic receipts (PrysmProof).

```bash
pip install prysm1
```

## Drop-in replacement for OpenAI

`Prysm` subclasses `openai.OpenAI`, so all your existing code works unchanged.

```python
from prysm import Prysm

client = Prysm()  # api_key from $PRYSM_API_KEY, base_url from $PRYSM_BASE_URL

resp = client.chat.completions.create(
    model="auto",                       # let PRYSM pick the best model
    messages=[{"role": "user", "content": "Write a Python quicksort"}],
)
print(resp.choices[0].message.content)
```

### Access the PRYSM extensions

Every response carries a `prysm` block (routing, cost, latency, proof). Use
`extension()` for clean dot-access:

```python
import prysm

ext = prysm.extension(resp)
print(ext.routing.model_display)  # "DeepSeek V3.2"
print(ext.cost.total_usd)         # 0.000042
print(ext.proof.proof_hash)       # "sha256:a1b2c3d4..."
```

## BRAIN.md auto-discovery

Drop a `BRAIN.md` in your project root and the SDK finds it automatically, applying
your routing rules / cost caps / blocked models on every `complete()` call:

```python
client = Prysm()                 # discovers ./BRAIN.md (walks up from cwd)
resp = client.complete("Summarize this contract")   # BRAIN.md applied
```

Point it explicitly, pass a dict, or disable:

```python
Prysm(brain="path/to/BRAIN.md")
Prysm(brain={"max_cost": 0.005, "model": "deepseek-v3.2"})
Prysm(brain=None)                # ignore BRAIN.md
```

Validate a BRAIN.md before shipping:

```python
print(client.validate_brain(open("BRAIN.md").read()))
# {'valid': True, 'errors': [], 'warnings': [], 'normalized': {...}}
```

## Helpers

```python
client.route("debug this function")     # dry-run: which model, est. cost (no call)
client.usage()                          # your usage stats
client.savings(baseline="gpt-5.2")      # est. $ saved vs. an all-premium baseline
client.verify_proof(request_id)         # verify a PrysmProof
client.models_catalog()                 # 21 models with pricing
```

## Configuration

| Setting | Argument | Env var | Default |
|---------|----------|---------|---------|
| API key | `api_key=` | `PRYSM_API_KEY` | — |
| Base URL | `base_url=` | `PRYSM_BASE_URL` | `https://api.prysm1.com/v1` |
| BRAIN.md | `brain=` | — | `"auto"` (discover) |

Get an API key at [prysm1.com](https://prysm1.com). Full docs at
[docs.prysm1.com](https://docs.prysm1.com).

## Development

```bash
python tests/test_sdk.py   # no pytest required; runs against the backend in-process
```

## License

Proprietary.
