Metadata-Version: 2.4
Name: qriton-record
Version: 0.1.0
Summary: An independent record of what your AI system was told, changed and decided.
Author-email: "Qriton Technologies S.R.L." <office@qriton.com>
License-Expression: MIT
Project-URL: Homepage, https://api.qriton.com/apis
Project-URL: Documentation, https://api.qriton.com/docs/record
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# qriton-record

An independent record of what your AI system was told, changed and decided.

Every model call your application makes becomes a receipt in a hash-linked chain: what the system was set up with,
what it was asked, and what it answered. Receipts hold SHA-256 hashes, not your text. The chain head is kept on your
machine, and this library checks that every receipt continues the head you hold, so the record can be checked
without trusting Qriton or the maker of the model.

```bash
pip install qriton-record
export QRITON_API_KEY=qk_live_...        # 14-day trial key, no card: https://api.qriton.com/console
```

## Record your existing client

```python
from openai import OpenAI
import qriton_record

rec = qriton_record.Recorder(system="support-assistant")
client = rec.wrap(OpenAI())              # use it exactly as before

client.chat.completions.create(model="gpt-4.1", messages=[...])
```

The same works for `anthropic.Anthropic()`, the async clients, streamed answers and the OpenAI Responses API.

## Two modes

| | `rec.wrap(client)` | `rec.proxy(client)` |
|---|---|---|
| Who calls the model provider | your code | the Qriton recorder, which forwards the call unchanged |
| What reaches Qriton | hashes only | the request and answer pass through; only hashes are stored |
| Receipts say | `witness: client` | `witness: gateway` |
| Use it when | text must not leave your infrastructure | you want a third party to witness each exchange |

## What a receipt holds

| Operation | Written when | Payload |
|---|---|---|
| `configure` | the model, instructions, tools or parameters change | `config_sha256`, `previous_config_sha256`, model |
| `exchange` | every call | `config_sha256`, `input_sha256`, `output_sha256`, model, tokens, latency |
| `note` | you call `rec.note(...)` | a hash you want on the record: a policy, a prompt file, a dataset |

```python
rec.note("policy", path="stock-policy-v3.pdf", label="Stock policy v3")
```

The hashes follow the content rule `qriton-content-1` (RFC 8785 JSON, null members removed), so you can recompute
any of them from your own logs with `qriton_record.content_hash`.

## Check the record yourself

```python
rec.sync()                                 # fetch new receipts, check they continue your head
result = rec.export("receipts.jsonl")      # the whole chain, checked against your head
```

`receipts.jsonl` is in the published receipt-chain format. The open verifiers check it offline:
https://api.qriton.com/verifiers

## What it does not prove

A receipt shows that the record is complete and unaltered, not that what it records is true. It covers what passes
through the recorder, and it is independent of Qriton only when you, or a second party, keep the chain head.

## Without a key

Without `QRITON_API_KEY` nothing is sent: receipts are computed and kept in `rec.pending`, so you can see what would
be recorded before you sign up.
