Skip to content
EthAskPublic

About

Keep API keys out of AI agents: keys live in your OS keychain, agents only see placeholder tokens.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LLLanyard

By Ethan Askew T/A LLLanyard. Source-available under the Business Source License 1.1 (see License).

Keep API keys out of AI agents. Your keys live in the OS keychain; tools like Claude Code, Cursor or AutoGPT only ever hold a worthless placeholder token and talk to a local proxy that injects the real key.

agent (token lly_…)  ──►  127.0.0.1:3000  ──►  api.openai.com / api.anthropic.com
                          │  verifies token, rate-limits, adds the real key from the OS keychain
                          └─ macOS Keychain · Windows Credential Manager (DPAPI) · Linux Secret Service

Quick start

npm install -g @lllanyard/cli     # needs Node 22 or later; from source: npm install && npm run build && npm link -w packages/cli

lllanyard doctor                  # confirms the OS keychain works
lllanyard ui                      # or use the visual app for everything below
lllanyard add anthropic           # hidden prompt – the key never touches argv/history
lllanyard add openai
lllanyard setup claude-desktop --scripts-dir ~/Scripts   # Claude Desktop on a subscription: see below
lllanyard agent create claude-code   # API-key mode: prints a placeholder token ONCE + the env vars to set
lllanyard start                   # proxy on 127.0.0.1:3000

Then, in the shell that launches your tool, set the values agent create printed, e.g.:

export ANTHROPIC_BASE_URL=http://127.0.0.1:3000/anthropic
export ANTHROPIC_API_KEY=lly_...        # placeholder, useless outside the proxy
export OPENAI_BASE_URL=http://127.0.0.1:3000/openai/v1
export OPENAI_API_KEY=lly_...

Compatibility notes:

  • Claude Code reads its base URL and key from these environment variables; if ANTHROPIC_AUTH_TOKEN is also set it may take precedence, so unset it. Only API-key mode is proxied, not subscription logins. The Claude Desktop app ignores these variables; for Desktop (and subscription use generally) see Claude Desktop below.
  • Cursor makes some model calls from its own servers, so a localhost base URL may not work there.

Commands

Command What it does
add <provider> [--label N] [--rotate-days N] [--env-name VAR] Store a key (hidden prompt or --stdin). --label doubles as a client name for agency/freelancer use.
env <provider>[:label] VAR The environment variable a key is given to scripts as, e.g. lllanyard env github GITHUB_TOKEN.
exec <command> [args…] Run a script with the keys it uses: lllanyard exec pwsh -File ./Deploy-App.ps1 -DryRun. LLLanyard reads the script, and the helper files it loads (quoted paths, source/. lines, Python imports), for your keys' variable names and passes only those, for that run only. Keys in the output are redacted; each run is logged and shown by usage. exec --keys github,sendgrid -- <command> names the keys yourself (needed for programs that aren't scripts). Run from a terminal, the script gets a real terminal of its own (prompts like Read-Host, colours and window size work) on macOS, Linux and Windows, and its output is still redacted.
list, remove, rotate, status Manage keys; status shows rotation due dates and exits 1 if anything is overdue (cron/CI friendly).
agent create <name> [--client N] [--providers a,b] / list / revoke Placeholder tokens. --client acme pins an agent to the acme key; --providers limits which APIs it may reach (least privilege).
provider add <id> --upstream https://… [--auth bearer|header --header NAME --prefix TXT] / list / remove Teach the proxy a new API host (GitHub, Slack, your own service). Built-ins: openai, anthropic, gemini, openrouter, github, slack, stripe, notion.
tool add <name> --env VAR=provider[:label] [--allow-host H] [--kill-on-leak] [--pass-env V] [--inherit-env] [--no-scrub] -- <command> [args…] / list / remove Approve a command (e.g. an MCP server) to receive keys as environment variables, with the safeguards below.
run <name> [-- args…] Run an approved tool with its keys injected and scrubbed from its output. Extra args are appended only if the tool was approved with --allow-args. For script tools (python, node, sh, pwsh…) the script file is pinned by hash at approval and run refuses if it has changed since; --allow-args is refused for bare interpreters (python3 -c, -m) and launchers (env, xargs, sudo, npx). run --env … -- <cmd> is a one-off that needs a human to confirm at a terminal.
audit [--json] Show what an AI agent on this computer could still get at (plaintext keys, SSH keys on disk, tools not set up) and how to fix each. Exit 1 if anything needs fixing. See Audit.
scan [paths] [--import --apply [--redact]] Find plaintext keys in .env files, MCP/IDE configs and shell profiles, then move them into the keychain. Dry run unless --apply.
backup [--out FILE] [--passphrase-file F] Write one encrypted file (AES-256-GCM, scrypt passphrase) holding your keys and their metadata, custom providers, approved tools, agents, license and team server link. Agents are saved as token hashes, so existing agent tokens keep working after a restore.
restore <file> [--overwrite] [--dry-run] [--passphrase-file F] Merge a backup into this machine's keychain or vault. Every item is validated and the key limit checked before anything is written; existing items are kept unless --overwrite, and nothing is ever deleted.
start [--port N] Run the proxy (loopback only). Logs JSON lines to stdout.
team join <https://server:port> [--ca FILE] [--stdin] / status / leave Team: link this LLLanyard to your team's shared proxy. Your keys here stay personal; requests you have no key for go to the team server with your own team token.
ssh add <name> --host [user@]HOST [--port N] [--key-file F | --password] / generate / list / remove / pubkey SSH logins in the keychain: a private key (with its passphrase) or a password. See SSH logins.
ssh <name> [-- remote command] / ssh with <name>[,<name>] -- <command…> Open a session, or run scp, rsync, git or a script with the login available.
setup [claude-desktop | claude-code | codex | copilot [--project DIR] | agent [--file F]] [--remove] Connect an AI tool: tell it to use LLLanyard, and add the MCP server. No argument shows what is connected. See OpenAI Codex, GitHub Copilot and other agents.

