What four AI libraries add to node_modules, measured
Packages added, file size and install time for ai, openai, @anthropic-ai/sdk and langchain, from one clean install each.
Short answerThe smallest of four AI library installs was @anthropic-ai/sdk at 13316 KB; langchain was 52100 KB. Check your bundle before deciding.
By JasonPublished Oct 9, 2026Last verified Oct 9, 20268 min read

You are picking an AI library for a function where every megabyte counts, and the docs will not tell you what each one drags into node_modules. Our test agent installed four popular packages into clean folders on 2026-10-08. Below: the footprint table, where the weight sits, and what these numbers cannot tell you.
How we checked
Automated bench run: Benchdict test agent executed on 2026-10-08; logs attached.
- Read the lead source in full: AI SDK by Vercel (introduction), fetched 2026-10-08 (text hash 6f1f9df7).
Show the test steps and evidence
Test agent steps (each one has a log entry and an evidence file in the repository):
- b1:
npm view ai version dist-tags license engines dist.unpackedSize dist.fileCount time.modified dependencies --jsonexited 0 in 723 ms on 2026-10-08; evidence sha256 4c36b5d4c99d. Measured: latest_version 7.0.133, license Apache-2.0, unpacked_size 7818 KB, file_count 694 count, direct_dependencies 3 count, last_modified 2026-10-08, node_engine >=22. - b2:
npm install ai --ignore-scripts --no-audit --no-fund --no-save --loglevel=error --registry=https://registry.npmjs.org/ --prefix <tmp>exited 0 in 1658 ms on 2026-10-08; evidence sha256 ff1a12d7fbc6. Measured: npm_added_packages 11 count, distinct_packages 11 count, largest_package ai, largest_package_size 7818 KB, install_time 1658 ms, packages_installed 20 count, disk_size 18657 KB, bin_count 0 count. - b3:
npm view openai version dist-tags license engines dist.unpackedSize dist.fileCount time.modified dependencies --jsonexited 0 in 551 ms on 2026-10-08; evidence sha256 39e11f718781. Measured: latest_version 7.30.1, license Apache-2.0, unpacked_size 20528 KB, file_count 3882 count, direct_dependencies 0 count, last_modified 2026-10-08, node_engine >=22.0.0. - b4:
npm install openai --ignore-scripts --no-audit --no-fund --no-save --loglevel=error --registry=https://registry.npmjs.org/ --prefix <tmp>exited 0 in 2411 ms on 2026-10-08; evidence sha256 edcd04713eb2. Measured: npm_added_packages 1 count, distinct_packages 1 count, largest_package openai, largest_package_size 20528 KB, install_time 2411 ms, packages_installed 1 count, disk_size 20529 KB, bin_count 0 count. - b5:
npm view @anthropic-ai/sdk version dist-tags license engines dist.unpackedSize dist.fileCount time.modified dependencies --jsonexited 0 in 665 ms on 2026-10-08; evidence sha256 5ae509a0c898. Measured: latest_version 0.132.1, license MIT, unpacked_size 12774 KB, file_count 2563 count, direct_dependencies 2 count, last_modified 2026-10-08. - b6:
npm install @anthropic-ai/sdk --ignore-scripts --no-audit --no-fund --no-save --loglevel=error --registry=https://registry.npmjs.org/ --prefix <tmp>exited 0 in 2015 ms on 2026-10-08; evidence sha256 d7e02d4fc470. Measured: npm_added_packages 7 count, distinct_packages 7 count, largest_package @anthropic-ai/sdk, largest_package_size 12774 KB, install_time 2015 ms, packages_installed 8 count, disk_size 13316 KB, bin_count 1 count. - b7:
npm view langchain version dist-tags license engines dist.unpackedSize dist.fileCount time.modified dependencies --jsonexited 0 in 1360 ms on 2026-10-08; evidence sha256 2193dbb20bd2. Measured: latest_version 1.5.16, license MIT, unpacked_size 3158 KB, file_count 468 count, direct_dependencies 4 count, last_modified 2026-10-08, node_engine >=20. - b8:
npm install langchain --ignore-scripts --no-audit --no-fund --no-save --loglevel=error --registry=https://registry.npmjs.org/ --prefix <tmp>exited 0 in 6167 ms on 2026-10-08; evidence sha256 04e4ba47167a. Measured: npm_added_packages 23 count, distinct_packages 23 count, largest_package js-tiktoken, largest_package_size 21907 KB, install_time 6167 ms, packages_installed 34 count, disk_size 52100 KB, bin_count 1 count.
---

