> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://pushai.vercel.app/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Configuration \[Where PushAI stores your setup]

PushAI keeps everything in one directory under your home folder:

```text
~/.config/pushai/
├── config.json                 # providers + active provider (no secrets)
├── key-<provider-id>.json      # fallback API key files, keychain only
└── .update-check.json          # 24h cache for the update notice
```

Everything is plain JSON. There is no project-level config file, nothing in
your repository, and nothing to commit.

## `config.json`

The full shape:

```json
{
  "activeId": "anthropic",
  "providers": [
    {
      "id": "anthropic",
      "mode": "byok",
      "provider": "anthropic",
      "model": "claude-sonnet-4-5"
    },
    {
      "id": "gemini",
      "mode": "byok",
      "provider": "gemini",
      "model": "gemini-2.5-flash"
    },
    {
      "id": "local",
      "mode": "local",
      "model": "llama3.2"
    }
  ]
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `activeId` | `string` | The `id` of the provider the next `pai commit` uses. |
| `providers` | `ProviderConfig[]` | Every provider you have saved, in the order they were added. |

Reading rules worth knowing:

* A BYOK entry whose key can no longer be found (keychain wiped, fallback file
  deleted) is **skipped** rather than crashing — the rest keep working. If
  every key is gone, PushAI treats the config as missing and offers `pai setup`
  again.
* If `activeId` points at a provider that no longer exists, the first remaining
  provider becomes active.

:::warning
`config.json` **never contains API keys**. BYOK entries are written with the
`apiKey` field stripped, every single time the file is saved. If you ever see a
key in there, something outside PushAI wrote it — delete the field and re-run
`pai setup`.
:::

## The `ProviderConfig` union

`ProviderConfig` is a discriminated union on `mode`. The three variants and
their exact fields:

### `LocalProviderConfig`

```ts
interface LocalProviderConfig {
  id: "local";
  mode: "local";
  model: string;
}
```

| Field | Persisted? | Notes |
| --- | --- | --- |
| `id` | yes | Always the literal `"local"`. |
| `mode` | yes | Always `"local"`. |
| `model` | yes | The Ollama model tag, for example `llama3.2`. |

No secret of any kind — Ollama needs no credentials.

### `ByokProviderConfig`

```ts
interface ByokProviderConfig {
  id: string;        // provider id, e.g. "openai"
  mode: "byok";
  provider: string;  // which service, e.g. "openai"
  apiKey: string;
  model: string;
}
```

| Field | Persisted? | Notes |
| --- | --- | --- |
| `id` | yes | Same value as `provider`. Used as the keychain account suffix. |
| `mode` | yes | Always `"byok"`. |
| `provider` | yes | One of `gemini`, `anthropic`, `openai`, `huggingface`. |
| `model` | yes | The model id you selected during setup. |
| `apiKey` | **no — stripped** | Present only in memory. On save it goes to the keychain (or the fallback file) and is removed from the JSON before `config.json` is written. On load it is read back in from wherever it was stored. |

This is why `config.json` on disk looks like
`Omit<ByokProviderConfig, "apiKey">` — the in-memory type has the key, the
persisted type does not.

### `CloudProviderConfig`

```ts
interface CloudProviderConfig {
  id: "cloud";
  mode: "cloud";
  model: string;
}
```

| Field | Persisted? | Notes |
| --- | --- | --- |
| `id` | yes | Always `"cloud"`. |
| `mode` | yes | Always `"cloud"`. |
| `model` | yes | Reserved for the managed model. |

Cloud mode is [not available yet](/providers/cloud) — this variant exists in
the type system so config files written by a future version stay readable.

### `SetupConfig`

```ts
interface SetupConfig {
  activeId: string;
  providers: ProviderConfig[];
}
```

That is the entire top-level document. What `pai peak` prints is this object
rendered as a tree; what `pai switch` edits is `activeId`.

## API key storage

### Preferred: the OS keychain

PushAI uses [`@napi-rs/keyring`](https://github.com/napi-rs/keyring) with a
per-OS backend:

| OS | Backend |
| --- | --- |
| macOS | Keychain |
| Linux | Secret Service (via D-Bus) |
| Windows | Credential Manager |

Entries are stored with:

* **Service:** `pushai`
* **Account:** `api-key-<provider-id>` (for example `api-key-anthropic`)

PushAI probes the keychain once per run with a throwaway entry. If the probe
succeeds, every read, write, and delete goes to the keychain.

### Fallback: a locked file

When the probe fails — headless containers, minimal Linux installs without a
Secret Service, locked-down CI — PushAI warns you once:

```text
⚠️ System keychain unavailable. API keys will be stored in a local fallback file.
```

and writes one file per provider:

```text
~/.config/pushai/key-anthropic.json
```

```json
{
  "apiKey": "sk-ant-..."
}
```

The file is created with `0600` permissions on macOS and Linux (owner read and
write only; Windows relies on the user profile ACLs instead). The same file is
also deleted when you remove that provider, so the fallback never outlives its
key.

:::info
Whether keys live in the keychain or the fallback file, `config.json` stays
clean. Both stores are read transparently when PushAI loads your configuration.
:::

## Managing your configuration

| Goal | Command |
| --- | --- |
| Create or change your setup | [`pai setup`](/introduction/setup-wizard) |
| See what is configured | [`pai peak`](/commands/peak) (`-k` to reveal keys) |
| Change the active provider | [`pai switch`](/commands/switch) |
| Remove one or all providers (and their keys) | [`pai reset`](/commands/reset) |
| Read the files yourself | `cat ~/.config/pushai/config.json` |

Editing `config.json` by hand is safe as long as you keep the shape above: no
`apiKey` fields, a valid `mode` on every provider, and an `activeId` that
matches one of your `providers`. If the file is malformed or empty, PushAI
treats it as "no configuration" and offers to run setup.

## See also

* [CLI reference](/reference/cli) — every command that touches these files.
* [Bring Your Own Key](/providers/byok) — how keys get validated and stored.