Using it with tools (APIs and MCP servers)

Three routes, depending on how the tool talks:

1. HTTP APIs go through the proxy (the tool only holds the placeholder token):

lllanyard add github                              # hidden prompt
lllanyard agent create reviewer --providers github,anthropic
# point the tool's API base URL at http://127.0.0.1:3000/github and use the lly_ token as its key
lllanyard provider add acme --upstream https://api.acme.dev --auth header --header X-Api-Key   # your own API

2. MCP servers and CLI tools read keys from environment variables, so the proxy can't help. Approve the command once, then reference it by name so no secret ever appears in the MCP config file:

lllanyard tool add github-mcp --env GITHUB_PERSONAL_ACCESS_TOKEN=github \\
  --allow-host api.github.com --allow-host registry.npmjs.org --kill-on-leak \\
  -- npx -y @modelcontextprotocol/server-github
# MCP client config (Claude Desktop / Claude Code / Cursor style):
#   { "command": "lllanyard", "args": ["run", "github-mcp"] }

3. Claude Desktop and Claude Code on a subscription. These sign in to an account, not an API key, so there is no API call to proxy and no extra API billing. Connect them once, from the command line or from the app's Scripts tab ("Connect AI apps"):

lllanyard setup claude-desktop --scripts-dir ~/Scripts   # --restart quits and reopens Claude Desktop if it's open (macOS)
lllanyard setup claude-code                              # adds a short section to ~/.claude/CLAUDE.md
lllanyard setup                                          # shows what's connected; --remove undoes either

Claude Desktop rewrites its config file when it quits, so a change made while it's open is lost. setup therefore only changes it while the app is closed: on macOS it offers to quit Claude Desktop, make the change and reopen it (--restart does this without asking); on Windows and Linux, quit it first (including from the system tray).

setup claude-desktop adds LLLanyard's MCP server to claude_desktop_config.json (macOS ~/Library/Application Support/Claude/, Windows %APPDATA%\Claude\, Linux ~/.config/Claude/). It keeps your other settings, saves the old file as claude_desktop_config.json.lllanyard-backup, and uses absolute paths plus your current PATH, since desktop apps start MCP servers with a minimal one. If you move or reinstall Node or LLLanyard, run it again (setup warns when the paths are stale). setup claude-code adds a marked section telling Claude Code to run scripts with lllanyard exec and never read keys from .env files. It leaves the rest of the file alone.

In Claude Desktop, Claude then sees list_scripts and run_script for tools you approved with lllanyard tool add: the script runs with its keys, the output (keys redacted) and exit code go back to Claude, and the run is logged (lllanyard usage). It can't run anything you haven't approved, can't change the command, and only adds arguments where you said --allow-args. Scripts get no input, so ones that prompt (Read-Host) need a non-interactive switch. Runs stop after 10 minutes.

With --scripts-dir DIR (repeatable) you don't have to approve scripts one by one. Claude also gets run_file, which can run any .ps1, .py, .sh, .zsh or .js file in those folders, but only after you click Run in a window LLLanyard shows (anything but a click on Run means no; it gives up after 2 minutes). On macOS and Windows it appears in the bottom-right corner without taking your keyboard or mouse, so you can't answer it by typing. It shows Claude's plain-English explanation of what the run will do (Claude's own words, not checked), the script, its arguments, the keys it will get (only the ones it uses, as with exec), and a warning if the script or a helper changed in the last day, since an AI may have written it. The files are hashed before the dialog and checked again at launch, so a script edited while you decide isn't run. Symlinks out of the folder, your home directory and / are refused. The window: macOS built in, Windows built in, Linux needs zenity (an ordinary dialog, which your desktop may give the keyboard to; Deny is its default). If no window can be shown, nothing runs.

