Artifact c5c3070fef53165144b85cba4c3110cbe8fa07528026f78b636597d9c61193b6:
- File
docs/manual/models.md
— part of check-in
[c8bc1bfa6d]
at
2026-11-23 11:40:21
on branch ux-models
— Model choice says why and recovers from a refused key
With no saved default, pic starts on a provider whose key worked and passes over one that was refused, out of credit or limited; OpenRouter, Moonshot and DeepSeek start on inexpensive general models. The first screen (and stderr for ask and -p) names the model and why; with no key it says how to get one. The picker shows prices and key marks, lists keyless models once typed, ranks exact and prefix matches first, says what it saved and when the thinking level changes. After a refused key, Alt+P picks another model and the message returns to the editor for it. pic sessions shows each conversation's model and marks failed ones; pic models --json carries key; pic --version; pic help start opens with the user path. (user: dmestas, size: 3257) [annotate] [blame] [check-ins using] [more...]
# Models pic talks to Anthropic, OpenAI (Chat Completions and Responses), OpenRouter, Google and any OpenAI-compatible server, with Pi's thinking levels. One conversation can move between providers. ## Providers Built in, by the name `--model` takes before the slash: `anthropic`, `openai`, `openrouter`, `google` (Gemini), `xai`, `groq`, `cerebras`, `deepseek`, `together`, `fireworks`, `huggingface`, `nvidia`, `moonshotai` and `zai`. Each reads its key from its variable ([environment variables](../reference/env.md)) or the credential store; OpenAI and OpenRouter can instead be signed in to with a subscription ([sign-in](sign-in.md)). Other providers go in `models.json`. ## Choosing a model `--model provider/id` picks the model for one command; `pic models --default NAME`, or Ctrl+S in the terminal interface's model picker, saves the default (setting `defaultModel`). `pic models` lists the models whose provider has a key, `--all` every one, and `--refresh` fetches Pi's catalog now. In the terminal interface, Alt+P or `/model` opens the picker and Ctrl+P cycles models; `/scoped-models` (or `pic scoped-models --set PATTERN...`) chooses the models Ctrl+P cycles. With no saved default (or one whose provider has no key), pic starts on a provider's own default model, going down Pi's list of providers: the first whose key worked last time, else the first whose key has not failed, else any with a key. A key that was refused, is out of credit or is rate-limited is passed over. The terminal interface says which model and why on its first screen, `ask` and `-p` on stderr: `model openrouter/deepseek/deepseek-v4.1-flash (OPENROUTER_API_KEY is set; anthropic's key was refused)`. A saved default is always kept; when its key failed last time the line says so. The picker shows each model's price per million tokens, input/output, and marks a provider with no key, a refused key, no credit left, a rate limit or a ChatGPT plan. Models with no key appear once you type, after the ones you can use; exact and prefix matches come first. Choosing one with no key opens its login when you send. Saving a default says so, and if the new model does not offer the thinking level you had, the line names the level it uses instead. `pic models --json` carries the same mark as `key`. ## Thinking `--thinking LEVEL` takes off, minimal, low, medium, high, xhigh or max, as the model supports them. Without it pic uses the level saved for the model (`thinkingLevel:MODEL`), then `defaultThinkingLevel`, else medium. `pic models --thinking-default LEVEL` saves the default; Shift+Tab cycles levels in the terminal interface. ## The catalog and models.json The model list is Pi's catalog: a snapshot built into pic, refreshed from pi.dev when it is newer. `PIC_MODEL_CATALOG=offline` never fetches it. Models and providers of your own go in `~/.pic/models.json` (Pi's `~/.pi/agent/models.json` is read when pic has none), in Pi's format; `PIC_MODELS_FILE` names another file. A key written there comes before the provider's variable and the credential store ([credentials](credentials.md)). ## Prompt caching The `cacheRetention` setting is short (the default), long (1 hour; OpenAI 24 hours) or none, as Pi's; `PI_CACHE_RETENTION=long` works too.