> **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.

# Setup Wizard \[Configure `pai setup`]

`pai setup` is the interactive wizard that picks your commit generation method
and saves it. You run it once to get started, and again whenever you want to
add a provider or replace the active one.

```bash
pai setup
```

It takes no flags — every decision is a prompt.

## First run

If no configuration exists yet, PushAI checks for one, reports
`no configuration found`, and drops you straight into the mode picker:

```text
? select a commit generation method:
  local machine (Ollama)
  pushai cloud                     (coming soon)
  custom api key (BYOK)
  ─────────────────────────────────────────────
  leave setup unchanged
```

| Choice | What happens |
| --- | --- |
| `local machine (Ollama)` | Detects Ollama, starts the server if needed, and lets you pick an installed model. |
| `pushai cloud` | Disabled. Managed AI with no API key is planned but not available yet. |
| `custom api key (BYOK)` | Pick a provider, paste a key, validate it live, pick a model. |
| `leave setup unchanged` | Exits with `setup exited. no changes were applied.` |

Whichever path you finish, PushAI writes the provider, marks it active, and
prints `setup wizard completed successfully.`

## BYOK path

Choosing **custom api key (BYOK)** walks you through four steps.

### 1. Pick a provider

```text
? which provider would you like to use?
  Google Gemini
  Anthropic
  OpenAI
  Hugging Face
```

See [Bring Your Own Key](/providers/byok) for what each one is called and which
host it talks to.

### 2. Enter your key

```text
? your Anthropic key: ••••••••••••••••
```

The prompt is masked — the key is never echoed back or printed.

### 3. Live validation

PushAI calls the provider's model-list endpoint with your key **before anything
is saved**:

```text
✔ validated successfully
```

If validation fails, you see the provider's own error message and get asked
`would you like to try another api key?` (default: yes). Declining cancels
setup with `setup cancelled.` — a bad key is never written to disk.

### 4. Pick a model

When the provider returns more than one model you get a searchable list:

```text
? search and select a model
```

Type to filter, then select. If the provider returns exactly one model, PushAI
uses it without asking.

:::info
The saved provider keeps its `provider` id (for example `anthropic`) and the
model you selected. The key itself never lands in `config.json` — see
[Configuration](/reference/config).
:::

## Local (Ollama) path

Choosing **local machine (Ollama)** verifies your machine instead of a remote
service.

### 1. Detection

PushAI runs `ollama -v` to detect the install:

```text
✔ ollama v0.5.7 detected
```

**If Ollama is not installed**, you get `ollama is not installed.` and a choice:

| Option | What it does |
| --- | --- |
| `install ollama on macOS` / `on linux` / `on windows` | Prints the official installer to run yourself — `curl -fsSL https://ollama.com/install.sh \| sh` on macOS and Linux, `irm https://ollama.com/install.ps1 \| iex` on Windows — then tells you to restart your terminal and run `pai setup` again. |
| `open download page` | Opens the [Ollama download page](https://ollama.com/download) in your browser. |
| `exit setup` | Cancels. |

PushAI never runs the installer for you.

### 2. Server startup

It pings the local Ollama server at `http://127.0.0.1:11434`. If the server is
not running, PushAI starts it for you by spawning `ollama serve` detached, then
polls for up to about five seconds until it answers. If it still cannot reach
the server, setup fails with:

```text
Ollama is not running and could not be started automatically.
Start it manually with: ollama serve
```

### 3. Model listing

PushAI lists your installed models with `ollama list`:

```text
✔ you have 4 models installed
```

* **More than one model** → `? which model would you like to use?` with your
  installed models as the choices.
* **Exactly one model** → it is selected automatically:
  `using Ollama's llama3.2 model`.
* **No models installed** → `no local models found`, then a choice:

| Option | What it does |
| --- | --- |
| `browse ollama models` | Opens the [Ollama model library](https://ollama.com/search). |
| `install a model` | Prints `ollama pull <model>` (for example `ollama pull llama3.2`) and tells you to run `pai setup` again. |
| `exit setup` | Cancels. |

The finished provider is stored as `id: "local"`, `mode: "local"`, plus the
model name.

## Where things are stored

| Path | Contents |
| --- | --- |
| `~/.config/pushai/config.json` | The active provider id and every saved provider's mode and model. **No API keys, ever.** |
| `~/.config/pushai/key-<provider-id>.json` | Fallback key file, written only when your OS keychain is unavailable. Locked to `0600`. |
| OS keychain | Where BYOK keys go by default. |

PushAI probes your keychain once. On macOS it uses Keychain, on Linux Secret
Service, on Windows Credential Manager (via `@napi-rs/keyring`). If the probe
fails you will see:

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

and keys are written to the fallback file instead. See
[Configuration](/reference/config) for the exact schema.

## Subsequent runs

Once a configuration exists, `pai setup` no longer starts with the mode picker.
It shows your current providers (the active one marked) and asks:

```text
? what would you like to do?
  add provider          Keep existing setup and configure an additional provider
  replace active        Replace gemini [gemini-2.5-flash] with a new configuration
  ─────────────────────────────────────────────
  leave setup unchanged Exit wizard without adding or updating provider settings
```

* **add provider** runs the normal wizard, then asks
  `set "<provider>" as the active provider?` (default: yes). Answering no keeps
  your current active provider and just stores the new one for later — swap to
  it any time with [`pai switch`](/commands/switch).
* **replace active** runs the wizard and makes the result active. If the new
  provider has a different id (for example swapping `openai` for `gemini`), the
  old entry is dropped so you do not accumulate stale duplicates. Replacing a
  provider with itself overwrites its model or key in place.
* **leave setup unchanged** exits without touching anything.

## Verify your setup

```bash
pai peak
```

```text
╭─▶ configured providers
│
├─▶ anthropic [claude-sonnet-4-5] » active
│     api key configured
╰─▶ local [llama3.2]
      no key required
```

`pai peak -k` reveals the stored keys in plaintext if you need to confirm which
key is saved. Switch providers with [`pai switch`](/commands/switch), remove
one with [`pai reset`](/commands/reset).

:::warning
`--type` and `--scope` are **not** setup options. They belong to
[`pai commit -m`](/commands/commit) and let you skip the interactive
prompts when you supply your own commit message. Running `pai setup --type feat`
does nothing — the wizard accepts no flags.
:::

## Next steps

* Read [`pai commit`](/commands/commit) for the flow that consumes this
  configuration.
* Compare [BYOK](/providers/byok) and [local Ollama](/providers/ollama) before
  you commit to one.
* Keep the [CLI reference](/reference/cli) handy for the other commands.