Why "approve once": if run could inject any key into any command, an agent that can edit your MCP config could point it at curl https://evil and walk off with the key. Approved tools live in the keychain, with the command pinned to its absolute path, so editing a file can't change what receives a key. Custom providers are stored in the keychain for the same reason.

4. Codex, Copilot, Gemini, Windsurf, Cursor and other agents. The same two things Claude gets: instructions to use LLLanyard, and its MCP server. One command per tool:

lllanyard setup codex                      # OpenAI Codex (CLI and IDE extension)
lllanyard setup copilot                    # GitHub Copilot CLI
lllanyard setup copilot --project .        # VS Code Copilot Chat / Copilot coding agent, for this folder only
lllanyard setup gemini                     # Gemini CLI
lllanyard setup windsurf                   # Windsurf
lllanyard setup cursor                     # Cursor (MCP server; add the instructions in its rules, see below)
lllanyard setup agent [--file AGENTS.md]   # anything else: adds the instructions to a file, prints the MCP snippet
lllanyard setup codex --remove             # undo any of them
Tool Instructions go in MCP server goes in
OpenAI Codex ~/.codex/AGENTS.md ~/.codex/config.toml ([mcp_servers.lllanyard])
GitHub Copilot CLI ~/.copilot/copilot-instructions.md ~/.copilot/mcp-config.json
VS Code Copilot Chat (--project) .github/copilot-instructions.md .vscode/mcp.json
Gemini CLI ~/.gemini/GEMINI.md ~/.gemini/settings.json
Windsurf ~/.codeium/windsurf/memories/global_rules.md ~/.codeium/windsurf/mcp_config.json
Cursor its settings (Rules): run setup agent and paste the section ~/.cursor/mcp.json
Any other agent the file you name (default AGENTS.md, which many agents read) paste the snippet setup agent prints

Each one keeps the rest of the file as it was, marks the part it adds so a second run updates it rather than duplicating it, saves the old file as <file>.lllanyard-backup, and can be removed again. The --project files name lllanyard rather than paths on your computer, so they are safe to commit; each person still needs LLLanyard and their own keys. setup with no arguments shows what is connected.

Any agent that can run shell commands works without any setup: lllanyard exec and lllanyard ssh are ordinary commands, so all the agent needs is to be told to use them. That is all setup does for you. For an MCP client not listed above, add this to its settings (some call the top-level key servers):

{ "mcpServers": { "lllanyard": { "command": "lllanyard", "args": ["mcp", "--run"] } } }

What to expect:

  • The instructions are a request, not a lock. The protection is that an agent running lllanyard exec or lllanyard ssh never sees the key. An agent that ignores the instructions can still look in .env or ~/.ssh for keys that are stored there, so remove those (lllanyard scan --import --apply), and for Claude Code turn on the hook, which refuses the call. lllanyard audit lists what is left.
  • The Run dialog guards the MCP tools (run_file, ssh_run). A command the agent runs itself in a terminal, such as lllanyard ssh prod -- uptime, isn't behind that dialog. It is gated only by the agent's own terminal-approval setting, so keep that on for tools you don't fully trust.
  • ChatGPT (the website and the desktop and mobile apps) can't be connected. It can only use MCP servers that are hosted on the internet, not one that runs on your computer, and LLLanyard doesn't expose your keys that way. OpenAI Codex runs on your computer and is supported. Likewise the Copilot coding agent that runs on GitHub's servers can't reach your keychain; use Copilot in VS Code or Copilot CLI.

Making Claude Code refuse, not just asked

Instructions ask an agent to leave your secrets alone; a hook makes the tool refuse. With the hook on, Claude Code checks every file read, edit, search and shell command before it runs, and stops any that touch a .env file, an SSH private key, or a credential file (~/.aws/credentials, ~/.netrc, ~/.gnupg, and similar). It tells Claude to use lllanyard exec or lllanyard ssh instead.

lllanyard setup claude-code --hooks     # adds the hook to ~/.claude/settings.json (your other settings and hooks are kept)
lllanyard setup claude-code --remove    # removes the instructions and the hook

.env.example, .env.sample and .env.template are allowed, as are public keys, known_hosts and ~/.ssh/config. If you keep separate Claude Code profiles (a different CLAUDE_CONFIG_DIR per client or project), each has its own settings, so set up each one: lllanyard setup claude-code --hooks --config-dir ~/.claude-work. lllanyard audit lists any profile folders next to ~/.claude that aren't set up. Commands that start with lllanyard are always allowed. The check takes about a tenth of a second and never contacts the network; if it can't make sense of a call it lets it through, so it can't get in the way of your work.

Honest limits: the hook looks at the paths a call names, so a command that builds a path while it runs (cat $(printf '.e%s' nv)) gets past it, and so does a bare file name after a cd inside the same command. It stops a careless or tricked agent, not a determined attacker. For a hard boundary run the tool under --sandbox.

