Artifact ef2a2f8397d6fa655a1f9ebac46945263ec30ccc610d0e59504caa0ef8251f03:
- File docs/manual/credentials.md — part of check-in [fcc6715760] at 2026-11-22 13:22:47 on branch oauth-login — Subscription sign-in: OpenRouter, RPC login/logout/get_auth_status, docs, changelog, escape-safe provider errors (user: pi-c-agent, size: 1479) [annotate] [blame] [check-ins using] [more...]
Credentials
API keys come from the environment (ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY,
...), as in Pi, or from pic's credential store.
pic login anthropic # the key, typed with echo off (or piped on stdin), sealed into ~/.pic/pic.sqlite
pic keys # stored keys: names and dates, never values
pic logout anthropic # remove it
The lookup order is a key written in models.json, then the provider's variable, then the store,
then an error naming pic login. /login [PROVIDER] and /logout [PROVIDER] do the same in the
terminal interface. A provider with a subscription sign-in can use that instead of a key: see
subscription sign-in.
The store
Each stored key is sealed with ChaCha20-Poly1305 (the provider's name bound as associated data), so no plaintext key reaches the database, its WAL, a backup or a log. The sealing key comes from a passphrase. pic asks for the passphrase on the terminal the first time a stored key is needed, and keeps the key only for the life of the process; the terminal interface asks once and hands the key to its request processes through an inherited pipe, never argv, the environment's values or a file. The store protects against a stolen disk, backup or database copy; not against a weak passphrase or malware running as you.
How the key is derived and where it is kept is in the architecture notes.