# 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 and saves nothing. In the terminal interface,
Alt+P or `/model` opens the picker, `/model NAME` switches, and Ctrl+P cycles models; whichever you
choose, the next new conversation, `pic ask` and `pic -p` start on it, and the first line says so
(`your last choice`). pic says this once, not at every Ctrl+P step. Resuming a conversation keeps
that conversation's own model. A model changed by a client of `pic --mode rpc`, or from a phone
through `pic remote`, saves nothing. To keep a fixed default instead, set `rememberModel` to false
and save the default yourself with `pic models --default NAME`, or with Ctrl+S in the picker (which
with `rememberModel` on only says it is already saved). `pic models` lists the models whose
provider has a key, `--all` every one, and `--refresh` fetches Pi's catalog now;
`/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 or last choice 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. 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.