Audit: what can an agent still reach?

$ lllanyard audit
HIGH   2 plaintext keys in files an AI agent can read
         openai     sk-proj…FfC1     ~/.zshrc:1
       fix: lllanyard scan --import --apply --redact
HIGH   SSH private key on disk with no passphrase: ~/.ssh/id_ed25519
       fix: lllanyard ssh add <name> --host user@host --key-file ~/.ssh/id_ed25519   then check it works and delete the file
MEDIUM OpenAI Codex is installed but not set up to use LLLanyard
       fix: lllanyard setup codex

It checks for plaintext keys in .env files, shell profiles and MCP configs (the same search as scan), SSH private keys in ~/.ssh, keys overdue for rotation, SSH logins past their expiry, AI tools that are installed but not connected, and Claude Code without its hook. It prints where things are with masked values, never a secret. The exit code is 1 if anything is high or medium, so you can run it in a script; --json gives the same as data.

Leak safeguards for tool processes

A tool started with run holds its key, so LLLanyard puts guard rails around it:

Safeguard What it does Default
Minimal environment The tool inherits only basics (PATH, HOME, temp dirs, locale, CA settings), so it can't see your other API keys or cloud credentials. --pass-env VAR adds specific variables; --inherit-env restores everything. on
Output scrubbing Removes the key from the tool's stdout/stderr, including base64, base64url, hex and URL-encoded copies. Streams, so MCP's newline-delimited stdio never stalls. on
Leak alert / kill The first time the tool prints its key you get a warning on stderr; with --kill-on-leak the tool is stopped at once (exit code 70). A tool echoing its own token is a strong sign it is buggy or compromised. warn
Egress allowlist --allow-host api.github.com (repeatable, *.example.com wildcards) starts a loopback proxy protected by a per-run password; the tool's proxy variables point at it, so it can only open HTTPS tunnels to listed hosts on public IPs. Denied attempts are logged. off
Clean shutdown Signals are forwarded and the tool is killed if LLLanyard exits. Keys go only into the child's environment, never the parent's. on
Pinned command The command is stored as an absolute path in the keychain, so a PATH swap or config edit can't change what receives the key. on

Enforced isolation: --sandbox

Without a sandbox the safeguards above are advisory: a malicious tool can ignore proxy settings. --sandbox makes them OS-enforced:

lllanyard tool add github-mcp --sandbox --allow-host api.github.com --allow-host registry.npmjs.org \
  --env GITHUB_PERSONAL_ACCESS_TOKEN=github -- npx -y @modelcontextprotocol/server-github
lllanyard doctor        # reports whether a sandbox works on this machine
Linux (bubblewrap) macOS (Seatbelt sandbox-exec)
Network No network at all. The only way out is a unix socket to the host egress proxy (via a tiny in-sandbox bridge), which allows only --allow-host hosts. DNS is resolved on the host. Denied, except loopback to the egress proxy port
Home directory Replaced by an empty tmpfs: no ~/.ssh, ~/.aws, browser profiles, shell history Reads under $HOME denied except the project and shares
Writes Only the current folder (and --share-rw); /tmp is private Only the current folder, --share-rw and temp
Your keychain No D-Bus/Secret Service socket, no /run; fresh /proc shows no other processes, so the parent's environment can't be read Keychain services blocked (SecurityServer, securityd)
Other --unshare-all, all capabilities dropped, dies with LLLanyard, --new-session when non-interactive
  • Fails closed. Before each run a throwaway sandbox is started; if it can't start, the tool is not run (no silent fallback). A tool with --sandbox and no --allow-host gets no network.
  • Run it from the project folder: only the current directory is writable, and running from your home directory is refused. Credential folders (~/.ssh, ~/.aws, ~/.gnupg, ...) cannot be shared even with --share-ro/--share-rw.
  • Linux needs sudo apt install bubblewrap. Ubuntu 24.04+ restricts unprivileged user namespaces; doctor explains the fix.
  • Windows: no sandbox. Use WSL2 (Debian/Ubuntu) to get the Linux one.
  • Beta. The sandbox is tested in CI on Linux and macOS, but it is the newest part of LLLanyard. Run lllanyard doctor first.

Honest limits:

  • Without --sandbox, the egress allowlist is best-effort. It constrains tools that honour proxy settings (most HTTP clients; recent Node via NODE_USE_ENV_PROXY, which may print an "experimental" notice). Tools launched with npx also need registry.npmjs.org allowed; pre-installing the package is better.
  • A sandboxed tool still holds its own key and can send it to any allowlisted host, so allow only hosts you trust.
  • The key is still in the tool's memory and environment; unsandboxed, it is readable by your OS user (/proc/<pid>/environ, Task Manager).
  • Scrubbing covers UTF-8 text. Binary output, or a tool that splits or otherwise encodes the key (encryption, custom alphabets), gets through. --no-scrub exists for binary tools.
  • If LLLanyard itself is force-killed (SIGKILL), the tool can be orphaned; a normal exit or Ctrl+C stops it.

