Skip to main content
Pre-release

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)

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 sovergate logger and stays out of the way
  • Returns the provider's response unchanged; with_raw_response keeps 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

  • Streaming calls (stream=True) are passed through untouched but not logged yet.
  • Calls made through with_raw_response are 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

MIT

Metadata

Release files for sovergate 0.1.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sovergate 0.1.0a2
File Size Uploaded Provenance
sovergate-0.1.0a2.tar.gz 16.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sovergate 0.1.0a2
File Interpreter ABI Platform
sovergate-0.1.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / sovergate-0.1.0a2.tar.gz

Download URL sovergate-0.1.0a2.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c3846b410312a2b0acb68c8156089eb09d8fbd975ab6e4cfbcfd8277923568d3
BLAKE2b-256 checksum
How to use checksums
00c90898db136d888e21745582b0ffa3790cbb63948165decb11bd764183c29f
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 26, 2026.

Transparency log

Release files / sovergate-0.1.0a2-py3-none-any.whl

Download URL sovergate-0.1.0a2-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f97af12ffa9be237d1fdfba3e174fed3b86669a4edb9b9c1e1c6a87fcb9eae4
BLAKE2b-256 checksum
How to use checksums
d2bb43dbc93cf200d17efac1a2650cf18225ebd904d41de66abe4b12adbe4885
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 26, 2026.

Transparency log

Security for sovergate 0.1.0a2

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.

Select from 2 files

Attestation for sovergate-0.1.0a2.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 26, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page