Guide · Security

Secret Shield

Keep API keys and passwords private. The AI never sees them.

With Secret Shield on, every secret in your request is masked with a placeholder before the prompt reaches the AI model. The model and the provider that runs it only ever see the placeholder. Your real value is restored in the answer, so your app or coding agent works as normal.

Masked before the AI. In RAM only. Never stored or logged. Masking is fully automatic, so no person ever sees your prompt. Your secrets are erased the moment the answer ends.

1. You send

DB_PASSWORD=Tr0ub4dor-x9

2. The AI sees

DB_PASSWORD=QBX_SECRET_PASSWORD_7K2M9QXA

3. You get back

DB_PASSWORD=Tr0ub4dor-x9

Tip: Free and off by default. It adds a few milliseconds to a request.

Why use it

Coding agents read .env files, stack traces and configs, and those often hold keys. Secret Shield keeps those values out of what the AI provider can read or log. It's a safety net, not a reason to paste secrets: keep them out of prompts when you can.

Turn it on

There are three switches. Any one of them turns it on.

Whole account
App → Settings → Privacy → Secret Shield. Covers every API key (including keys you make later) and web chat.
One API key
App → API keys → Edit (or Advanced settings when creating) → Secret Shield. Best for tools that can't send headers, like Cursor.
One request
Send the header X-Qubax-Secret-Shield: on.

A key can't switch it off while the account switch is on. To shield only some keys, leave the account switch off and turn it on for those keys. Changes apply to the next request.

Header examples

Shell
curl https://api.qubax.ai/v1/chat/completions \
  -H "Authorization: Bearer $QUBAX_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Qubax-Secret-Shield: on" \
  -d '{
    "model": "claude-haiku-4.5",
    "messages": [{"role": "user",
      "content": "Why does DB_PASSWORD=... fail?"}]
  }'
Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.qubax.ai/v1",
    api_key=QUBAX_KEY,
    # every request from this client:
    default_headers={
        "X-Qubax-Secret-Shield": "on",
    },
)
Shell
# Claude Code
export ANTHROPIC_BASE_URL="https://api.qubax.ai"
export ANTHROPIC_API_KEY="qbx_..."
export ANTHROPIC_CUSTOM_HEADERS="X-Qubax-Secret-Shield: on"

The header accepts on or off. Anything else is a 400. Sending off can't override a key or account that has it on.

Check that it worked

Shielded responses carry these headers:

X-Qubax-Secret-Shield
on when the request was shielded.
X-Qubax-Secrets-Hidden
How many different secrets were hidden in this request.

No X-Qubax-Secret-Shield header means the request wasn't shielded.

What it hides

  • Known key formats anywhere: OpenAI, Anthropic, Google, GitHub, GitLab, Slack, Stripe, Hugging Face, Groq, xAI, AWS access keys, npm, PyPI, Telegram bot tokens, Qubax qbx_live_ keys and more.
  • Private keys (PEM blocks, OpenSSH, PGP, Bitcoin WIF), JWTs, and seed phrases of 12 to 25 words.
  • Passwords and tokens by their label: password=…, DB_PASSWORD: …, --api-key …, Authorization: Bearer …, cookies, and the password in postgres://user:…@host.

It reads every text part of the request: messages and history, system prompt, tool descriptions, tool calls and tool results. Example values like changeme, ${API_KEY} or **** are left alone.

Placeholders

Each secret becomes QBX_SECRET_<KIND>_<ID>, for example QBX_SECRET_APIKEY_K7M2Q9XA. The kind (APIKEY, PASSWORD, PRIVATEKEY, SEEDPHRASE, TOKEN, JWT…) tells the model what was there, so it can still reason about it. A known key format gets the same placeholder on every turn, so prompt caching keeps working. Placeholders are unique to your account and can't be turned back into the value.

Every placeholder in the answer is replaced with your real value: in text, code, tool calls and structured output. The one exception is the model's thinking text, which keeps the placeholders.

Where it works

Shielded
/v1/chat/completions, /v1/responses, /v1/messages (Anthropic), streaming and non-streaming, and web chat.
Sent as they are
Embeddings, images, audio, video and files sent as base64. Hiding text inside an embedding would change the result, and media isn't text.

Shielded requests are always served through our main providers, never through the Qubax Exchange, so a seller never gets the raw prompt.

Errors

Secret Shield fails closed: if it can't hide your secrets, the request isn't sent and you aren't charged.

400 · bad header
The header wasn't on or off.
400 · secret in a schema
A secret is inside a tool or response schema (enum, const, pattern, default, examples). Take it out of the schema.
400 · secret in a fixed field
A secret is in a field that can't be changed (id, name, model, user, an object key). Move it into the message text.
400 · too large
More than about 4 million characters of text, or more than 500 different secrets.
409 · secret in earlier thinking
Signed thinking in the current tool-use turn holds a secret (usually from before the shield was on). Start a new conversation.
503 · briefly unavailable
The shield couldn't be confirmed, so nothing was sent. Retry in a minute.

Know the limits

Heads up: Putting values back means trusting where the model writes them. If a model writes a command or link that sends a placeholder somewhere, your agent gets the real value there. Review commands your agent runs, and don't auto-load remote images when working with credentials.
  • A secret with no known format and no label around it can be missed.
  • A password repeated later without its label (a bare value) is sent as it is.
  • Images, PDFs, audio and files aren't scanned. Presigned file URLs (S3, Azure) are left intact so the provider can fetch them.
  • Placeholders can change token counts slightly, so a shielded request may cost a few tokens more or less.

Related: API keys · Choose providers · Routing modes

Ready to build?

380+ models through one OpenAI & Anthropic-compatible API, up to 99% below OpenRouter.

Get your API key →