Use run for tools you trust, and give each tool the narrowest key you can (a read-only GitHub token, not your admin one).

Env: LLLANYARD_PORT, LLLANYARD_RPM (requests/min per agent, default 120), LLLANYARD_ALLOW_ORIGIN=1 (allow Electron-style requests that carry an Origin header).

SSH logins

LLLanyard can hold the SSH keys and passwords you use to reach servers, so they don't sit in ~/.ssh, in shell history, or anywhere an AI agent can read them. You connect with lllanyard ssh <name> instead of ssh user@host.

Quick start

# 1. Store a login (pick one)
lllanyard ssh add prod --host deploy@prod.example.com          # paste your existing private key (nothing is shown)
lllanyard ssh add nas --host admin@192.168.1.5 --password      # or store a password
lllanyard ssh generate web --host root@web1.example.com        # or make a brand-new key; prints the public half

# 2. If you generated a key, add its public half to the server's ~/.ssh/authorized_keys
lllanyard ssh pubkey web

# 3. Use it
lllanyard ssh prod                       # interactive session
lllanyard ssh prod -- uptime             # run one command and exit
lllanyard ssh with prod -- scp ./app.tar.gz deploy@prod.example.com:/srv/     # scp, rsync, git or any script

--host is [user@]host; add --port N if the server isn't on 22. An encrypted key asks for its passphrase once, when you add it. add --key-file leaves your original key file alone: delete it yourself once you've checked the login works.

How it works

A stored login is one record in your OS keychain: the host, user, port, and the private key (and passphrase) or password. When you connect, LLLanyard builds a short-lived session around it:

lllanyard ssh prod
  1. read the login from the keychain
  2. start a private ssh-agent (a socket only your user can reach) in a temporary folder
  3. load the key into the agent over stdin, so it is never written to a file
  4. run ssh, pointed at that agent
  5. when ssh exits: stop the agent, delete the temporary folder

So the key exists only inside the agent, only while you're connected. Nothing is left in ~/.ssh, and other programs on your machine have no agent to ask.

Login type What happens
Key (macOS, Linux) Loaded into a throwaway ssh-agent for the session, as above.
Key (Windows) Windows has no agent socket, so the key is written to a private (owner-only) temporary file for the session and deleted afterwards.
Password Handed to ssh through its askpass helper, never on the command line.
Passphrase Same askpass route, used only to unlock the key into the agent.

ssh with <name> -- <command> builds the same session but runs your command in it instead of ssh, so tools that talk SSH themselves (scp, rsync, git push, your own scripts) pick up the login automatically. Use several logins with ssh with prod,staging -- …. Limits: one password login per session, and you can't mix a password login with key logins; on Windows, one key login at a time.

Host keys. The first time you connect to a server, its host key is remembered in ~/.lllanyard/ssh_known_hosts. If it later changes, the connection is refused. LLLanyard uses its own file and leaves your known_hosts alone.

Also good to know. SSH logins are included in backup / restore, appear in usage, and count towards your plan's key limit. Very long keys (RSA 4096 is about 3 KB) are split over several keychain entries, because Windows Credential Manager refuses entries over about 2.5 KB; they are put back together when used and saved whole in backups.

Limiting a login

A login can carry limits, which apply to lllanyard ssh, ssh with and Claude Desktop's ssh_run:

lllanyard ssh add prod --host deploy@prod.example.com --allow "uptime" --allow "df -h" --allow "systemctl status *" --expires 30d
lllanyard ssh policy prod --confirm          # a dialog before every use, even from a terminal
lllanyard ssh policy prod                    # show the limits
lllanyard ssh policy prod --clear            # remove them all
Limit Effect
--allow "cmd" (repeat) Only these commands run. * matches any text without shell operators. A login with an allow-list can't open a shell or be used with scp, rsync or git, and a command containing ; & | ` $ < > ( ) \ or a line break is refused.
--confirm Ask in a dialog before every use, including from a terminal. Closes the gap where an agent runs lllanyard ssh itself. --reason "…" on the command is shown in the dialog.
--expires 30d Refuse after this time (12h, 30d or a date). Renew with ssh policy <name> --expires 30d.

These limit what an AI can ask for through LLLanyard. They are not a replacement for the server's own permissions: a command you allow, such as cat /var/log/*, can still be given arguments you didn't expect. For a real boundary also use a restricted account on the server, or a forced command in its authorized_keys.

Commands

Command What it does
ssh add <name> --host [user@]HOST [--port N] [--key-file F | --password] Store a login.
ssh generate <name> --host [user@]HOST Create a new ed25519 key in the keychain and print its public half. The private half never touches disk.
ssh pubkey <name> Print the public half again, to paste into authorized_keys.
ssh <name> [-- command] Connect, or run one command.
ssh with <name>[,<name>] -- <command…> Run any command with those logins available.
ssh policy <name> [--allow …] [--confirm] [--expires …] [--clear] Show or change a login's limits.
ssh list / ssh remove <name> Show stored logins (never the secrets) and their limits / delete one.

