{"id":51654655,"url":"https://github.com/xavier2code/llm-switch","last_synced_at":"2026-07-14T08:03:35.872Z","repository":{"id":366708858,"uuid":"1276716514","full_name":"xavier2code/llm-switch","owner":"xavier2code","description":"Switch Claude Code settings.json profiles from the command line","archived":false,"fork":false,"pushed_at":"2026-07-01T02:49:04.000Z","size":497,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-01T03:20:10.972Z","etag":null,"topics":["claude-code","cli","llm","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xavier2code.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-22T08:22:02.000Z","updated_at":"2026-07-01T02:49:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xavier2code/llm-switch","commit_stats":null,"previous_names":["xavier2code/llm-switch"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/xavier2code/llm-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier2code%2Fllm-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier2code%2Fllm-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier2code%2Fllm-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier2code%2Fllm-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xavier2code","download_url":"https://codeload.github.com/xavier2code/llm-switch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier2code%2Fllm-switch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35451878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-14T02:00:06.603Z","response_time":114,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","cli","llm","nodejs"],"created_at":"2026-07-14T08:03:35.178Z","updated_at":"2026-07-14T08:03:35.863Z","avatar_url":"https://github.com/xavier2code.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# llm-switch\n\n[![npm version](https://img.shields.io/npm/v/@xavier2code/llm-switch?style=flat-square)](https://www.npmjs.com/package/@xavier2code/llm-switch)\n[![npm downloads](https://img.shields.io/npm/dm/@xavier2code/llm-switch?style=flat-square)](https://www.npmjs.com/package/@xavier2code/llm-switch)\n[![CI](https://img.shields.io/github/actions/workflow/status/xavier2code/llm-switch/ci.yml?branch=main\u0026style=flat-square)](https://github.com/xavier2code/llm-switch/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](./LICENSE)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg?style=flat-square)](https://nodejs.org/)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://prettier.io/)\n\nSwitch LLM profiles for Claude Code, OpenCode, Codex, and other AI CLI tools.\nThe recommended command name is `sw`; `llm-switch` is installed as a legacy alias.\n\n\u003e **Note:** The unscoped `llm-switch` package is deprecated. Install\n\u003e `@xavier2code/llm-switch` for the latest releases.\n\n## Install\n\n```bash\nnpm i -g @xavier2code/llm-switch\n```\n\n## Quick start\n\n```bash\nsw create                     # create and activate a new profile\nsw switch glm                 # switch active config to the \"glm\" profile\nsw restore                    # undo the last switch from the automatic backup\nsw list                       # list profiles and show the active one\nsw                            # launch the interactive TUI (TTY only)\n```\n\nEvery command prompts for targets (Claude Code, OpenCode, Codex) and remembers\nthe choice. Use `--target \u003cid\u003e` or `LLM_SWITCH_TARGET` to skip the prompt.\n\n## Supported targets\n\n| Target     | Active config                      | Config dir env var     | Format |\n| ---------- | ---------------------------------- | ---------------------- | ------ |\n| `claude`   | `~/.claude/settings.json`          | `CLAUDE_CONFIG_DIR`    | JSON   |\n| `opencode` | `~/.config/opencode/opencode.json` | `OPENCODE_CONFIG_DIR`  | JSON   |\n| `codex`    | `~/.codex/config.toml`             | `CODEX_HOME`           | TOML   |\n\nAnthropic-family targets use `ANTHROPIC_BASE_URL`, `ANTHROPIC_MODEL`, and\n`ANTHROPIC_AUTH_TOKEN`. Codex uses `model`, `base_url`, and `api_key` in TOML.\n\n## Layout\n\n```\n~/.llm-switch/\n  profiles/\u003ctarget-id\u003e/\u003calias\u003e.[json|toml]   saved profiles (central store)\n  state.json                                 last-selected targets\n~/.claude/\n  settings.json                              active config\n  settings.json.bak                          previous active config\n```\n\nProfiles are stored centrally; each tool's active config and backup stay in its\nown config directory.\n\n## Built-in providers\n\n| Provider       | Default BASE URL                                        | Default model     |\n| -------------- | ------------------------------------------------------- | ----------------- |\n| GLM (智谱)     | `https://open.bigmodel.cn/api/anthropic`                | `glm-4.5`         |\n| DeepSeek       | `https://api.deepseek.com/anthropic`                    | `deepseek-chat`   |\n| Kimi (Moonshot)| `https://api.kimi.com/coding/`                          | `kimi-for-coding` |\n| MiniMax        | `https://api.minimaxi.com/anthropic`                    | `MiniMax-Text-01` |\n| Qwen (DashScope)| `https://dashscope.aliyuncs.com/compatible-mode/anthropic` | `qwen-plus`    |\n| OpenAI         | `https://api.openai.com/v1`                             | `gpt-4.1`         |\n\nThe `create` wizard validates Anthropic-family endpoints and writes TOML for\nCodex. A single run can create and activate a profile across every selected\ntarget.\n\n## Security\n\nAPI keys are stored in plaintext in active config and profile files. All files\ncreated by `sw` are set to `0600` so they are readable only by your Unix user.\n\n## Usage examples\n\n```bash\nsw --target opencode list           # operate on a single target\nsw -t codex create                  # create a Codex TOML profile\nsw save -f glm                      # overwrite an existing profile\nLLM_SWITCH_TARGET=opencode sw current   # default target for scripts\n\nsw --help                           # full help and env vars\nsw \u003ccmd\u003e --help                     # per-command help and exit codes\n```\n\n## Migration\n\n`sw` automatically migrates profiles from earlier layouts on first run:\n\n- `0.5.x` and earlier (legacy `llm-switch` package): flat\n  `settings.json.\u003calias\u003e` files are moved into the central store.\n- `0.7.x` (legacy `llm-switch` package): per-tool `llm-switch/profiles/`\n  directories are copied into the central store; originals are left in place.\n\nRun `sw init` to review detected tools and directory status.\n\n## Development\n\n```bash\npnpm install\npnpm -r test          # run all tests\npnpm -r lint\npnpm -r format:check\npnpm -r build\n```\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) and [SECURITY.md](./SECURITY.md).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavier2code%2Fllm-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxavier2code%2Fllm-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavier2code%2Fllm-switch/lists"}