Grok Switch is a local desktop control plane for Grok CLI.
It manages relay providers and official multi-account sessions the way CC Switch does for Claude Code — without sending credentials off-device.
中文说明见下方 中文。
| Area | Capability |
|---|---|
| Providers | Create / edit / delete OpenAI-compatible & Anthropic-compatible relays |
| One-click enable | Writes managed gs-* model sections into ~/.grok/config.toml |
| Official accounts | Capture grok login sessions and switch between them |
| Import | CC Switch providers + MCP + prompts; JSON export/import of providers |
| Skills | Manage ~/.grok/skills (SKILL.md); import from ~/.cc-switch/skills; backups on delete |
| MCP | Manage [mcp_servers.*] in ~/.grok/config.toml (stdio / HTTP); enable, probe, delete |
| Provider pool | Priority / weight / cooldown metadata for automatic selection |
| Local proxy | Optional 127.0.0.1 OpenAI-compatible proxy with failover + SQLite request/token logs |
| Account pool | Priority / weight / pool membership for official accounts |
| Prompts store | SQLite prompts table for reusable prompt snippets |
| Health checks | Probe chat_completions / responses / messages before enable |
| Backups | Auto-backup before switch; restore from UI |
| Desktop UX | Tray icon, single-instance focus, light/dark/system theme |
| Privacy | Keys stay under ~/.grok-switch/; logs mask secrets |
| Providers | Settings |
|---|---|
| Light SaaS-style provider list with enable / test / edit | Theme, paths, auto-backup, auto health-check |
Run the app locally to explore the full UI (Overview · Providers · Accounts · Import · Skills · MCP · Logs & Backups · Settings).
┌────────────────────┐
│ Grok Switch UI │ React + Tauri
└─────────┬──────────┘
│ invoke commands
┌─────────▼──────────┐
│ Rust core │ providers · auth vault · TOML writer · health · import
└─────────┬──────────┘
│ filesystem
┌─────────▼──────────┐
│ ~/.grok-switch/ │ app data (providers, settings, accounts, backups)
│ ~/.grok/ │ Grok CLI config.toml + auth.json
│ ~/.cc-switch/ │ optional import source (read-only)
└────────────────────┘
Managed model sections use the prefix gs-:
[endpoints]
models_base_url = "https://your-relay.example/v1"
[models]
default = "gs-my-relay-grok45"
[model.gs-my-relay-grok45]
model = "grok-4.5"
base_url = "https://your-relay.example/v1"
api_key = "sk-..."
api_backend = "chat_completions"
context_window = 1000000Then:
grok -m gs-my-relay-grok45
# or
grok -p "hello" -m gs-my-relay-grok45- Windows 10/11 (primary target)
- Node.js 18+
- Rust via rustup + MSVC Build Tools
- Grok CLI installed (default:
~/.grok/bin/grok.exe)
git clone https://github.com/ibi6/grok-switch.git
cd grok-switch
npm install
npm run tauri:devFrontend-only preview (mock API, does not write real Grok config):
npm run dev
# http://localhost:1420npm run tauri:buildArtifacts:
src-tauri/target/release/grok-switch.exe- Installer under
src-tauri/target/release/bundle/
cd src-tauri
cargo test- Open Providers → Add
- Fill name, Base URL (optional auto
/v1), API key, protocol, default model - Test → Enable
- Toast shows the managed model id, e.g.
gs-my-relay-grok45(also clickable on the card)
- Open Import
- Preview Claude providers from
~/.cc-switch - Select → import (default backend: Anthropic
messages, editable later) - Enable in Providers
- Terminal:
grok login(or device auth) - Accounts → Capture current session
- Switch anytime; official mode sets
[models].defaultto Settings → official default model (grok-buildby default)
- Auto-backup before switch (toggle in Settings)
- Logs & Backups page: list + one-click restore
- Restore overwrites
config.toml/auth.jsonand clears “current” mode pointers
| Path | Purpose |
|---|---|
~/.grok-switch/providers.json |
Provider catalog |
~/.grok-switch/settings.json |
App settings |
~/.grok-switch/accounts/<id>/ |
Official auth snapshots |
~/.grok-switch/backups/ |
Switch backups (~30 kept) |
~/.grok-switch/activity.jsonl |
Local activity log |
~/.grok/config.toml |
Target — managed gs-* models + default |
~/.grok/auth.json |
Target — official session |
~/.cc-switch/cc-switch.db |
Optional import source (read-only) |
api_backend |
Protocol |
|---|---|
chat_completions |
OpenAI /v1/chat/completions (default) |
responses |
OpenAI Responses API |
messages |
Anthropic Messages (x-api-key via extra_headers) |
- Credentials are stored locally only (same trust model as typical CLI switchers).
- UI and logs mask API keys.
- Never commit
providers.json,auth.json, or backup folders. - This project is not affiliated with xAI / Grok; the icon is a stylized mark for this app.
See SECURITY.md for reporting guidance.
grok-switch/
├── src/ # React UI
│ ├── pages/ # Overview, Providers, Accounts, Import, Logs, Settings
│ ├── components/ # Sidebar, forms, toast, overlay
│ └── lib/ # Tauri API bridge + types
├── src-tauri/ # Rust / Tauri
│ └── src/
│ ├── commands/ # invoke surface
│ └── core/ # stores, TOML writer, health, import, backup
├── docs/ # Design & implementation notes
├── scripts/ # Icon generation helpers
└── README.md
- Windows-first; macOS / Linux packaging not prioritized yet
- No remote sync, billing, or failover queue
- Does not mutate global
ANTHROPIC_*env for Claude Code - Launch-on-startup is stored but not fully wired to OS autostart
Contributions welcome — see CONTRIBUTING.md.
MIT © Grok Switch contributors
Grok Switch is an independent community tool.
“Grok” and related marks belong to their respective owners.
Use third-party relays only where you are authorized to do so.
Grok Switch 是面向 Grok CLI 的本地桌面切换器(对标 Claude Code 生态里的 CC Switch)。
- 中转供应商:OpenAI / Anthropic 兼容网关,一键写入
~/.grok/config.toml - 官方多账号:捕获
grok login会话并切换 - CC Switch 导入:供应商 / MCP / 提示词;供应商 JSON 导出导入
- Skills:管理
~/.grok/skills(SKILL.md);可从~/.cc-switch/skills导入;删除前备份到~/.grok-switch/skill-backups - MCP:管理
config.toml的[mcp_servers.*](stdio / HTTP),启停与探测 - 供应商池:优先级 / 权重 / 冷却;代理故障时自动切换
- 本地代理:
127.0.0.1OpenAI 兼容反向代理 + SQLite 请求/Token 日志;启动自动恢复 - 账号池:官方账号 priority / weight / 入池出池
- 测通 / 备份 / 托盘 / 浅色深色主题
- 凭证不出本机
在 Grok TUI 里用 /skill-name 或 /skills <name> 调用已安装 skill。
git clone https://github.com/ibi6/grok-switch.git
cd grok-switch
npm install
npm run tauri:dev启用后终端:
grok -m gs-<模型条目id>更完整的说明见上文英文章节(数据目录、协议、安全)。