This release is a pre-release and may not be stable for production use.
sovergate
Python SDK for Sovergate: EU AI Act Article 12 audit logging for LLM calls, with PII scrubbed inside your own infrastructure.
Early access. The SDK is published as an alpha and the hosted ingest service is not generally available yet. APIs may change before 1.0.
How it works
Your app keeps calling OpenAI or Anthropic directly. Sovergate does not proxy or intercept the request. After a call completes, the SDK takes a copy, scrubs personal data locally, and sends the scrubbed copy to Sovergate from a background thread.
Your app ─────────────────────────────► OpenAI / Anthropic
│
└──► scrub PII locally ──► Sovergate (background, fire and forget)
Install
pip install --pre sovergate
--pre is needed while the SDK is in alpha. Requires Python 3.10+. No runtime
dependencies.
Quick start
import openai
import sovergate
sovergate.init(api_key="sov_prod_xxxx")
sovergate.instrument(openai)
# Your existing code is unchanged
response = openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
# The response is returned immediately; logging happens in the background
You can also instrument a client instance, sync or async:
from openai import AsyncOpenAI
client = AsyncOpenAI()
sovergate.instrument(client)
Anthropic
Pass a client instance (the anthropic module itself has no client to patch):
import anthropic
import sovergate
client = anthropic.Anthropic() # or anthropic.AsyncAnthropic()
sovergate.init(api_key="sov_prod_xxxx")
sovergate.instrument(client)
Streaming
Streamed calls are logged too: create(stream=True) on both providers, plus
OpenAI's chat.completions.stream() and Anthropic's messages.stream(). Your
app receives every chunk unchanged and as soon as it arrives; the SDK keeps a
copy of the text and logs it once the stream ends. If your app stops reading
part-way, what it had received up to that point is logged.
OpenAI only reports token counts for a stream when you ask for them:
client.chat.completions.create(..., stream=True, stream_options={"include_usage": True})
Without that option the record is still logged, with 0 tokens. The SDK never adds the option itself, because it changes the chunks your app receives.
Stable PII tokens (recommended)
By default, detected PII is replaced with positional placeholders
([EMAIL_REDACTED_1]), which are not correlatable between logs. Pass a
pii_key to replace values with deterministic, irreversible HMAC-SHA256 tokens
instead. The same value always maps to the same token, so Sovergate can count
unique people, IBANs and so on without ever receiving the raw values.
sovergate.init(api_key="sov_prod_xxxx", pii_key="<your-secret>")
The pii_key is your secret. Keep it stable, and never send it to us: it stays
on your infrastructure, and without it the tokens cannot be reversed.
Options
sovergate.init(
api_key="sov_prod_xxxx", # required
base_url="https://...", # default: https://api.sovergate.com
pii_key="<your-secret>", # optional, see above
debug=True, # verbose output from the "sovergate" logger only
)
What is sent to Sovergate
For each completed call, one JSON record:
| Field | Content |
|---|---|
model |
Model name returned by the provider |
messages |
Your prompt messages (and Anthropic system prompt), after PII scrubbing |
response |
The model's text output, after PII scrubbing |
prompt_tokens, completion_tokens |
Token counts from the provider |
latency_ms, timestamp |
Call duration and start time |
finish_reason |
Why the model stopped |
pii_detections |
Category and placeholder of each scrubbed item, never the original value |
Never sent: the raw prompt or response, your pii_key, your LLM provider API
key, or request headers.
What the scrubber detects
Regex-based, applied to every text part of the prompt and response: email
addresses, IP addresses, IBANs (including the spaced format), card numbers,
phone numbers, dates of birth, ID numbers, and names that follow a title (Mr,
Mrs, Ms, Dr, Prof). Other personal data, such as names without a title, is
not detected yet, so keep data minimisation in mind when you build prompts.
The code is in sovergate/scrubber.py.
Guarantees
- Never blocks your call: logging runs in a background daemon thread
- Never raises: if setup fails, the SDK logs a warning on the
sovergatelogger and stays out of the way - Returns the provider's response unchanged, and passes stream chunks through
unchanged as they arrive;
with_raw_responsekeeps working - Never changes your app's logging configuration, even with
debug=True - 2 second timeout on every HTTP call to Sovergate
- If Sovergate is unreachable, records are queued in memory (up to 10,000) and retried with exponential backoff
- A record Sovergate permanently rejects (for example after a key is revoked) is dropped with a warning, so it never blocks the records behind it
Current limitations
- Only the text of a response is logged, streamed or not; tool calls are not.
- Calls made through
with_raw_responseare not logged. - The retry queue is in memory, so queued records are lost if the process exits.
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
Security
Please report vulnerabilities privately. See SECURITY.md.
License
Metadata
Release files for sovergate 0.1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sovergate-0.1.0a3.tar.gz | 19.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sovergate-0.1.0a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.2 kB
Release files / sovergate-0.1.0a3.tar.gz
| Download URL | sovergate-0.1.0a3.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
452019dd6bbd2c0a5d2bd467e6a7605c9f0df58e59703c6202f67de67ec823a4
|
|
BLAKE2b-256 checksum How to use checksums |
9fd89ae83a00265d68483bbc79a0553d40f1c9e9290e90b1e9b4533806795da2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / sovergate-0.1.0a3-py3-none-any.whl
| Download URL | sovergate-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78250659917f0364ad43d0a67185275d8e935890851ef3df3cd31a10a3ef93a4
|
|
BLAKE2b-256 checksum How to use checksums |
ef277dd4909a26e04f96a01f5c27e8413094e88442b7458db095d9b5bde99b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for sovergate 0.1.0a3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sovergate-0.1.0a3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.