# Environment variables
The variables pic reads. Variables that only the test suite sets are listed in `test/pic/docs.allow`
instead.
## API keys
A key written in `models.json` comes first, then the provider's variable, then pic's credential
store (`pic login`). See [credentials](../manual/credentials.md).
| Variable | Provider |
|---|---|
| `ANTHROPIC_API_KEY` | anthropic |
| `OPENAI_API_KEY` | openai |
| `OPENROUTER_API_KEY` | openrouter |
| `XAI_API_KEY` | xai |
| `GROQ_API_KEY` | groq |
| `CEREBRAS_API_KEY` | cerebras |
| `DEEPSEEK_API_KEY` | deepseek |
| `FIREWORKS_API_KEY` | fireworks |
| `GEMINI_API_KEY` | google |
| `HF_TOKEN` | huggingface |
| `MOONSHOT_API_KEY` | moonshotai |
| `NVIDIA_API_KEY` | nvidia |
| `TOGETHER_API_KEY` | together |
| `ZAI_API_KEY` | zai |
## pic
| Variable | Values | What it does |
|---|---|---|
| `PIC_LAPSE` | on, off | lapse compaction, as `--lapse` (setting `lapseCompaction`) |
| `PIC_LAPSE_SECONDS` | seconds | the cache lifetime lapse compaction assumes, as `--lapse-seconds` |
| `PIC_LAPSE_FLOOR` | tokens | the context floor for lapse compaction, as `--lapse-floor` |
| `PIC_TRIAL` | label | a benchmark arm kept on each request, as `--trial` |
| `PIC_MAX_REQUESTS` | N | the request cap, as `--max-requests` |
| `PIC_PI_EXPORT` | 0 | `0` stops `ask`, `chat` and the terminal from writing Pi session lines after each request |
| `PIC_MODELS_FILE` | path | read this file instead of `~/.pic/models.json` (and Pi's `~/.pi/agent/models.json`) |
| `PIC_MODEL_CATALOG` | offline | `offline` never fetches the model catalog; the built-in snapshot is used |
| `PIC_CA` | builtin | `builtin` skips the system certificate bundles and trusts only pic's built-in roots |
| `PIC_NO_NATIVE_CLIPBOARD` | any | the terminal interface does not use the system clipboard tools |
| `PIC_HOOK_OWNER` | id | set by the terminal interface for its request children, so `pic hooks end` ends what it began |
| `PIC_HOOK` | 1 | set by pic in a hook's environment |
| `PI_CACHE_RETENTION` | long | as Pi's: the prompt cache retention when the `cacheRetention` setting is not set |
## System
| Variable | What pic does with it |
|---|---|
| `HOME` | `~/.pic` is under it |
| `TMPDIR` | where the external editor's file and RPC mode's full output of a truncated bash command go |
| `VISUAL` | the external editor (Ctrl+G), before `EDITOR` |
| `EDITOR` | the external editor when `VISUAL` is not set |
| `SSL_CERT_FILE` | an absolute path to a certificate bundle, read before the system bundles |
| `COLORTERM` | truecolor when it says so, otherwise the nearest of 256 colours |
| `COLORFGBG` | the terminal's background, for the `system` and `light/dark` themes |