Names are case-insensitive, and can't be one of the command words above (add, generate, list, remove, pubkey, with, connect, help, policy).

Using SSH logins with an AI

  • Claude Code, OpenAI Codex, GitHub Copilot and other agents run lllanyard ssh … like any other command, using the instructions setup adds to their instructions file (see other AI tools). They can use the login, but never see the key or password. By default nothing prompts you when they do; to be asked every time, or to restrict what they can run, give the login limits (--confirm, --allow).

  • Claude Desktop, with lllanyard mcp --run (what setup claude-desktop installs), gets two tools:

    • list_ssh returns login names and servers only.
    • ssh_run runs one command on a stored login, but only after you click Run in a dialog that shows the login and the exact command, with Claude's explanation of it, every time.

    The command runs with no terminal and no input, a 10-minute limit, and a 1,500-character cap. The output has your secrets redacted, and every request is logged (lllanyard usage).

Be aware that once you click Run, the command runs with your login's full permissions on that server. Read the command in the dialog before approving, and where you can, store a login for a restricted account rather than root.

In the app

The SSH tab adds a login (paste the key or type a password), makes a new key and shows its public half to copy, and removes logins.

Security model

Protects against: keys sitting in .env/config files an agent can read; keys leaking into prompts, logs, screenshots or git; prompt-injected agents echoing their "key" (it is only a placeholder); runaway request loops (rate limit + kill switch).

Does NOT protect against: malicious code running as your OS user. A fully compromised agent that can run shell commands can ask the OS keychain for the key directly (macOS prompts; Windows and Linux generally do not). For untrusted agents, run the proxy under a separate OS user or on another machine (see Sharing with a team).

Built-in hardening:

  • Zero runtime dependencies in the proxy (Node built-ins only); the only native dependency is @napi-rs/keyring.
  • Binds to 127.0.0.1 only; rejects non-loopback Host headers (DNS rebinding) and browser Origin requests.
  • Agent tokens are 256-bit, stored only as SHA-256 hashes, compared in constant time.
  • Upstream host is fixed per provider; request paths can't change it; redirects are never followed.
  • Cookies are stripped both ways; logs contain agent/provider/status only (no keys, bodies or query strings).
  • No command ever prints a stored key. scan masks keys, and findings hold plaintext in a private field that is excluded from JSON/inspect output. --redact edits atomically and writes no backup (a backup is another plaintext copy).
  • Keys given on the command line are refused by default (--allow-argv overrides).
  • Custom providers must use https and a public hostname (no IPs, no credentials in the URL). The proxy also refuses to connect to private, loopback, link-local (cloud metadata) or CGNAT addresses, including hostnames that resolve to them, unless a provider was explicitly created with --allow-local for a loopback server.
  • Built-in provider names can't be redefined; names like constructor are never treated as providers.
  • Agents created with --providers get a 403 for anything else.
  • run: keys go only into the child's environment (never the parent's), blocked variables (LD_*, DYLD_*, PATH, NODE_OPTIONS...) are refused, and on Windows .cmd shims (npx) run through a shell only if every argument is plain.
  • Limits: JavaScript cannot wipe strings from memory; the proxy caches a key for 30 s. Revoking an agent takes ≤10 s to apply.

Keys that sat in plaintext should be treated as exposed: after scan --import, create new keys at the provider and run rotate.

Platform notes

  • macOS / Windows: work out of the box (Keychain / Credential Manager).
  • Debian/Ubuntu: needs a Secret Service: sudo apt install gnome-keyring libsecret-1-0, inside a desktop/D-Bus session. Headless servers are not supported yet.

Tiers

An agent is one AI tool or app you link in (Claude Code, Cursor, an SDK script). Each gets its own agent token.

Keys Agent tokens Where it runs
Free 10 5 This computer only
Pro 250 10 per user Shared with up to 3 of one person's own devices (laptop, desktop, home server)
Team 500 Unlimited Shared on your network with the other members of your team

Pro and Team also add the usage dashboard. See pricing. Lowering a limit never stops tokens you already have.

Everything runs on your own computers. Keys never go to us or to any cloud service, and there's no account or telemetry. When the proxy is shared, one of your machines holds the keys and the other devices' tools connect to it over your network or VPN.

Desktop app and rotation assistant

