Skip to main content
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

~/.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.
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.

Full config file structure

The example below shows every field with its default value.
config.json
{
  "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

version
number
default:"1"
required
Config file format version. Always 1. Do not change this value.
shell
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.
printOnly
boolean
default:"false"
When true, Opsh prints the generated command to stdout without executing it or asking for confirmation. Useful for previewing commands in scripts or pipelines.
warpMode
boolean
default:"false"
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 for details.
confirmByDefault
boolean
default:"true"
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.
historyLimit
number
default:"100"
Maximum number of entries Opsh stores in its own command history. Older entries are dropped when the limit is reached.
recentContextLimit
number
default:"8"
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.
provider
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 for full details.