Skip to main content

PromptLatch

CI PyPI Python 3.12+ License: MIT

Send the prompt. Keep the keys.

Coding agents read your .env, your logs, and your configs, then send them to a model. PromptLatch runs on your machine and redacts the credentials before the request leaves.

A prompt with credentials on your machine, and the same prompt with the credentials redacted at the provider

  • Use it as a proxy for Claude Code, Codex, Gemini CLI, OpenCode, or any client with a custom base URL.
  • Use it as a Python library to redact text, messages, or payloads before an SDK call.
  • It stays local. Rules are deterministic, with no model calls and no telemetry. The proxy downloads a public price list once a day for cost estimates and sends no data about you. To turn this off, set observability.pricing_enabled: false.

Try the live demo or start below.

Quick start

Coding agents

Install PromptLatch with uv, which also supplies Python, and start the proxy:

uv tool install promptlatch
curl -fsSL -o agents.yaml \
  https://raw.githubusercontent.com/bvolpato/promptlatch/main/examples/promptlatch-agents.config.yaml
promptlatch serve --config agents.yaml

In another terminal, use the wrapper for your agent:

Instead of Run
claude claude-latch
codex codex-latch
gemini gemini-latch

The wrappers keep your login and do not edit your agent's config files. If the proxy is down or redaction is off, they stop instead of sending unredacted prompts. For OpenCode, OpenRouter, and manual setup, see the agent guide.

Any API client

Set an upstream provider, keep its key in your shell, and start the proxy:

promptlatch init --target-base-url https://api.openai.com/v1
export OPENAI_API_KEY="<openai-upstream-key>"
promptlatch serve

Then point your client at http://127.0.0.1:8000/v1:

curl http://127.0.0.1:8000/v1/responses \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-sol","input":"Read my .env: GITHUB_TOKEN=example-value-123456"}'

The provider receives GITHUB_TOKEN=[REDACTED_SECRET]. OpenAI, Anthropic, Gemini, OpenRouter, and local Ollama or vLLM endpoints work. See providers and routes.

Python

No proxy needed:

uv add promptlatch
from openai import OpenAI
from promptlatch import redact_params

client = OpenAI()
response = client.responses.create(
    **redact_params(
        model="gpt-6-sol",
        input="Read this: GITHUB_TOKEN=example-value-123456",
    )
)

redact_text, redact_messages, redact_params, and redact_payload each return a redacted copy. Pass the returned value to the SDK. See the library guide for Anthropic, LiteLLM, LangChain, and custom rules.

Check that it works

Test a string without starting anything:

promptlatch scan 'DATABASE_URL=postgres://app:example-password@db/prod'
DATABASE_URL=postgres://app:[REDACTED_SECRET]@db/prod

For agents, send a request through a wrapper and read what left your machine in the inspector.

A model's reply cannot prove what the proxy sent. To check the API client setup, send a fake key to an echo server and read what arrived:

FAKE_KEY="AI""zaSyFixtureToken000000000000000000000"

curl --compressed -fsS http://127.0.0.1:8000/post \
  -H "X-Target-Base-URL: https://postman-echo.com" \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"content":"GEMINI_API_KEY='"$FAKE_KEY"'"}]}' \
  | jq -r '.data.messages[0].content'
GEMINI_API_KEY=[REDACTED_SECRET]

The agent config rejects this request, because it allows the official provider endpoints only. Use a config without a target allowlist, such as the one from promptlatch init.

What it redacts

Kind Examples
AI provider keys OpenAI, Anthropic, Gemini, OpenRouter, xAI, Groq, Perplexity, Replicate
Developer and cloud tokens GitHub, GitLab, AWS, Google Cloud, Azure, Slack, Stripe, npm, PyPI, Vault
Structured credentials JWTs, signed URLs, database URLs, PEM and PGP private keys
Labeled values password, api_key, token, authorization, client_secret
Your own formats Exact-tail or regex rules in config

Matching uses provider patterns and bc-detect-secrets. Entropy-only matching is off to avoid unpredictable false positives. See redaction for the full list.

What it does not do

  • It does not know private token formats that no rule describes. Add a custom rule.
  • It does not scan provider responses, MCP traffic, or tool subprocesses.
  • It does not scan multipart uploads. The proxy rejects them with 415.
  • It does not scan URL paths or header values, and it does not decode base64 or other encoded text.
  • It does not anonymize. Names, source code, and other private text pass through.

Read SECURITY.md before you share a proxy or bind it beyond loopback.

See what was sent

The proxy keeps a local history of redacted requests, token usage, latency, and cost estimates:

promptlatch stats --days 7
promptlatch tail --follow

For the web inspector, start the proxy with promptlatch serve --dashboard and open http://127.0.0.1:8000/. The agent config already enables it. Sign in with the token from the file that serve names at startup.

PromptLatch dashboard with a captured conversation in which credentials appear as REDACTED_SECRET

Stored prompts are redacted but can still hold private text. To keep metadata only, set observability.store_request_bodies: false. See local monitoring.

Commands

Command Purpose
promptlatch serve Run the proxy.
promptlatch init Create a config file.
promptlatch scan Redact text, a file, or stdin. --check exits 1 when it finds a secret.
promptlatch doctor Check config, storage, and the running proxy. --strict exits 1 on a problem.
promptlatch stats Summarize usage, cost, and redactions.
promptlatch tail List or follow recent requests.
promptlatch encrypt-rules Encrypt custom rules at rest.

To block secrets in commits, add git diff --cached | promptlatch scan --check --quiet to a pre-commit hook.

Other ways to install

Method Command
Homebrew brew install bvolpato/tap/promptlatch
pip python -m pip install promptlatch
Docker docker pull ghcr.io/bvolpato/promptlatch:0.3.0
Helm helm pull https://github.com/bvolpato/promptlatch/releases/download/v0.3.0/promptlatch-0.3.0.tgz
Source git clone https://github.com/bvolpato/promptlatch.git && cd promptlatch && ./install.sh

If Homebrew refuses an untrusted tap, run brew trust bvolpato/tap first.

See deployment for Docker, Compose, Helm, background service, and PromptCloak upgrade steps.

To let a coding agent do the setup, give it PROMPT.md.

Documentation

Development

uv sync --extra dev --locked
uv run pytest
uv run ruff check .
uv run scripts/audit_secrets.py

Report security problems through the private path in SECURITY.md. Never post real secrets.

MIT licensed.

Metadata

Release files for promptlatch 0.3.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 promptlatch 0.3.0
File Size Uploaded Provenance Actions
promptlatch-0.3.0.tar.gz 955.8 kB With provenance Details for promptlatch-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / promptlatch-0.3.0.tar.gz

Download URL promptlatch-0.3.0.tar.gz
Size 955.8 kB
Tags Source
SHA-256 checksum
How to use checksums
15618d90050621f0dd691bb022f1c698531d7674e4274957cb2aad42715e2178
BLAKE2b-256 checksum
How to use checksums
9cdae136a2b836b5a5299981b63e22176fc7fa4d469a07cbd400f726512db1df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 26, 2026.

Transparency log

Release files / promptlatch-0.3.0-py3-none-any.whl

Download URL promptlatch-0.3.0-py3-none-any.whl
Size 320.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8967d590f35aa6759643b96e7c5765cbabbb6dd5cf1b66fbacd3d918c53eeb24
BLAKE2b-256 checksum
How to use checksums
b89ba31b400a5ac0f6695ca8cb70863c440ff5782062fe60e2371c777416c273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 26, 2026.

Transparency log

Security for promptlatch 0.3.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 promptlatch-0.3.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 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