Provider configuration

aic’s Provider panel manages multi-model configurations — switching between different API providers by file copy, without modifying the CLI tools themselves.

Both manual editing and TUI switching are supported. They follow the same file naming conventions. Profiles created manually are picked up by the TUI automatically; files switched by the TUI can also be edited by hand.

1. Config file paths and naming

ToolConfig directoryActive fileProfile namingPaired files?
Claude Code~/.claude/settings.jsonsettings.json.{Name}No
Codex~/.codex/config.toml + .envconfig.toml.{Name} + .env.{Name}Yes, both must exist
Gemini CLI~/.gemini/settings.json + .envsettings.json.{Name} + .env.{Name}Yes, both must exist
OpenCode~/.config/opencode/opencode.json or .jsoncopencode.json.{Name} or .jsonc.{Name}No

OpenCode path resolution: if OPENCODE_CONFIG_DIR is set, use that; else if XDG_CONFIG_HOME is set, use $XDG_CONFIG_HOME/opencode; else use ~/.config/opencode.

The {Name} identifier

  • Custom, recommended to use English without spaces (e.g. Ops46, DeepSeek, Local)
  • For Codex / Gemini, the config.toml.{Name} and .env.{Name} suffixes must match

2. Adding a Provider manually

Claude Code example:

# Copy the current config as a template
cp ~/.claude/settings.json ~/.claude/settings.json.MyProvider

# Edit the new config
vim ~/.claude/settings.json.MyProvider

Codex / Gemini require copying both the config file and the env file:

cp ~/.codex/config.toml ~/.codex/config.toml.MyProvider
cp ~/.codex/.env ~/.codex/.env.MyProvider

After creating the files, re-enter the aic TUI — the Provider panel will list the new entry automatically.

3. Switching via the TUI

In the Provider panel (see Shortcuts and commands):

  1. / to switch tool sub-tabs (Claude / Codex / Gemini / OpenCode)
  2. / to select the target Provider
  3. enter or s to confirm the switch
  4. e to edit the current profile, o for read-only view, c to copy as a new profile

Switch logic: back up the active file → copy the target profile to the active position → record in ~/.aic/config.toml. Restart the corresponding CLI tool for the switch to take effect.

4. Required fields per tool

Claude Code (settings.json.{Name})

{
  "model": "claude-sonnet-4-5-20250514",
  "env": {
    "ANTHROPIC_BASE_URL": "https://your-api-host/v1"
  }
}

Codex (config.toml.{Name})

model_provider = "your_provider"
model = "your-model-name"

[model_providers.your_provider]
name = "your_provider"
base_url = "https://your-api-host/codex"
wire_api = "responses"
env_key = "OPENAI_API_KEY"

.env.{Name} content:

OPENAI_API_KEY=your_key

Gemini CLI (settings.json.{Name})

{
  "baseUrl": "https://your-api-host/gemini"
}

.env.{Name} content:

GEMINI_API_KEY=your_key

OpenCode (opencode.json.{Name})

{
  "model": "openai/gpt-5.3",
  "provider": {
    "openai": {
      "options": {
        "baseURL": "https://your-api-host/v1"
      }
    }
  }
}

aic never reads or displays the API Key values in .env files — they are only copied as whole files during switches.

5. Automatic demo config seeding

To lower the barrier to entry, aic checks each tool’s config directory when you first enter the TUI: if a tool is installed (config directory exists) but has no provider profiles yet, aic copies a demo config template from the Registry cache into that directory.

Seeding conditions (all must be true):

  1. Registry cache is non-empty
  2. providers/<tool>/ template directory exists in cache
  3. The tool’s config directory exists on disk
  4. No settings.json.* / config.toml.* / opencode.json.* profile files exist in that directory

This is a one-time aid: once you create or add any profile (manually or via TUI), seeding will not run again. It is best-effort — missing templates or errors do not affect normal TUI usage.

6. Active state recorded by aic

aic records the currently active Provider for each tool in ~/.aic/config.toml:

active_provider = "Ops46"               # Claude Code
active_codex_provider = "AiCodeMirror"  # Codex
active_gemini_provider = "AiCodeMirror" # Gemini CLI
active_opencode_provider = "AiCodeMirror" # OpenCode

These fields are empty before the first switch and are written automatically after switching.