keepmum › Codex
Keep your keys out of Codex’s requests
Last updated November 20, 2026
Codex reads your .env to find out why the build can’t reach the cache, runs printenv, and gets a log with a token in it. All of that becomes part of the conversation, and every request sends the conversation to OpenAI. keepmum is a free, open-source proxy on your Mac that masks those values before the request leaves and puts them back when the answer comes in, so Codex keeps working with the real values and OpenAI never receives them.
What changes
Codex reads a .env file. What it holds, and what goes to OpenAI:
# on your Mac
GITHUB_TOKEN=ghp_4Rk9vTq2LmX8wZbN7cYpD3fH6jS1aE0uGx5K
REDIS_URL=redis://default:Pq7Lx2Vn9Rt4Mz8W@cache.internal:6379
# sent to OpenAI
GITHUB_TOKEN=KEEPMUM_SECRET_9c4e2a71
REDIS_URL=redis://default:KEEPMUM_SECRET_51d8f3b0@cache.internal:6379
Only the secret is replaced: Codex still sees which service, host and port it is working with. When the model answers with a patch, a shell command or a script that uses the token, keepmum swaps the placeholder back on your Mac, quoted for the shell or escaped for JavaScript as needed, so the command gets the real value exactly as it was. The same value always gets the same placeholder, so OpenAI’s prompt cache keeps working.
Set it up
keepmum runs on a Mac with Apple silicon and macOS 14 or later. Pick one way in.
The Mac app
Download the app, drag it into Applications, open it and follow Setup: download the model, start the background service, and switch on protection for Codex.
The terminal: one session
With the command line installed, start Codex through keepmum. It works with a ChatGPT login or an API key, and arguments pass through to codex.
keepmum codex
For that run only, keepmum points Codex’s own OpenAI provider at itself, with your existing login. Codex tries a WebSocket first; keepmum can’t scan those, so it refuses it, and Codex goes on over HTTPS at once. Your Codex config file is not changed.
The command line: every session
keepmum serve # the proxy, on http://127.0.0.1:7788
keepmum protect on --client codex # Codex now sends every session to it
keepmum protect on adds one marked line to ~/.codex/config.toml, openai_base_url, after backing the file up, and keepmum protect off removes only what it added. Nothing needs restarting: Codex reads its config as each conversation starts or reopens, so every new conversation goes through keepmum, in a terminal, an editor or the Codex app already running, and an older one does when it is reopened. A conversation open at the moment you switch keeps its route until it is closed, and keepmum says how many still are. Without --client, it protects the other agents you have installed too (Claude Code, pi, opencode). keepmum serve must keep running while protection is on; the Mac app runs it at login.
With a gateway you already use
If Codex already goes through a gateway (LiteLLM, OpenRouter, a company proxy), keepmum protect on puts keepmum in front of it. Your provider keeps its key variable, headers and auth, with only its address pointed at keepmum’s route to the gateway (off puts it back), so the gateway still picks models and accounts and only ever receives placeholders. A provider with wire_api = "chat" is refused, because keepmum doesn’t scan Chat Completions.
Check that it works
keepmum doctor # every line should be ✓
keepmum selftest # fails if a test secret gets past keepmum
To see what keepmum would catch before it changes anything, keepmum observe on scans and counts but sends every request as Codex wrote it. keepmum observe off masks again.
What gets masked
- Always, secrets: API keys, tokens, passwords, private keys and connection strings, in code, config files, command-line flags and plain sentences. Output Codex prints encoded, such as
xxd .envorbase64 < .env, is decoded and scanned too. - If you turn it on, personal data (
keepmum pii on): names, emails, phone numbers, addresses, account numbers and dates of birth. - Your own rules:
keepmum rules maskadds a pattern,keepmum rules allowlets an exact value through.
Detection runs on your Mac: 96 rules with entropy and checksum checks, then a local model on the Mac’s GPU. If keepmum can’t scan a request, it blocks it rather than send it raw.
What Codex can still do
- Patch files and run commands with the real values. A placeholder in a patch, a shell command or one of Codex’s JavaScript tool calls is put back first, so
git push, your tests and a database login keep working. - Use MCP servers, with less. A server gets back only the values it returned itself, so a search can be followed by opening what it found. That holds when Codex calls an MCP server from inside a script, too. Web search keeps placeholders. None of them ever gets a secret.
- Not send a known token somewhere else. A token whose issuer keepmum knows (GitHub, Stripe, AWS, OpenAI and 68 more) stays a placeholder in a command that would send it to any other host.
Where it stops
- A Codex script can pass what a command read to a network tool. Codex runs a model’s tool calls as one JavaScript program, so a script can read a file and hand its contents to an MCP tool without the model, or keepmum, seeing them. keepmum adds a check to such scripts that withholds any key in a provider’s format (
[a secret, withheld by keepmum]); a bare password still goes, with a warning. To keep every secret out, ask Codex to make the network call in a step of its own. - Shell commands get real values. A password, or a command built to hide where it sends things, can get past the check on known tokens. Keep Codex’s own sandbox on, with network access off where you can: keepmum controls what OpenAI sees, and the sandbox controls what commands can reach.
- The Responses API only. Codex’s WebSocket transport is refused (it falls back to HTTPS), and Chat Completions requests are blocked, not sent unscanned.
- Your local history keeps real values. Codex’s session files on your disk hold the restored conversation. keepmum protects what leaves your Mac, not what is stored on it.
- Images and PDFs pass unscanned, and the local model is strongest on English.
- keepmum is alpha and not yet independently audited. Every limitation, in full.
Questions
Does Codex send my .env file to OpenAI?
If it reads it, yes. A file Codex reads, or a command’s output, becomes part of the conversation, and each request sends the conversation to OpenAI. With keepmum in between, the keys and passwords in it go as placeholders.
Does it work with a ChatGPT login?
Yes. keepmum codex works with a ChatGPT login or an API key, and keeps the login you already have.
Does keepmum change my Codex config?
keepmum codex does not: its settings apply to that run only. keepmum protect on does: it points Codex’s own OpenAI provider at keepmum with one marked line in ~/.codex/config.toml (openai_base_url), after backing the file up, and keepmum protect off removes only what it added. Nothing needs restarting: every Codex conversation that starts or reopens after that goes through keepmum.
How much slower is Codex with keepmum?
About 100 to 145 ms a request at the 95th percentile for 4K tokens of new text; earlier turns are cached. With the rules alone (keepmum model off), 8 to 9 ms.
keepmum also works with Claude Code, the Antigravity CLI, Gemini CLI, pi and opencode. See how it works.