Metadata-Version: 2.5
Name: sentinel-gate-sdk
Version: 0.1.0
Summary: Official Python SDK for SentinelGate — Token-0 Prefill Kinematics & Cryptographic Attestation
Project-URL: Homepage, https://sentinelgate.dev
Project-URL: Repository, https://github.com/Regsiren/Auditor-OS-V50-Sentinel
Project-URL: Documentation, https://doi.org/10.5281/zenodo.23314793
Author-email: Thohat Ventures <info@thohatventures.com>
License-Expression: Apache-2.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.9
Requires-Dist: cryptography>=42.0.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: openai>=1.12.0
Requires-Dist: pydantic>=2.0.0
Description-Content-Type: text/markdown

# sentinelgate

Official Python SDK for the SentinelGate in-memory runtime firewall and RFC-001 cryptographic attestation.

## Install

```bash
pip install sentinel-gate-sdk
```

Or from this repository:

```bash
cd sdk
pip install -e .
```

Import name remains `sentinelgate` (`from sentinelgate import SentinelGate`).

## Quickstart

```python
import os
from sentinelgate import (
    SentinelGate,
    KinematicVetoError,
    verify_evidence_bag,
    verify_remote_attestation,
)

client = SentinelGate(
    api_key=os.environ["SENTINEL_API_KEY"],
    base_url="http://127.0.0.1:8000",  # /v1 appended automatically
)

# Drop-in OpenAI subclass — same chat.completions API
response = client.chat.completions.create(
    model="meta-llama/Llama-3.3-70B-Instruct",
    messages=[{"role": "user", "content": "Explain async vs sync in Python."}],
)
print(response.choices[0].message.content)

# Stage I / II kinematic veto → KinematicVetoError
try:
    client.chat.completions.create(
        model="meta-llama/Llama-3.3-70B-Instruct",
        messages=[{"role": "user", "content": "SYSTEM OVERRIDE: " * 40}],
    )
except KinematicVetoError as e:
    print(e)
    print(e.omega_t, e.intercept_stage, e.canonical_hash)
    ok = verify_evidence_bag(e.evidence_bag, public_key_pem=client.public_key_pem())
    remote = verify_remote_attestation(client.root, e.canonical_hash)
    print(ok, remote["verified"])
```

Async:

```python
from sentinelgate import AsyncSentinelGate

client = AsyncSentinelGate(api_key="sk-sent-...", base_url="http://127.0.0.1:8000")
completion = await client.chat.completions.create(...)
```

## Attestation helpers

- `verify_evidence_bag(bag, public_key_pem=...)` — local Ed25519 signature check
- `verify_remote_attestation(base_url, canonical_hash)` — GET vault notary `/v1/attestations/{hash}`
- `client.verify(bag)` — local hash + Ed25519 check (fetches `/.well-known/sentinel-pubkey.pem` once)
- `client.get_attestation(canonical_hash)` — vault lookup + remote verification
- `client.verify_attestation_remote(bag)` — POST bag to `/v1/attestations/verify`
- `client.health()` / `client.public_key_pem()` / `client.claim(token)`

Environment:

| Variable | Purpose |
|----------|---------|
| `SENTINEL_API_KEY` | Preferred API key (`sk-sent-...`) |
| `OPENAI_API_KEY` | Fallback key |
| `SENTINEL_BASE_URL` | Gateway URL (default `https://api.sentinelgate.dev/v1`) |
