Start the proxy once
uv tool install promptlatch
curl -fsSO https://bvolpato.github.io/promptlatch/agents.yaml
promptlatch serve --config agents.yaml
It listens on 127.0.0.1:8000 and allows the official provider endpoints only.
Coding agents read your .env, your logs, and your configs, then send them to a model. PromptLatch runs on your machine and blacks out the credentials before the request leaves.
uv tool install promptlatch
What the provider receives
DATABASE_URL=postgres://app:@db:5432/prod
1 redaction
This demo runs the project's built-in patterns in your browser, and this page's content policy blocks requests to other sites. The installed engine adds bc-detect-secrets and your own rules, so it redacts more and can name a rule differently.
Start one local proxy, then launch your agent through it. The wrappers keep your login and do not edit your agent's config files.
uv tool install promptlatch
curl -fsSO https://bvolpato.github.io/promptlatch/agents.yaml
promptlatch serve --config agents.yaml
It listens on 127.0.0.1:8000 and allows the official provider endpoints only.
claude-latch
claude-latch -p "Review this repository"
Works with a Claude login or ANTHROPIC_API_KEY. If the proxy is down or
redaction is off, the wrapper stops instead of sending unredacted prompts.
uv tool install promptlatch
curl -fsSO https://bvolpato.github.io/promptlatch/agents.yaml
promptlatch serve --config agents.yaml
It listens on 127.0.0.1:8000 and allows the official provider endpoints only.
codex-latch
codex-latch exec "Review this repository"
Uses your ChatGPT login or OPENAI_API_KEY. If the proxy is down or
redaction is off, the wrapper stops instead of sending unredacted prompts.
uv tool install promptlatch
curl -fsSO https://bvolpato.github.io/promptlatch/agents.yaml
promptlatch serve --config agents.yaml
It listens on 127.0.0.1:8000 and allows the official provider endpoints only.
gemini-latch
gemini-latch -p "Summarize recent changes"
Works with Google sign-in or GEMINI_API_KEY. Vertex AI and other modes
that would bypass the proxy stop with an error.
uv tool install promptlatch
curl -fsSL -o openrouter.yaml \
https://raw.githubusercontent.com/bvolpato/promptlatch/main/examples/promptlatch-openrouter.config.yaml
promptlatch serve --config openrouter.yaml
This config allows OpenRouter only and keeps the key in OpenCode's environment.
curl -fsSL -o opencode.json \
https://raw.githubusercontent.com/bvolpato/promptlatch/main/examples/opencode-openrouter-promptlatch.json
export OPENROUTER_API_KEY="<openrouter-upstream-key>"
opencode run "Say ok" \
-m promptlatch-openrouter/openai/gpt-oss-120b
promptlatch init --target-base-url https://api.openai.com/v1
export OPENAI_API_KEY="<openai-upstream-key>"
promptlatch serve
Then set OPENAI_BASE_URL=http://127.0.0.1:8000/v1 for any
OpenAI-compatible client. Chat Completions, Responses, Anthropic Messages, and Gemini routes pass through in
their own format, with streaming and tool calls.
curl http://127.0.0.1:8000/v1/responses \
-H "X-Target-Base-URL: https://openrouter.ai/api/v1" \
-H "X-Target-API-Key: $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-oss-120b","input":"Say ok"}'
Choose a provider per request. The configured key is never sent to another host. To limit the hosts, list each one in the config:
target:
allowed_base_urls:
- https://api.openai.com/v1
- https://openrouter.ai/api/v1
uv add promptlatch
Or use python -m pip install promptlatch. No proxy needed. Four helpers cover text, messages, SDK parameters, and raw
payloads. They return a redacted copy and leave your input unchanged.
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",
)
)
The same call works with LiteLLM. Use redact_messages for Anthropic and
LangChain.
docker run -d --name promptlatch --rm \
-p 127.0.0.1:8000:8000 \
--env-file "$HOME/.config/promptlatch/provider.env" \
ghcr.io/bvolpato/promptlatch:0.3.0
curl --retry 10 --retry-all-errors --retry-delay 1 \
-fsS http://127.0.0.1:8000/healthz
provider.env holds PROMPTLATCH_TARGET_BASE_URL and
PROMPTLATCH_TARGET_API_KEY.
kubectl create secret generic promptlatch-env \
--from-env-file="$HOME/.config/promptlatch/kubernetes.env"
helm install promptlatch \
https://github.com/bvolpato/promptlatch/releases/download/v0.3.0/promptlatch-0.3.0.tgz \
--set env.PROMPTLATCH_TARGET_DEFAULT_BASE_URL=https://api.openai.com/v1 \
--set existingSecret=promptlatch-env
kubernetes.env holds PROMPTLATCH_TARGET_API_KEY and
PROMPTLATCH_SERVER_API_KEY. See the
deployment guide.
A request from a coding agent, line by line, on its way to the provider.
POST /v1/responses?token=[REDACTED_SECRET]
Scanned Query parameters, including signed URLs.
Authorization: Bearer local-client-key
Dropped Client credentials, unless you enable forwarding.
Cookie: session=abc
Dropped Cookies and secret-named headers.
Authorization: Bearer $OPENAI_API_KEY
Added Your provider key, and only for that provider.
{ "model": "gpt-6-sol", "stream": true,
Kept The JSON shape and provider-specific fields.
"input": [{ "role": "user", "content": "GITHUB_TOKEN=[REDACTED_SECRET]" },
Scanned Prompts and the full conversation history.
{ "type": "function_call_output", "output": "password=[REDACTED_SECRET]" }] }
Scanned Tool arguments and tool output, at any depth.
← data: {"type":"response.output_text.delta"}
Kept Responses stream back unscanned.
Deterministic rules, so the same input always gives the same result. No model calls and no entropy guessing.
sk-proj-OpenAIsk-ant-AnthropicAIzaGoogle Geminisk-or-v1-OpenRouterxai-xAIgsk_Groqpplx-Perplexityhf_Hugging Facer8_Replicateghp_GitHubglpat-GitLabATATTAtlassianlin_api_LinearAKIAAWSya29.Google ClouddapiDatabricksdop_v1_DigitalOceanhvs.Vaulttskey-Tailscalesk_live_Stripeshpat_Shopifyxoxb-SlackSG.SendGridnpm_npmpypi-PyPIsbp_Supabasevcp_Vercelnapi_Neonglsa_Grafanasntrys_SentryeyJJWTs://user:@Database URLssig=Signed URLs-----BEGINPEM and PGPpassword=Labeled values…abcd1234Your own rulesNot a complete list. Add an exact-tail or regex rule for internal formats, and store only the last few characters of a secret instead of the secret itself. See every pattern.
A local inspector shows each redacted request, what matched, and what it cost. Nothing in it leaves your machine.
promptlatch serve --dashboard
promptlatch tail --follow
promptlatch stats --days 7
PromptLatch protects what goes into a request. Know what sits outside it.
gzip and zstd bodies, with limits on expansion.--debug-requests prints raw bodies. Use it with fake data only.
A model's reply cannot prove what was sent. Send a fake key to an echo server and read
what arrived: GEMINI_API_KEY=[REDACTED_SECRET].
Use the config from promptlatch init. agents.yaml rejects the
echo server, because it allows the official provider endpoints only.
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'