跳到正文
DEV Community· OwlMem·· 36 分鐘前AI 評分52

OwlMem Vault 如何避免 API key 進入 AI 對話

Keep API keys out of your AI chats

AI 導讀

OwlMem 的 Vault 讓 AI 使用已儲存的 API key,而不會在對話中看到 key;項目在用戶電腦上以用戶持有的金鑰加密,OwlMem 只儲存無法讀取的密文。

正文

Keep API keys out of your AI chats

The fastest way to leak an API key is to paste it into an AI chat. Once it's in the conversation, it's in the chat history, in the model's context, and possibly in a log you don't control. And the next AI that needs the same key makes you paste it again.

OwlMem's vault breaks that pattern: store the key once, and your AIs use it without ever seeing it. (Disclosure: OwlMem is our own product — owlmem.com.)

OwlMem docs: The vault and the owlmem command

How it works

The vault is end-to-end encrypted. Items are encrypted on your machine with a key only you hold, and OwlMem stores ciphertext it can't read — not even we can open it. The main account turns it on in the console under Vault; everyone in the organization can then use it. Keep the recovery code it shows you: it's only for emergencies.

From then on, the flow is:

  1. Your AI asks when it needs a password. You approve on your phone — passkey, authenticator app, or GitHub — for 15 minutes to 2 hours at a time. Deleting and exporting always need a fresh approval.
  2. The AI gets the value without seeing it. For jobs that run while you're away, turn on a standing grant: the AI can then use any vault item on computers you've approved, only through owlmem run and vault_run, so it never sees the secret. Viewing, saving, deleting, and exporting still ask you each time.

The rule the product itself enforces: never put passwords or API keys in documents, memory, or chat. Use the vault.

Set it up

The main account turns the vault on in the console under Vault. The first time on a computer, send your AI this sentence (quoted from the docs):

Please set up the OwlMem vault on this computer: follow the vault section at https://mcp.owlmem.com and tell me what you need from me.

For developers, the owlmem command (Node 18 or later) is the hands-on route:

npm install -g owlmem
owlmem login            # paste a token for this agent
owlmem vault unlock     # press Enter to approve in your browser with a passkey (or paste the recovery code)
owlmem run --env DB_PASSWORD=<value>

owlmem run puts secrets into the command's environment, so the AI never sees them. To let an AI use the vault directly, add the local MCP server — decryption stays on your machine:

claude mcp add owlmem-vault -- npx -y owlmem mcp

When you press Enter at owlmem vault unlock, your browser opens a page showing the AI, the machine, and a code — check that the code matches your terminal, tap your passkey, and the key is sent to that machine only, encrypted for it.

You can import what you already have: Bitwarden, 1Password, KeePass, and .env files all import from the console, and export works the same way with one tap of your passkey. Changed or deleted items keep their previous version for 30 days, so a mistake is recoverable.

The habit to keep

The vault only helps if the key never goes into chat in the first place. The next time you're about to paste a key for an AI, stop and store it in the vault instead — once. After that, every AI that needs it asks you, you approve on your phone, and the key itself never appears in a conversation again.

The Free plan includes 20 vault items, which covers the handful of keys most developers actually hand to an AI. The full setup is in the docs.

來源:DEV Community · dev.to