Store API keys securely for AI agents
Save a key once. Your agents can use it, but Denker stops them from showing it.
Summary
The safe way to store API keys for AI agents is to keep them out of the chat and out of files the agent reads. Denker saves each key in macOS Keychain or Windows Credential Manager. Your agents get it as an environment variable in the projects you allow. Denker stops them from printing or showing saved key values, and from reading secret files.
Key points
- Keep API keys out of chat. Name the service, and Denker opens its key page for you.
- Copy the key on that page. Denker saves it and clears your clipboard.
- Agents can use the key in projects you allow, but Denker stops them from printing it or reading secret files such as SSH private keys.
Your agent needs a key to post, deploy or send. So you paste it into the chat. It works. Then the doubt starts: where does that message go now? If you want to store API keys securely for AI agents, the answer is simple. Keep keys out of the conversation. This guide shows how Denker does that. The demo takes about half a minute.
Watch: connect a Zernio API key without pasting it into the chat
Have you ever pasted an API key into an AI chat?
It's an easy thing to do. The agent asks for a token, the key is on your clipboard, and pasting it is the fastest way forward.
But now the key sits in the chat history, as plain text. You may not know who else can read it later. If you shared that chat, the key went with it.
That is the heart of AI agent API key security: the key should reach the agent, not the conversation.
What happens in the video
The user types: “can you help me connect to zernio api key”. Just the service's name, no key.
Denker opens zernio.com and shows a card: create a key, then click Copy. Because a web search found the page, the card warns: “Copy a key only if zernio.com is Zernio's own site.”
The user creates a key and clicks Copy. The card shows “Zernio key saved”. Nothing was pasted into the chat.
How to store API keys securely for AI agents with Denker
Each step closes a common way a key leaks.
- Stored on your computer: keys go into macOS Keychain or Windows Credential Manager.
- Only a fresh copy counts: Denker takes the key only from a copy made after the key page opened, and only while the card is open. It never takes a password with symbols, an address or a sentence.
- Clipboard cleared: after saving, Denker clears the clipboard, so the key isn't left there for the next paste.
- Address check: when the key page comes from a web search, the card says so and asks you to check the domain. If the address isn't on the service's own domain, Denker warns you.
- Checked when possible: Denker tests the key with the service where it can. Otherwise it says “saved, not checked yet”, as in the video.
- Hidden from view: saved values are hidden in what Denker stores, shows and logs.
Can an agent use a key it can't show?
Yes. Your agent gets the key as an environment variable in the projects it is allowed in. Tools and scripts read it the usual way.
What Denker stops is the agent printing or showing saved key values. Agents are also stopped from reading SSH private keys, cloud CLI credential files, and keychain or credential-store dumps.
You decide where each key works. A key you add in Settings works in all projects. A key an agent asks for works in that project only. You can change this on the key's page.
Each key also shows when it was last used, and by which chat.
Chat, .env files or a key store: which is safer?
Secrets management for AI agents starts with where the key lives. The common ways to give keys to Claude Code, Codex and other agents:
| Where the key lives | Can the agent use it? | What to watch |
|---|---|---|
| Pasted into the chat | Yes | The key stays in the chat history as plain text |
| A project .env file | Yes | Agents can read the file, since coding needs it; it is easy to share or commit by mistake |
| Your shell profile | Yes | Programs started from your terminal see it, and the file is plain text |
| Denker Keys | Yes, in projects you allow | Saved in your system's key store; Denker stops agents from printing it |
Denker keeps project .env files readable, because coding needs them. Keys left there don't get the protection saved keys get. Move the ones you care about into Denker Keys.
Set up a key in two ways
In the chat: name the service, as in the video. Denker opens the key page and shows the card. If no key arrives within 10 minutes, the card closes and the agent tells you.
In Settings › Plugins › Keys: choose Add a key. Hetzner Cloud, GitHub, Vercel, Cloudflare, OpenAI and Stripe have built-in guides. For any other service, type its name, and your own Claude Code or Codex finds its key page with one web search.
Servers and apps that take a key
Servers: agents reach your SSH servers through Denker's own SSH agent and never see the private key.
Apps that take an API key say “The key stays on this computer.” Set up key opens the same key guide.
Denker is a desktop AI agent for your real work, so access matters. Your keys, servers and projects sit in one AI agent workspace, and you decide which project gets what.
Frequently asked questions
Can my AI agent see my API key?
Your agent can use it: the key reaches it as an environment variable in the projects you allow. Denker stops agents from printing or showing saved key values, and hides them in what Denker stores, shows and logs.
Where does Denker store API keys?
On your computer, in macOS Keychain or Windows Credential Manager.
Does this work with Claude Code and Codex?
Yes. Agents in Denker, running Claude Code, Codex or OpenCode, get the key as an environment variable. Finding the key page for a service Denker doesn't know needs Claude Code or Codex.
I already pasted a key into a chat. What now?
Treat it as exposed. Create a new key at the service, delete the old one, and save the new key in Denker. When you replace a saved key, Denker offers to open the service so you can delete the old key there.