The install footprint, side by side
Our test agent installed each package into an empty folder with install scripts switched off, then counted what landed in node_modules. That is what you pay before you write a line of code.
| Package | Version | Packages added (npm) | Folders with a package.json | File size (KB) | Install time (ms) |
|---|---|---|---|---|---|
| ai | 7.0.133 | 11 | 20 | 18657 | 1658 |
| openai | 7.30.1 | 1 | 1 | 20529 | 2411 |
| @anthropic-ai/sdk | 0.132.1 | 7 | 8 | 13316 | 2015 |
| langchain | 1.5.16 | 23 | 34 | 52100 | 6167 |
Read the columns with three cautions. "Packages added" is the count npm itself printed after each install. The folder count is higher because some packages, zod for one, ship sub-entry folders with their own package.json. "File size" is the sum of file bytes under node_modules, not disk usage, which is typically larger because files occupy whole blocks. And install time is one run on one laptop: the first install starts with an empty npm cache and later ones can reuse downloads of shared packages, so do not read that column as a speed ranking.
All four registry records show the same last-modified date, 2026-10-08. That field cannot tell you which project ships more often, so we did not rank on it.
Where the weight sits
The registry reports each package's own unpacked size. Subtract it from the install size and you see how much came from everything else in the install:
- langchain: its own files are 3158 KB; the rest of the 52100 KB install, 93.9%, is other packages.
- ai: its own files are 7818 KB of 18657 KB, so 58.1% is other packages.
- @anthropic-ai/sdk: its own files are 12774 KB of 13316 KB, so only 4.1% is other packages.
- openai: one package, no direct dependencies, 20529 KB.
"Other packages" is not the same as other people's code. We recorded the five largest packages in each install, and in the langchain install they were js-tiktoken at 21907 KB, then @langchain/core, zod, @langchain/langgraph-sdk and @langchain/langgraph. The single biggest piece, js-tiktoken, is 42% of that install by itself. We did not trace which package pulls it in.
Put differently, the langchain install is 3.91 times the size of the Anthropic one.
Pick by situation
Installed size is a rough guide, not your bundle size. Bundlers drop unused code, so confirm with your own build. With that caveat:
- If you want the smallest install of the four, then take
@anthropic-ai/sdkat 13316 KB, becauseai(18657 KB) andopenai(20529 KB) both installed larger. - If you want the fewest packages to track, then
openaiis one package with no direct dependencies, whileaiadded 11 and@anthropic-ai/sdkadded 7. - If you are weighing langchain for a size-limited function, then plan for 52100 KB and 23 packages, because that is what the install produced before any integration package.
- If your runtime is Node 20, then check
enginesbefore you install, because the registry lists Node 22 or later foraiandopenai, and the openai README says Node 22 is its minimum and that Node 20 reached end of life on April 30, 2026.
What we could not confirm
- Bundle size and cold start. We never bundled anything or ran any package's code. Nothing here says which library is faster or better.
- Who owns the weight. We recorded the five largest packages per install, not which package depends on which.
- Install time. Each package was installed once. The evidence files record Node v22.14.0 on macOS arm64; the npm version was not recorded. Treat the spread from 1658 to 6167 ms as rough.
- Node requirement for LangChain. The LangChain docs say Node.js 22+, while the registry record for
langchain1.5.16 lists Node 20 or later. We could not reconcile the two. - Anthropic's Node floor. The registry record has no
enginesfield. The Anthropic docs say Node.js 20 LTS or later. - Independent confirmation. We read only vendor documentation, never an outside review of these packages.
What to do next
- [ ] Run
npm install <package> --ignore-scriptsin an empty folder on your own Node version and compare the file size with the table. - [ ] Bundle your function and look at the output size, not the
node_modulessize. - [ ] Check every package's
enginesfield against the runtime you deploy to before you install.
The useful surprise is not that langchain is large. It is where the weight sits: the langchain package itself is 3158 KB, yet its install is 52100 KB, and the biggest single piece is js-tiktoken at 21907 KB. Package count and file size tell different stories too: openai is one package and still the largest single install of the three SDKs. I would not choose a library on install size alone, since a bundler changes the picture. I would use these numbers to decide where to measure first, and to catch the case where a small-looking dependency quietly adds tens of megabytes to a function with a size limit. What would change this read: a bundled-size run, a second install on another machine that moves the ranking, or a trace of which package pulls in the heavy ones. Until then, treat this as a pre-flight check, not a verdict.
The smallest of four AI library installs was @anthropic-ai/sdk at 13316 KB; langchain was 52100 KB. Check your bundle before deciding.
The install numbers put langchain far above the three other libraries on size and package count, but they do not measure bundle size, speed or quality.
Anyone who already bundles and measures output size, or who is choosing on features rather than footprint.
Sources
- AI SDK by VercelAI SDK docs, Oct 8, 2026. Used for: What the ai package is described as: a TypeScript toolkit for AI applications and agents
- Install LangChainLangChain docs, Oct 8, 2026. Used for: The documented install command (langchain and @langchain/core together), the Node.js 22+ requirement and the statement that integrations ship as separate provider packages
- TypeScript SDKAnthropic docs, Oct 8, 2026. Used for: The documented install command and the supported runtimes (Node.js 20 LTS or later)
- openai/openai-nodeOpenAI on GitHub, Oct 8, 2026. Used for: The documented install command for the openai package, its Node.js 22 minimum and the note that Node.js 20 reached end of life on April 30, 2026
Jason, Founder & editor, Benchdict. About Benchdict