@laivc/laicode
v0.3.7
Published
Official Lai.vc CLI for configuring developer tools.
Maintainers
Readme
LaiCode CLI
npm install -g @laivc/laicode
laicodeUpgrade clients that may have cached the incorrect image-tier Codex key:
npm install -g @laivc/[email protected]
laicode --version
laicode init --tool codexVersion 0.3.7 keeps standalone image keys intact, but repairs the Codex onboarding cache and switches Codex/OpenCode back to the GPT tier.
LaiCode is the official CLI testbench for the Lai.vc API gateway.
Fresh Linux server:
curl -fsSL https://raw.githubusercontent.com/laivc/laicode/main/scripts/install.sh | bash
laicodeThe interface defaults to Chinese and uses terminal panels/tables that handle CJK alignment correctly. Its terminal cockpit follows the Lai.vc brand palette: plum, coral, persimmon, ivory, and gold. Network and model calls use TTY-aware loading animations. JSON output and non-interactive shell usage stay clean.
Commands
laicode # golden path one-click onboarding
laicode menu # interactive console
laicode menu --fancy # arrow-key console where supported
laicode tools # AI tool scan, install, configure, uninstall, clean, reinstall
laicode tools install --tool codex
laicode tools install --tool ccswitch
laicode tools install --tool opencode
laicode tools uninstall --tool laicode
laicode tools uninstall --tool codex
laicode tools uninstall --tool claude
laicode tools clean --tool claude
laicode tools clean --tool codex
laicode tools clean --tool laicode
laicode tools reinstall --tool claude
laicode init # golden path: configure detected Claude Code + Codex CLI
laicode init --tool codex # preview global Codex default config
laicode init --tool codex --apply
laicode init --tool codex --route fast --apply
laicode init --tool codex --isolated
laicode init --tool claude --apply
laicode init --tool ccswitch # guide CC Switch provider setup
laicode init --tool opencode
laicode init --tool opencode --family claude
laicode init --tool vscode # guide VS Code extension routes
laicode rollback # undo the latest Laicode config write
laicode brand # brand mark and palette preview
laicode status # live cockpit snapshot
laicode status --refresh # bypass the short dashboard cache
laicode commands # command catalog
laicode completion bash # print shell completion script
laicode login
laicode models --online
laicode chat --model gpt-5.5 --message "Say hello"
laicode bench --model gpt-5.5 --count 3
laicode bench --model gpt-5.5 --count 3 --json
laicode doctor
laicode doctor --json
laicode keys
laicode config
laicode logoutLocal state is stored in ~/.laicode by default. LaiCode previews every AI tool change before applying it, backs up Laicode-managed writes, and can roll them back.
When logged in, the interactive cockpit shows live account status, online model count, balance, request count, gateway URL, and npm release status. Cockpit snapshots use a short local cache so returning to the menu stays fast.
First Run
laicode status
laicode login
laicode init
laicode doctorstatus shows the next recommended actions when the local state is empty.
Radar and Benchmark
laicode models --online shows a radar summary before the model table: online coverage, vendor count, available tiers, recommended default model, cheapest input tier, and fastest reported latency.
laicode bench uses streaming requests and reports per-run first-token latency, total latency bars, success rate, P50/P95, jitter, and estimated throughput.
Use laicode bench --json for script-friendly health checks. The JSON output includes model, timing summary, per-run result rows, timestamps, and prompt length, but no local token or API key.
Use laicode doctor --json for CI-friendly diagnostics across local state, catalog reachability, npm version status, CLI session, API key, and a real chat completion check.
Local Tool Onboarding
Phase 1 focuses on checking local AI tools and safely connecting them to Lai.vc.
laicode tools
laicode tools install --tool codex
laicode tools install --tool claude
laicode tools install --tool ccswitch
laicode tools install --tool opencode
laicode init
laicode init --tool codex
laicode init --tool codex --apply
codex
laicode init --tool claude
laicode init --tool claude --apply
claude
laicode init --tool ccswitch
laicode init --tool opencode
laicode init --tool opencode --family claude
laicode init --tool opencode --apply
opencode
laicode tools reinstall --tool codex
laicode rollbackRunning laicode with no command starts the golden path wizard. It shows a high-visibility browser login card, displays the Lai.vc account summary after authorization, then lets the user configure installed tools or install missing ones. Before writing configs it probes https://api.lai.vc and https://fast.lai.vc, recommends the faster route, prepares the correct family key for each tool, previews the files, applies the global default config after confirmation, runs real protocol probes where available, and tells the user to run claude, codex, or opencode directly.
On a fresh Linux server with neither tool installed, the same wizard offers fresh install choices. If one tool is already installed, the other pending install choice remains visible:
1. 全新安装 Claude Code 并自动配置
2. 全新安装 Codex CLI 并自动配置
3. 全新安装 OpenCode 并自动配置
4. 打开 CC Switch 安装/接入指引
5. Claude Code + Codex CLI + OpenCode 一起处理
6. 卸载工具The interactive menu keeps "一键接入我的工具" first. Advanced scan, install, uninstall, reinstall, single-tool config, and rollback live under "更多 / 工具维护".
tools install|uninstall|reinstall preview shell commands by default. --apply executes the command. tools clean previews local config/cache paths and requires an extra CLEAN confirmation, or --yes in non-interactive mode. init previews the files it would write by default. --apply creates a backup under ~/.laicode/backups before writing, and rollback restores the latest Laicode-managed write.
The high-priority scan order follows common AI developer tool usage: Claude Code, Codex CLI, VS Code, Cursor, CC Switch, OpenCode, Continue, and Cline.
For Claude Code and Codex CLI, "installed" means the executable command is on PATH. Existing config directories such as ~/.claude or ~/.codex are shown as historical configuration, not as an installed CLI. Uninstall commands remove npm global packages only; they do not delete user config directories. Use tools clean only when you intentionally want to remove local configuration residue.
Codex writes the main ~/.codex/config.toml so bare codex defaults to Lai.vc. The old isolated profile remains available with --isolated. Codex authentication still uses command-backed auth (laicode credential api-key), so the GPT-family key stays in ~/.laicode instead of being copied into Codex config.
Claude Code writes only the env block inside ~/.claude/settings.json: ANTHROPIC_BASE_URL=https://api.lai.vc or https://fast.lai.vc, plus a Claude-family API key. Existing settings are preserved. --isolated creates a wrapper script instead of modifying global settings.
Keys are family-scoped. Codex uses the onboarding codex.tier key, Claude Code uses the onboarding claude.tier key, and LaiCode will not reuse one family key for the other. During interactive setup, matching existing keys are listed for selection; otherwise LaiCode creates a correctly named key. The completion summary shows the key name, ID, tier, masked value, and the official maintenance entry: https://lai.vc/console.
OpenCode can create or merge ~/.config/opencode/opencode.json with a Lai.vc OpenAI-compatible provider. It first asks for a model family (codex/claude), then uses the matching family key. The generated model definitions include tool_call: true for tool-capable models; Codex/GPT defaults to gpt-5.5 instead of gpt-5.3-codex-spark because 5.3 is not reliable for OpenCode tool calls. Continue can create a fresh ~/.continue/config.yaml when no existing Continue config is present.
CC Switch is treated as a provider manager. LaiCode detects it, can install the headless ccswitch-tui package that exposes the ccswitch command, and guides users to add a Lai.vc OpenAI-compatible provider inside CC Switch. It does not directly write CC Switch provider storage because the desktop app, TUI, and similarly named npm packages use different contracts.
VS Code is treated as an editor host, not a single API client: LaiCode guides users into Codex, Continue, or Cline routes instead of writing editor secure storage directly. Cursor and Cline are currently inspected with guided setup to avoid unsafe writes into app-managed secure storage.
完整 API Key 默认不会显示。若确实需要查看,使用:
laicode keys --show非交互环境需要显式确认:
laicode keys --show --yeskeys --json 默认不输出任何 key 片段;需要完整 key 时必须显式使用 --show --yes。
Terminal Options
laicode --plain # disable color styling
laicode --color # force color even when NO_COLOR is set
laicode --fancy # experimental arrow-key menu
laicode --color brand # preview the Lai.vc terminal palette
laicode status --json # script-friendly status output without secret fragments
laicode doctor --json # script-friendly diagnostics
laicode config --json # script-friendly local config summary
laicode commands --json # machine-readable command catalogShell Completion
laicode completion bash
laicode completion zsh
laicode completion fish
laicode completion powershellThe command prints a completion script to stdout and does not modify your shell profile.
Environment variables:
LAICODE_HOME=/path/to/state # default: ~/.laicode
LAICODE_SITE_URL=https://lai.vc
LAICODE_PLAIN=1 # disable styling
LAICODE_COLOR=1 # force color preview/output
LAICODE_NO_SPINNER=1 # disable loading animationsManual API Key Mode
If you already have a Lai.vc key:
laicode config set api-key sk-...
laicode config set base-url https://api.lai.vc/v1
laicode chat --model gpt-5.5 --message "Test Lai.vc"Maintainers
npm run release:check
npm publishrelease:check runs syntax checks, smoke tests, and an npm publish dry-run.
