Tech News

Node.js Added An AI Subcommand And Nobody's Talking About It

All articles
🟢🤖🤷

Node tries to ship AI, ships a flag instead

If you've been living under a rock, Node 24 dropped last week and the release notes had a one-liner buried at the bottom: `--ai` is now a built-in subcommand. Spoiler: barely anyone in the ecosystem noticed.

The Setup

`node --ai "your prompt here"` does a one-shot LLM call against whatever provider you configure via env vars. It's basically curl-to-OpenAI as a stdlib feature.

# one-shot prompt from the terminal
export NODE_AI_PROVIDER=openai
export NODE_AI_MODEL=gpt-4o-mini
export OPENAI_API_KEY=sk-...

node --ai "fix this regex: /^[a-z+@.com$/"

# or pipe a file in
cat broken.ts | node --ai "find the bug and explain"

The Money Pattern

The actually useful angle is shell scripting. Pipe stdin in, pipe answer out, compose it with grep and awk like any other unix tool. I bolted it into a pre-commit hook on a CMS repo for spell-checking blog posts and it's quietly useful.

// .nodeai.json — config lives at repo root
{
  "provider": "anthropic",
  "model": "claude-haiku-4-7",
  "systemPrompt": "you are a strict reviewer. respond in 3 bullets max.",
  "maxTokens": 256
}

// then in package.json
{
  "scripts": {
    "review": "git diff main | node --ai 'review this diff'"
  }
}

The Catch

This feels like a marketing checkbox more than a feature. It's a thin wrapper around fetch with the env-var dance baked in. Bun's `bun:llm` runs actual models locally. Deno ships typed FFI. Node ships a CLI flag that calls an API. The framing matters.

The Verdict

Useful for one-liners, embarrassing as a strategic response. Node is the default runtime for most of my client work and I want it to win, but this isn't the move. Hopefully Node 26 ships something with teeth — local inference, agent tooling, anything but a fetch wrapper with a flag.

Let us make some quick suggestions?
Please provide your full name.
Please provide your phone number.
Please provide a valid phone number.
Please provide your email address.
Please provide a valid email address.
Please provide your brand name or website.
Please provide your brand name or website.