Keep API keys and passwords out of your prompts (secret scrubbing)

Coding agents read your files and send them to the model, and that includes .env files, config files and command output with keys in them. Every prompt passes through at least one company that runs the model, and prompts have leaked from model providers before. Keys found in leaked prompts have been used within hours.

Secret scrubbing replaces credentials in a request with placeholders before it leaves Obscurify.ai. The model sees [REDACTED_GITHUB_TOKEN_1] where your token was, so it can still talk about the file and its structure, but it never gets the token.

It is off unless you turn it on. Some work needs the model to see the real value (debugging a token, for example), so nothing is changed unless you ask.

What it replaces

Only formats that are almost certainly live credentials:

  • AWS access key ids (AKIA..., ASIA...) and the secret access key written next to its name
  • GitHub tokens (ghp_, gho_, ghs_, ghu_, ghr_, github_pat_)
  • sk-... API keys in the format OpenAI and many other services use, and Anthropic keys (sk-ant-...)
  • Stripe live and restricted keys (sk_live_, rk_live_)
  • Slack tokens (xoxb-, xoxp- and the rest)
  • Google API keys (AIza...)
  • PEM private key blocks (-----BEGIN ... PRIVATE KEY-----), the whole block
  • JWTs used as a credential, after Bearer
  • The password in a URL, such as postgres://app:PASSWORD@db/app (only the password part)
  • Values of .env lines whose name ends in PASSWORD, SECRET, TOKEN, API_KEY, ACCESS_KEY and similar, such as DB_PASSWORD=...
  • Quoted password values (password = "...", "password": "...") and Password=...; in connection strings

References are left alone: $DB_PASSWORD, ${TOKEN}, {{ secret }}, <your-key>. So is code such as password=args.password, and names such as MAX_TOKENS=4096.

It does not catch everything. A password in a sentence or a key in a format not listed here goes through unchanged, so don’t treat this as a guarantee.

What it looks at

Message text and tool results in chat completions, the Responses API and the Anthropic Messages API (Claude Code). That covers system prompts, user and assistant messages, tool call arguments and tool outputs. Tool definitions, the model id and signed reasoning are never changed.

The same secret gets the same placeholder everywhere in a request, so the model can tell that two files use the same key. Placeholders are numbered in the order they first appear, so a conversation sent again with a new message gets the same placeholders as before.

Replies are not changed back. If the model writes a config file, it writes the placeholder, and you put the real value in yourself.

Requests in Encrypted mode are not scrubbed. Their content is encrypted on your device, so we can’t read it, and neither can the company running the model.

We don’t log or store what was found. The response only says how many.

Turn it on

For one request

Send the header X-Obscurify-Scrub-Secrets: 1:

curl https://obscurify.ai/v1/chat/completions \
  -H "Authorization: Bearer $OBSCURIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Obscurify-Scrub-Secrets: 1" \
  -d '{"model": "openai/gpt-5-mini", "messages": [{"role": "user", "content": "Why does postgres://app:hunter2@db/app fail?"}]}'

The model gets postgres://app:[REDACTED_PASSWORD_1]@db/app.

In Claude Code, add the header with an environment variable:

export ANTHROPIC_BASE_URL=https://obscurify.ai
export ANTHROPIC_AUTH_TOKEN=sk-obs1_your-key
export ANTHROPIC_CUSTOM_HEADERS='X-Obscurify-Scrub-Secrets: 1'
claude

With the OpenAI SDK, pass it as a default header:

from openai import OpenAI

client = OpenAI(
    base_url="https://obscurify.ai/v1",
    api_key="sk-obs1_your-key",
    default_headers={"X-Obscurify-Scrub-Secrets": "1"},
)

For an API key, or all of them

On the Account page, under API Keys, tick Scrub secrets on a named key, or Scrub secrets on all keys for every key of the account, the Default key included. Every chat completions, Responses and Messages request made with that key is then scrubbed, with no header needed.

From a script, with your account key (see account keys):

# One named key (its id is in GET /api_keys)
curl -X POST https://obscurify.ai/api_keys/KEY-ID/scrub_secrets \
  -H 'Content-Type: application/json' \
  -d '{"enabled": true, "account_key": "YOUR-ACCOUNT-KEY"}'

# Every key of the account
curl -X POST https://obscurify.ai/api_keys/all/scrub_secrets \
  -H 'Content-Type: application/json' \
  -d '{"enabled": true, "account_key": "YOUR-ACCOUNT-KEY"}'

GET /api_keys shows scrub_secrets for each key and scrub_secrets_all_keys for the account.

Turn it off for one request

When a key has scrubbing on and one request needs the real values, send X-Obscurify-Scrub-Secrets: 0. The header always wins over the key and account settings.

Check that it worked

Whenever scrubbing is on, the response has X-Obscurify-Secrets-Scrubbed, the number of different secrets replaced in that request:

curl -si https://obscurify.ai/v1/chat/completions ... | grep -i x-obscurify-secrets-scrubbed
x-obscurify-secrets-scrubbed: 1

0 means scrubbing was on and nothing matched. No header means it was off.

The chat on the website and in the app is not affected by these settings.