Skip to content

Repository files navigation

AI Config Manager

PowerShell Platform Issues Stars Last commit

Terminal UI to point your AI coding tools at a custom gateway.

Configures Claude Code, OpenCode, and Codex to use any OpenAI/Anthropic-compatible endpoint — a self-hosted proxy, a model aggregator, or any custom base URL — instead of the default provider. Can also launch Hermes Desktop's model setup.

Model lists are fetched live from the gateway when possible, with curated fallbacks. Every config file is backed up before it's touched.

Quick start

Windows:

irm https://raw.githubusercontent.com/TechTronixx/Custom-modelswitch/main/bootstrap.ps1 | iex

Linux / macOS:

curl -fsSL https://raw.githubusercontent.com/TechTronixx/Custom-modelswitch/main/install.sh | bash

Both download to ~/AI-Config-Manager and launch the menu. Re-run the same line any time to update and start again.

Requirements

  • Windows PowerShell 5.1+ or PowerShell 7+
  • curl.exe on Windows (bundled with Windows 10/11); curl on Linux/macOS
  • The tools you want to configure (Claude Code, OpenCode, Codex, Hermes)

Install (manual)

Clone and run, if you prefer not to use the one-liner above:

git clone https://github.com/TechTronixx/Custom-modelswitch.git
cd Custom-modelswitch
powershell -ExecutionPolicy Bypass -File .\AI-Config-Manager.ps1

No dependencies. AI-Config-Presets.json must stay next to the script.

Usage

Pick an option with the arrow keys, Enter to select, Esc to go back.

Option What it does
Configure Claude Code Writes ~/.claude/settings.json (base URL, token, model)
Configure OpenCode Writes ~/.config/opencode/opencode.json (provider + model)
Configure Codex Writes ~/.codex/auth.json + ~/.codex/config.toml, sets an API-key env var
Configure Hermes Desktop Launches hermes model for you to complete manually
Configure Claude Desktop Writes the 3P gateway config (configLibrary entry) for the Claude Desktop app
Configure Both Claude Code + OpenCode in one pass
Restore last backup Restores the most recent backup of the selected tool's config
View current configuration Shows what each tool is currently pointed at

Pick a gateway from the list, or choose Custom base URL to enter one at runtime. Then enter your API key and pick a model.

Screenshots

Main menu

Select gateway

Updates

On startup the script checks the latest GitHub release and shows a notice in the menu header when a newer version exists. The check is offline-safe and fails silently. Skip it with -SkipVersionCheck:

powershell -ExecutionPolicy Bypass -File .\AI-Config-Manager.ps1 -SkipVersionCheck

To update, re-run the same quick-start line (installer) or git pull and re-run.

Gateways

The gateway list comes from AI-Config-Presets.json. Ships with AgentRouter, EuroModels, and OpenRouter. Add your own by copying a block — no code changes. Each preset defines, per tool, a base URL, provider labels, and a curated model fallback list.

{
  "presets": [
    {
      "id": "mygateway",
      "label": "My Gateway",
      "dashboard": "https://example.com/keys",
      "fetchModels": true,
      "modelsApiUrl": null,
      "claude":   { "baseUrl": "https://example.com", "curatedModels": ["claude-opus-4-8"] },
      "opencode": { "baseUrl": "https://example.com/v1", "providerKey": "mygateway", "providerName": "My Gateway", "npmPackage": "@ai-sdk/openai-compatible", "curatedModels": ["gpt-5.5"] },
      "codex":    { "baseUrl": "https://example.com" }
    }
  ]
}

Field notes:

  • dashboard — signup/key page shown at the API-key prompt (null to omit).
  • fetchModels — try a live model list before falling back to curatedModels.
  • modelsApiUrl — optional public model-list endpoint; if set, it's used instead of the standard /v1/models call.
  • Base URLs can differ per tool — set each to whatever your gateway expects.

Notes

  • Backups: each write leaves a *.backup-<timestamp> copy next to the original.
  • Restore: the "Restore last backup" menu option re-applies the newest backup for the chosen tool (backing up the current state first).
  • Codex sets an environment variable. Configuring Codex writes a persistent environment variable (e.g. MYGATEWAY_API_KEY) holding your API key, because Codex resolves its provider key from the real process environment. On Windows it's set as a User env var; on Linux/macOS it's appended to your shell rc (~/.bashrc, ~/.zshrc, or ~/.profile). Fully restart the Codex app (and, on Linux/macOS, restart your shell) afterward for it to take effect.
  • Claude Desktop uses a 3P gateway config. The Claude Desktop Electron app stores its gateway settings in a managed config file inside its configLibrary. The script finds the active entry (via _meta.json's appliedId) and writes the gateway base URL, API key, auth scheme, and model list. The configLibrary lives under %LOCALAPPDATA%\Claude-3p\ on Windows, ~/Library/Application Support/Claude/ on macOS, and ~/.config/Claude-3p/ (or ~/.config/Claude/) on Linux. Fully restart the app afterward. If a setup screen appears, go to Menu > Developer > Configure Third-Party Inference to verify the config loaded. Each gateway uses its own model ID format, so pick the model from the live-fetched list that matches your gateway.
  • Secrets: API keys are written into these config files and, for Codex, into a user environment variable — plaintext, local only. They're excluded from git via .gitignore.

Development

Run the built-in self-test for the scroll-window math, TOML/JSON writers, model merging, URL handling, backup, and validation (no terminal needed):

powershell -File .\AI-Config-Manager.ps1 -SelfTest

Contributing

Contributions welcome — see CONTRIBUTING.md for the branch workflow (dev → PR → main) and guidelines.

Found a bug or want a new gateway/tool? Open an issue — issue templates are provided for bug reports and feature requests. Questions and ideas can go in Discussions.

Disclaimer

This tool edits your own config files to point Claude Code, OpenCode, Codex, and Hermes at a gateway you choose. It does not bypass authentication or pirate access — you supply your own API keys. Routing official clients to third-party endpoints may violate those tools' Terms of Service and can result in account bans or service termination. You are responsible for complying with your gateway's and each tool's terms. The software is provided "AS IS" without warranty; the author is not liable for any damage, bans, or service loss.

License

MIT — see LICENSE.

About

Terminal UI to point your AI coding tools at a custom gateway for Claude/OpenAI

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages