> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opsh.dxu.one/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure opsh

> Complete reference for every setting in ~/.opsh/config.json — shell preference, execution behavior, history limits, and AI provider options.

Opsh stores all its settings in a single JSON file at `~/.opsh/config.json`. You can edit this file directly in any text editor, or use the built-in interactive editor so you never have to write JSON by hand. This page documents every field in the config file and explains what each one does.

## Opening the config editor

Two commands open the interactive config editor:

* **On first run or to reset settings:** `opsh --init` in your terminal.
* **From inside the Opsh REPL:** type `!config` at the prompt.

Both commands walk you through the same menu-driven editor. Changes are saved to `~/.opsh/config.json` when you select **Done**.

## Config file location

```text theme={null}
~/.opsh/config.json
```

Opsh creates this file automatically the first time it runs, populated with default values. If the file is missing, Opsh recreates it with defaults.

<Note>
  `config.json` is plain JSON. You can open and edit it with any text editor. Opsh reads it fresh on every invocation, so changes take effect immediately without restarting.
</Note>

## Full config file structure

The example below shows every field with its default value.

```json config.json theme={null}
{
  "version": 1,
  "shell": "zsh",
  "printOnly": false,
  "warpMode": false,
  "confirmByDefault": true,
  "historyLimit": 100,
  "recentContextLimit": 8,
  "provider": {
    "selected": "openai",
    "openrouter": {
      "model": "openrouter/auto",
      "baseUrl": "https://openrouter.ai/api/v1",
      "apiKey": "",
      "temperature": 0.1
    },
    "openai": {
      "model": "gpt-5.1",
      "baseUrl": "https://api.openai.com/v1",
      "apiKey": "",
      "temperature": 0.1
    },
    "anthropic": {
      "model": "claude-sonnet-4-20250514",
      "baseUrl": "https://api.anthropic.com/v1",
      "apiKey": "",
      "temperature": 0.1,
      "apiVersion": "2023-06-01",
      "maxTokens": 1200
    },
    "gemini": {
      "model": "gemini-2.5-flash",
      "baseUrl": "https://generativelanguage.googleapis.com/v1beta",
      "apiKey": "",
      "temperature": 0.1
    },
    "ollama": {
      "model": "qwen3-coder",
      "baseUrl": "http://localhost:11434/api",
      "temperature": 0.1
    }
  }
}
```

## Field reference

<ParamField path="version" default="1" type="number" required>
  Config file format version. Always `1`. Do not change this value.
</ParamField>

<ParamField path="shell" type="string">
  The shell Opsh uses when running generated commands. Accepted values: `"bash"` or `"zsh"`. If omitted or set to `null`, Opsh auto-detects your shell from the `SHELL` environment variable.
</ParamField>

<ParamField path="printOnly" default="false" type="boolean">
  When `true`, Opsh prints the generated command to stdout without executing it or asking for confirmation. Useful for previewing commands in scripts or pipelines.
</ParamField>

<ParamField path="warpMode" default="false" type="boolean">
  When `true`, Opsh automatically runs commands it classifies as safe and summarizes the output in plain English. Enabling warp mode sets `confirmByDefault` to `false`. See the [Warp Mode guide](/usage/warp-mode) for details.
</ParamField>

<ParamField path="confirmByDefault" default="true" type="boolean">
  When `true`, Opsh always asks for your confirmation before executing any command. Set to `false` to skip confirmation for safe commands. This setting is overridden and disabled when `warpMode` is `true`.
</ParamField>

<ParamField path="historyLimit" default="100" type="number">
  Maximum number of entries Opsh stores in its own command history. Older entries are dropped when the limit is reached.
</ParamField>

<ParamField path="recentContextLimit" default="8" type="number">
  Number of recent shell commands sent to the AI as context with each request. Higher values give the AI more context about what you've been doing, but slightly increase token usage.
</ParamField>

<ParamField path="provider" type="object" required>
  AI provider configuration. Controls which provider is active and holds per-provider settings including model, API key, and base URL. See the [Provider setup page](/configuration/providers) for full details.
</ParamField>
