---
name: envlatch
description: Get API keys for this machine from the owner's EnvLatch app (scan a QR). Use when a task needs an API key (OpenAI, Anthropic, Gemini, Stripe, GitHub, Resend, or a custom API) and none is set, or when a call fails with an "EnvLatch:" error.
---
# EnvLatch

The owner keeps real API keys in the EnvLatch app. You get **proxy keys** (`el_…`) that only work through EnvLatch and can be turned off from the owner's phone at any time.

## Get keys

```bash
curl -fsSL https://envlatch.dev/connect.mjs -o /tmp/envlatch-connect.mjs
node /tmp/envlatch-connect.mjs --name "Claude Code"
```

Show the printed QR code and code to the owner and ask them to scan it in the EnvLatch app (DASH → SCAN QR) and pick the keys. When it prints `Connected`, load the keys:

```bash
set -a; . ./.env.envlatch; set +a
```

`.env.envlatch` holds pairs like `OPENAI_API_KEY=el_…` and `OPENAI_BASE_URL=https://envlatch.dev/p/…/v1`. Official SDKs read both variables, so code works unchanged. Use `--print` to get `export` lines instead of a file.

## Rules

- Use the base URL that comes with each key; the proxy key does nothing anywhere else.
- Never ask the owner for real keys and never put proxy keys in code, commits, logs or prompts. `.env.envlatch` is added to `.gitignore` automatically.
- Errors starting with `EnvLatch:` are the owner's controls: key turned off, all access frozen, rate limit, monthly cap, or waiting for approval. Tell the owner what you were doing and stop; do not retry in a loop or look for other keys.
- If a key was revoked, run the connect step again and let the owner decide.
