Skip to content
PluginStats

@ai-sdk/code-mode weekly downloads statistics

By ai-sdk (3 listings) · npm · AI SDKs

QuickJS-backed code mode tool for AI SDK

View on npm Fresh · Oct 18, 2026

@ai-sdk/code-mode has 38,862 recorded weekly downloads on npm, a decrease of 3.2% over the past 30 days, ranking #641 of 2,322 tracked listings.

Weekly downloads
38,862
Official API · Oct 18, 2026
7-day growth
-42.5%
-28.8K weekly downloads
30-day growth
-3.2%
-1.3K weekly downloads
90-day growth
—
Insufficient history
Rank
#641
Among tracked npm listings

About @ai-sdk/code-mode

AI SDK Code Mode

@ai-sdk/code-mode lets models write JavaScript or TypeScript that calls your AI SDK tools. The code runs in an isolated QuickJS sandbox and returns a JSON-serializable value.

Use code mode when a model needs to call several tools, transform their results, or run them concurrently. Only the tools you provide are available to the generated code.

Installation

pnpm add ai @ai-sdk/code-mode

This package runs on the server and requires Node.js 22.13 or newer.

Usage

import {
  DIRECT_TOOL_CALL,
  experimental_codeModeTool as codeModeTool,
} from '@ai-sdk/code-mode';
import { generateText, isStepCount, tool } from 'ai';
import { z } from 'zod';

const getInventory = tool({
  description: 'Get available inventory for a product.',
  inputSchema: z.object({ productId: z.string() }),
  outputSchema: z.object({
    productId: z.string(),
    availableUnits: z.number(),
  }),
  execute: async ({ productId }) => ({
    productId,
    availableUnits: 42,
  }),
});

const getDemand = tool({
  description: 'Get requested units for a product.',
  inputSchema: z.object({ productId: z.string() }),
  outputSchema: z.object({
    productId: z.string(),
    requestedUnits: z.number(),
  }),
  execute: async ({ productId }) => ({
    productId,
    requestedUnits: 31,
  }),
});

const tools = {
  code_mode: codeModeTool({
    executionPolicy: {
      timeoutMs: 30_000,
    },
  }),
  getInventory,
  getDemand,
} as const;

const result = await generateText({
  model,
  tools,
  experimental_toolCallers: {
    getInventory: ['code_mode', DIRECT_TOOL_CALL],
    getDemand: ['code_mode'],
  },
  stopWhen: isStepCount(10),
  prompt: 'Compare inventory and demand for product sku_123.',
});

The model can then generate code like:

const [inventory, demand] = await Promise.all([
  tools.getInventory({ productId: 'sku_123' }),
  tools.getDemand({ productId: 'sku_123' }),
]);

return {
  sufficient: inventory.availableUnits >= demand.requestedUnits,
  remaining: inventory.availableUnits - demand.requestedUnits,
};

Direct Execution

Use experimental_runCodeMode to run code directly:

import { experimental_runCodeMode as runCodeMode } from '@ai-sdk/code-mode';

const result = await runCodeMode({
  js: 'return await tools.getInventory({ productId: "sku_123" });',
  tools: { getInventory },
});

Description from the npm listing.

  • ai
  • ai-sdk
  • agents
  • code-mode
  • quickjs
  • sandbox
  • tools

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@ai-sdk/code-mode weekly downloads on npm, last 90 days: 38,862 weekly downloads as of Oct 18, 2026.@ai-sdk/code-modeWeekly downloads on npm · Last 90 days38,862downloads / week020K40K60K80K100KJul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
@ai-sdk/code-mode weekly downloads on npm, last 90 days: 38,862 weekly downloads as of Oct 18, 2026.

7/30/90-day growth

@ai-sdk/code-mode weekly downloads growth on npm: -42.5% over 7 days, -3.2% over 30 days, 90-day growth unavailable.@ai-sdk/code-modeWeekly downloads growth on npm38,862downloads / week now7-day growth-28,761 weekly downloads-42.5%30-day growth-1,284 weekly downloads-3.2%90-day growth+38,862 weekly downloadsInsufficient historyGrowth vs. nearest observation to each baseline date · Updated Oct 18, 2026pluginstats.com
@ai-sdk/code-mode weekly downloads growth on npm: -42.5% over 7 days, -3.2% over 30 days, 90-day growth unavailable.

Ranking history

@ai-sdk/code-mode npm ranking history: currently #641 (by weekly downloads).@ai-sdk/code-modenpm ranking · by weekly downloads · Last 90 days#641current rank#200#300#400#500#600#700Jul 22Aug 6Aug 21Sep 5Sep 20Oct 5Oct 20rankOct 17, 2026 – Oct 20, 2026 · 4 observations · Updated Oct 18, 2026pluginstats.com
@ai-sdk/code-mode npm ranking history: currently #641 (by weekly downloads).

Listing placement

All npm2,320 listings · 116 pages · 1,161 shown · page 33, #1 (overall #641)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs259 listings · 13 pages · page 2, #19 (overall #39)
AI SDKs: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (544)
Recent weekly downloads observations for @ai-sdk/code-mode
Date (UTC)Weekly downloadsChange vs. previous
38,862+5.4K
33,508-8.4K
41,883-779
42,662-18.6K
61,212-20.5K
81,6960
81,696+14.1K
67,623+1K
66,574+407
66,167+99
66,068+5.9K
60,126+8.3K
51,846-14.2K
66,026—

Similar npm AI SDKs plugins

All 20 @ai-sdk/code-mode alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@ai-sdk/code-mode. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.