Skip to main content

Privyx logo

Privyx

Keep secrets and personal data out of LLM prompts.

PyPI Python versions CI Docker pulls License

Documentation · Quickstart · Tutorials · Integrations

Privyx is a proxy between your tools and an AI provider. It replaces the API keys, passwords, email addresses, and other sensitive values it detects in a request with placeholders, and puts the originals back into the reply. The only thing that changes in your client is its base URL.

A terminal: privyx mask replaces a secret key and an email address in a prompt with tokens, and privyx unmask puts the email address back into the model's reply.

Quick start

Privyx is available as privyx on PyPI and needs Python 3.12 or newer. Install it with uv or pip:

# With uv.
uv tool install privyx       # Install the privyx command globally.
uv add privyx                # Or add it to your project, then use `uv run privyx`.

# With pip.
pip install privyx

Or run it without installing, with uvx: uvx privyx in place of privyx in the commands below. See Installation for extras, Docker, and upgrades.

With a coding agent. privyx run starts a proxy, launches the tool through it, and stops the proxy when the tool exits:

privyx run claude        # Claude Code; also: codex, gemini, opencode, aider, pi

With an application or any other client. Start the proxy, then change the client's base URL. The client keeps its own API key, which Privyx relays:

privyx proxy --upstream https://api.openai.com
export OPENAI_BASE_URL=http://localhost:8000/v1

For Anthropic: --upstream https://api.anthropic.com and ANTHROPIC_BASE_URL=http://localhost:8000.

On a text. See what would be masked. Nothing is sent anywhere:

$ uvx privyx detect --transform "DB_PASSWORD=hunter2 deploy to 10.0.4.17, cc dana@acme.example"
    12:19    SECRET            'hunter2'
    30:39    IP_ADDRESS        '10.0.4.17'
    44:61    EMAIL             'dana@acme.example'

DB_PASSWORD=<PRIVYX_SECRET_A2907293658B4995> deploy to <PRIVYX_IP_ADDRESS_C8E127AF2D5584C3>, cc <PRIVYX_EMAIL_19ECE4788CA5AE6F>

The Quickstart walks through each of these, and there is a Docker image: ohp1x/privyx.

How it works

Your tool sends a request holding an email address and a password. Privyx forwards it with a placeholder in place of each and keeps the mapping in its session vault. The model answers with a tool call on both placeholders, and your tool runs it with the real values.

The model works with <PRIVYX_EMAIL_F04C885A31827851>: it can reason about it, repeat it, and hand it to a tool. The mapping back to the real value stays with Privyx. More in How it works.

Who it is for

  • You use a coding agent. Claude Code, Codex, Gemini CLI, or aider reads your .env, your logs, and your git history, and sends them to a provider. Coding agents
  • You build an application. Your prompts carry your users' data. Keep it out of them with the OpenAI or Anthropic SDK, LangChain, LlamaIndex, LiteLLM, or the Vercel AI SDK. An app on the OpenAI or Anthropic SDK
  • You run a gateway for a team. One proxy for everyone, with a shared vault, TLS, and an audit trail. A shared gateway for a team
  • You want to mask files. Logs, JSON, and datasets, in a script or in CI, without a proxy. Files and logs in a pipeline

What it does

  • Masks secrets and personal data. Built-in patterns cover email addresses, phone numbers, card numbers, IP addresses, API keys, tokens, private keys, and passwords. Add your own word lists and patterns, or a detector that understands names: Presidio or an LLM.
  • Restores the reply. In batch and streaming responses, in reasoning text, and in tool-call arguments, so your tools receive real values.
  • Drops in. It speaks OpenAI Chat Completions and Responses, Anthropic Messages, Gemini, and Ollama, so compatible clients can point at the proxy.
  • Wraps coding agents. privyx run starts a proxy, launches Claude Code, Codex, Gemini CLI (with an API key), opencode, aider, pi, or any tool with a base-URL variable through it, and cleans up afterwards.
  • Checks what slips past. privyx scan finds the names a project should mask (git authors, remotes, .env values), privyx lint lists spellings of your terms that would get through, and privyx install-hook stops a commit holding a secret or a placeholder.
  • Keeps sessions your way. One mapping per request, per client, or per conversation, in memory, SQLite, or Redis.
  • Shows what it did. A PII-safe audit trail and Prometheus metrics count what was masked, without recording any of it.
  • Fails closed. A request it cannot mask is not forwarded.
  • Extends. Plugins add detectors, operators, policies, vaults, and providers.

What it does not do

Privyx reduces what a provider sees. It does not make a prompt safe by itself:

  • Names, organizations, and project terms are only masked once you configure a word list or a detector for them.
  • Only configured masking routes are inspected: chat, Responses, legacy completions, embeddings, and supported token-counting and compaction requests, including native Gemini and Ollama formats. Other paths, such as file uploads, are forwarded as sent unless you refuse them.
  • Images, audio, and other binary content are not inspected.
  • The proxy has no authentication of its own. Keep it on 127.0.0.1, or put something in front of it that authenticates callers.

Limitations has the full list, and the threat model says what Privyx protects against.

Documentation

The documentation is at ohp1x.github.io/privyx:

Its source is in docs/.

Project

Privyx is in its 0.1.x series; the changelog lists what each release changed.

License

MIT

Metadata

Release files for privyx 0.2.0

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

Source distribution (sdist)

Source distribution for privyx 0.2.0
File Size Uploaded Provenance Actions
privyx-0.2.0.tar.gz 1.8 MB With provenance Details for privyx-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for privyx 0.2.0
File Interpreter ABI Platform Actions
privyx-0.2.0-py3-none-any.whl Python 3 none any Details for privyx-0.2.0-py3-none-any.whl

Total release size: 2.2 MB

Release files / privyx-0.2.0.tar.gz

Download URL privyx-0.2.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
f480a98cb01de3814e2266bfaf7a23ee831a7ceb287e1cdb67f4ff068db4951a
BLAKE2b-256 checksum
How to use checksums
110fa69cf62fe274ae29ba29fd6bc189eeab960f90ec880dcaac39ab39fc0c22
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 Nov 18, 2026.

Transparency log

Release files / privyx-0.2.0-py3-none-any.whl

Download URL privyx-0.2.0-py3-none-any.whl
Size 329.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02c9a99bd8e241a839ce13574abc6c41a5f1ec9f0161aad887bc09acb1db21ec
BLAKE2b-256 checksum
How to use checksums
872bf9d39c4fe4d3c9a435180c75097af31ac23fe26dfd2a086e023c5c17bdad
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 Nov 18, 2026.

Transparency log

Security for privyx 0.2.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for privyx-0.2.0.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 Nov 18, 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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