fnm-ai is a Windows-first npm wrapper around fnm for managing Node.js
versions with natural-language requests.
It installs two executable names:
fnm-api
fnm-aiUse fnm-api for normal npm-based usage. The lower-level Rust binary also
exposes the same feature as fnm ai and fnm api.
npm install -g fnm-aiThe npm package currently targets Windows x64:
{
"os": ["win32"],
"cpu": ["x64"]
}Common requests are parsed locally first. If the local parser cannot understand
the request, fnm calls an OpenAI-compatible chat/completions provider.
The default model is Kimi kimi-k2.6. Save the provider config once:
fnm-api config set --base-url https://api.moonshot.ai/v1 --api-key <your-kimi-api-key>You can also set the model explicitly:
fnm-api config set --base-url https://api.moonshot.ai/v1 --api-key <your-kimi-api-key> --model kimi-k2.6Inspect the saved config without printing the full API key:
fnm-api config getPrint the config file path:
fnm-api config pathOn Windows this is usually:
%APPDATA%\fnm-ai\config.json
Environment variables override the saved config:
$env:FNM_AI_BASE_URL = "https://api.moonshot.ai/v1"
$env:FNM_AI_API_KEY = "<your-kimi-api-key>"
$env:FNM_AI_MODEL = "kimi-k2.6"Run a single request:
fnm-api "帮我切换到 Node 20"
fnm-api "安装最新 LTS,并切换过去"
fnm-api "use node 22, install it if missing"
fnm-api "检查当前环境配置"
fnm-api "列出已安装版本"Start the interactive prompt:
fnm-apiThe prompt has two built-in presets:
1. switch environment
2. check current environment config
Preset 1 applies the current project or default Node version using
.node-version, .nvmrc, package.json#engines.node, or the default alias.
Preset 2 prints the fnm directory, Node mirror, architecture, version-file
strategy, corepack setting, resolve-engines setting, multishell path, PATH
status, and current Node version.
When launched through npm, fnm-api reads %APPDATA%\fnm-ai\config.json and
maps it to FNM_AI_BASE_URL, FNM_AI_API_KEY, and FNM_AI_MODEL.
If FNM_MULTISHELL_PATH is missing, fnm-api also runs:
fnm env --jsonIt merges the returned FNM_* variables into the child process and prepends the
multishell path to PATH. This lets fnm-api "检查当前环境配置" work even when
the current PowerShell session has not loaded fnm env.
One limitation remains: a child process cannot permanently mutate the parent
terminal environment. If you want node, npm, and pnpm in the current
PowerShell window to keep using the selected version after fnm-api exits, add
fnm to your PowerShell profile:
fnm env --use-on-cd --shell powershell | Out-String | Invoke-ExpressionWithout that profile setup, fnm-api can initialize and use the environment for
its own process and update fnm's multishell link, but the already-running parent
shell may not refresh its own PATH.
AI output is translated into a fixed set of actions:
help
exit
switch_environment
check_environment
install
use
list_local
list_remote
current
default
uninstall
The model cannot return arbitrary shell commands for execution.