lllanyard ui opens a private local page in your browser (apps/desktop wraps the same page in a native Tauri window): keys with rotation badges, add/replace/remove (keys are write-only: only the last 4 characters are ever shown), agent tokens, usage, proxy start/stop, license, and the rotation assistant.

  • The assistant gets metadata only (provider, label, age, due date, request counts), never a key, and only talks to a model on this computer (Ollama at 127.0.0.1:11434 by default, or an OpenAI-compatible local server such as LM Studio or llama.cpp). A non-localhost endpoint is refused. With no model running, "Quick review" still gives a rule-based plan.
  • The UI server listens on loopback only and needs a random per-run session secret (in the link's # fragment, removed from the address bar on load) on every API call. It also checks the Host header (DNS rebinding), refuses foreign Origins and cross-site fetches, requires JSON for writes, caps request size, and serves a strict Content-Security-Policy with a per-run nonce. All text is inserted with textContent, never as HTML.
  • Honest limits: any program running as your user could still read the session secret from the process list or the printed link, as it could read your keychain; this protects against web pages and other websites, not against local malware.

MCP server for agents

lllanyard mcp is a read-only MCP server over stdio. Add it to Claude Code, Cursor, etc.:

{ "mcpServers": { "lllanyard": { "command": "lllanyard", "args": ["mcp"] } } }

Tools: list_providers, key_status (age and rotation due dates), usage_summary, how_to_connect. It can answer "is my OpenAI key due for rotation?" or "what is the base URL for GitHub?" and cannot return a key, a token or any hint of one (not even the last 4 characters), nor change anything. --client acme limits it to one client's keys. With the file vault the passphrase must come from LLLANYARD_VAULT_PASSPHRASE_FILE (no prompt is possible on stdio). Note that anything an agent can run as your user can also run lllanyard directly; the MCP server is a safe information channel, not an access boundary.

Sharing across your devices (Pro) or with your team (Team)

One computer (a small server, or an always-on workstation) holds the real keys and shares its proxy:

lllanyard serve --host 0.0.0.0 --port 3443 --tls-cert cert.pem --tls-key key.pem --allow-host keys.example.com

Pro: your own devices, up to 3. Pair each device once. Install LLLanyard on it (it stores no keys there), then:

lllanyard device add work-laptop                         # on the main computer: a one-time code, valid 10 minutes
lllanyard device join https://keys.example.com:3443      # on the laptop: asks for the code (--ca ca.pem for a private CA)

On the paired device:

lllanyard exec --remote pwsh -File ./Deploy-App.ps1      # run a script or tool with your keys from the main computer
lllanyard relay                                          # a fixed local address for apps such as an editor or Claude Desktop

exec --remote works like exec: it reads the script for the variable names of your keys (or takes --keys github), then asks the main computer for just those keys. They go into that one command's environment, in memory, with any that appear in its output redacted, and are gone when it ends: nothing is saved or cached on the device, so the next run asks again. The main computer logs each one (device-keys: which device, which keys, which command). As with exec, a script that copies a key somewhere itself can't be stopped.

A device paired with lllanyard device add tablet --no-keys never receives a key. Its tools go through the main computer's proxy instead, using SDK base URLs (ANTHROPIC_BASE_URL, OPENAI_BASE_URL) and LLLANYARD_<PROVIDER>_URL (for example LLLANYARD_GITHUB_URL). lllanyard relay always works this way, for long-running apps.

Each device's token works only on the computer it was paired on: LLLanyard on the device sends a hash of its machine ID (the hardware UUID on a Mac, the MachineGuid on Windows, /etc/machine-id on Linux) with each request, and a copied token is refused on any other computer. lllanyard device list shows them; lllanyard device remove work-laptop frees a place. On Pro, agent tokens work on the main computer only. The machine ID is reported by the device, so this stops a token being passed around, not someone determined to fake it.

Team: your team, no device limit. Each teammate's tool gets its own agent token, and points at https://keys.example.com:3443/openai/v1 with that token as the API key:

lllanyard agent create alice-laptop --client acme --providers openai --expires 90d

Devices and teammates can use a key but never read it. Revoking a token or removing a device cuts it off within ~10 seconds.

Safeguard
TLS required Non-loopback binds refuse to start without --tls-cert/--tls-key (TLS 1.2+); the key file must be chmod 600
Host allowlist Only the names given with --allow-host (plus loopback) are accepted: DNS-rebinding protection stays on
Brute-force lockout 10 bad tokens in 10 minutes locks that address out for 15 minutes, even for a valid token
Per-person scope Each token is limited to a client (--client), optionally to providers, and can expire (--expires)
Audit trail Every request is logged with agent name and caller address; lllanyard usage breaks it down by agent and client
Rate limits + kill switch Per token, as before
Limits Agent tokens: Free 5, Pro 10 per user, Team unlimited. Paired devices: Pro 3, Team unlimited

Put it behind a VPN (Tailscale, WireGuard) or a firewall if you can; the lockout and TLS are a second layer, not a reason to expose it to the whole internet. X-Forwarded-For is deliberately ignored, so a reverse proxy in front shows as one address.

Personal keys alongside the team's (Team)

Team members can keep their own keys as well as using the team's. Each member runs their own LLLanyard, which holds their personal keys, and links it to the team server with their own token from the team admin:

lllanyard team join https://keys.example.com:3443        # prompts for your team token (or --stdin); --ca ca.pem for a private CA
lllanyard team status                                    # checks the link and lists which keys are personal
your laptop ─┐
your desktop ┼─► your LLLanyard (your keys) ──► team server (the team's keys)
your server ─┘     on one of your machines        on your network

Your tools point at your own LLLanyard as usual. A request for a key you hold uses yours, and never reaches the team server. A request for anything else goes on to the team server, which adds the team's key. The team server sees your team token, not your devices' tokens, so its usage log and revocation work per member. Your devices' own token limits (--providers) apply first. Your personal keys never leave your machine, and the team's keys never come to it. Sharing your LLLanyard between your own devices works as on Pro (lllanyard serve and lllanyard device add). lllanyard team leave removes the link. The link is only used while a Team license is active, and the team server must be LLLanyard 0.1.4 or later.

Headless servers and containers: the encrypted file vault. The OS keychain needs a desktop login, so on a server use LLLANYARD_BACKEND=file. Everything (keys, agents, tools, license) then lives in one encrypted file, ~/.lllanyard/vault.enc (override with LLLANYARD_VAULT_PATH): AES-256-GCM, key from your passphrase via scrypt, atomic writes, safe with several processes. Wrong passphrases and edited files are detected.

echo 'a long random passphrase' > /etc/lllanyard/pass && chmod 600 /etc/lllanyard/pass
export LLLANYARD_BACKEND=file LLLANYARD_VAULT_PASSPHRASE_FILE=/etc/lllanyard/pass
lllanyard add openai --stdin < key.txt && lllanyard serve --host 0.0.0.0 ...

On a terminal with no passphrase file you are prompted instead (hidden). Under systemd use LoadCredential= and point LLLANYARD_VAULT_PASSPHRASE_FILE at $CREDENTIALS_DIRECTORY/pass. Honest limit: it protects the vault at rest (backups, disk images, other users); someone who can read both the vault and the passphrase file as your user can open it. The passphrase can't be changed once the vault is created.

Usage and dashboard

The proxy keeps a metadata-only request log (~/.lllanyard/usage.jsonl, owner-only, rotates at 10 MB; no keys, bodies or query strings). Blocked egress attempts from sandboxed tools are added too.

lllanyard usage --since 7d      # free: requests, errors, 429s, kill-switch trips, p50/p95 by provider/agent/client
lllanyard dashboard             # Pro: self-contained HTML page (no scripts, no network requests)

Licenses

Buy Pro or Team at lllanyard.app. Paid tiers are unlocked by a signed license key that is verified offline (Ed25519):

lllanyard license activate lly1.…     # or --key lly1.…, or --stdin
lllanyard license status
lllanyard license refresh             # fetch the renewed key after your subscription renews

The only time LLLanyard contacts anything of ours: in the last 7 days before a paid license runs out, start and ui send that license (nothing else) to lllanyard.app to fetch its renewed key. Set LLLANYARD_NO_LICENSE_REFRESH=1 to turn this off; each renewed key is also emailed.

Pro lifts the key cap to 250, Team to 500 (TIER_LIMITS in packages/core/src/license.ts). An expired license drops back to free: existing keys keep working, you just can't add past the free cap.

Honest limit: a local check can be patched in private. The license (see License) forbids it and makes such use unlicensed.

License

LLLanyard is source-available under the Business Source License 1.1 (LICENSE.md), licensor Ethan Askew T/A LLLanyard. In plain words (the license text is what counts):

  • You can read, copy, modify and evaluate or develop with it freely.
  • Production use is free within the free tier (10 keys and 5 agent tokens, on one computer). Beyond that you need a paid license key from Ethan Askew T/A LLLanyard.
  • You may not remove, bypass or tamper with the license-key checks or usage limits, or help others do so. Doing it makes your use unlicensed, and the license terminates.
  • You may not resell it as a hosted/embedded competing product.
  • Each version converts to Apache 2.0 four years after its release.

Licensing questions: sales@lllanyard.co.uk.

Verifying on your machine

node tools/smoke.mjs (add --keychain to also test your real OS keychain once) runs the real CLI, proxy, UI and MCP server against a throwaway vault and prints PASS/FAIL plus a one-line report for bug reports.

Tests

npm test runs the suite (tsx + node:test): storage, tokens, scanner and redaction, rotation, provider and tool validation, the output scrubber, the run engine with real child processes, the egress proxy, the sandbox, and proxy integration tests against a fake upstream. CI (.github/workflows/ci.yml) runs it on Linux, macOS and Windows with Node 22 and 24, with a full type-check and npm audit.

About

Keep API keys out of AI agents: keys live in your OS keychain, agents only see placeholder tokens.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages