Skip to content
PluginStats

@tanstack/ai-utils weekly downloads statistics

By tanstack (53 listings) · npm · AI SDKs

Shared TypeScript utilities for TanStack AI provider adapters and runtime packages.

View on npm Fresh · Dec 6, 2026

@tanstack/ai-utils has 4,948,083 recorded weekly downloads on npm, an increase of 190% over the past 30 days, ranking #168 of 3,247 tracked listings.

Weekly downloads
4,948,083
Official API · Dec 5, 2026
7-day growth
+17.3%
+728.9K weekly downloads
30-day growth
+190%
+3.2M weekly downloads
90-day growth
+2193%
+4.7M weekly downloads
Rank
#168
▲ 2 in 7 days

About @tanstack/ai-utils

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/api/readme/ai.png?theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/api/readme/ai.png" /> <img src="https://tanstack.com/api/readme/ai.png" alt="TanStack AI" width="900" /> </picture> </div> <br />

@tanstack/ai-utils

Shared TypeScript utilities for TanStack AI provider adapters and runtime packages.

This is an internal dependency of the provider adapters (@tanstack/ai-openai, @tanstack/ai-anthropic, @tanstack/ai-gemini, …) and runtime packages. It has no dependencies of its own and no framework or provider code; you normally get it transitively rather than installing it yourself. It is documented here so adapter authors know what already exists before writing their own.

Installation

npm install @tanstack/ai-utils
# or
pnpm add @tanstack/ai-utils
# or
yarn add @tanstack/ai-utils

What's in it

ExportPurpose
generateId(prefix)Prefixed unique id: ${prefix}-${timestamp}-${random}, with the full base36 random portion kept for entropy.
getApiKeyFromEnv(name)Reads name from window.env (browser) or process.env (Node) and throws a clear error naming the variable when it is missing.
arrayBufferToBase64, base64ToArrayBuffer, base64ToUint8ArrayCross-runtime base64 helpers. Prefer the native Uint8Array.toBase64() / fromBase64() when available, then Node's Buffer, then atob / btoa.
transformNullsToUndefined(value)Recursively strips every null from JSON-shaped structured output so .optional() fields round-trip through Zod. Schema-blind.
undoNullWidening(value, map?)Strips only the nulls that strict-mode schema widening synthesized, using the NullWideningMap recorded by the widening pass. .nullable() fields keep their nulls.
Ids and API keys
import { generateId, getApiKeyFromEnv } from '@tanstack/ai-utils'

const runId = generateId('run') // run-1758424800000-k3j9x2p1q
const apiKey = getApiKeyFromEnv('OPENAI_API_KEY') // throws if unset
Base64
import { arrayBufferToBase64, base64ToUint8Array } from '@tanstack/ai-utils'

declare const file: File

const encoded = arrayBufferToBase64(await file.arrayBuffer())
const bytes = base64ToUint8Array(encoded)

Be cautious with large buffers on serverless and Workers runtimes: base64 multiplies the memory footprint by about 1.33× and can OOM the isolate.

Nulls in structured output

OpenAI-style strict schemas require optional fields to be widened to required + nullable, so the provider returns null for an absent optional. Validating that null against the original schema fails, because .optional() means T | undefined, not T | null.

  • undoNullWidening(value, map) is the precise fix: it consults the NullWideningMap built by convertSchemaForStructuredOutput in @tanstack/ai and drops only the nulls the widening pass introduced, so both optional and nullable fields round-trip. With no map, the value is returned untouched.
  • transformNullsToUndefined(value) is the schema-blind fallback: it strips every null, including ones a .nullable() field legitimately allows, and is meant for JSON.parse output only (class instances, Date, Map, Set are not preserved).

License

MIT

Description from the npm listing.

  • ai
  • ai-sdk
  • typescript
  • tanstack
  • utilities
  • adapter
  • provider-adapter

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

@tanstack/ai-utils weekly downloads on npm, last 90 days: 4,948,083 weekly downloads as of Dec 5, 2026, +2193% over 90 days.@tanstack/ai-utilsWeekly downloads on npm · Last 90 days4,948,083downloads / week+2193% over 90 days01M2M3M4M5MSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@tanstack/ai-utils weekly downloads on npm, last 90 days: 4,948,083 weekly downloads as of Dec 5, 2026, +2193% over 90 days.

7/30/90-day growth

@tanstack/ai-utils weekly downloads growth on npm: +17.3% over 7 days, +190% over 30 days, +2193% over 90 days.@tanstack/ai-utilsWeekly downloads growth on npm4,948,083downloads / week now7-day growth+728,908 weekly downloads+17.3%30-day growth+3,242,087 weekly downlo…+190%90-day growth+4,732,310 weekly downlo…+2193%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@tanstack/ai-utils weekly downloads growth on npm: +17.3% over 7 days, +190% over 30 days, +2193% over 90 days.

Ranking history

@tanstack/ai-utils npm ranking history: currently #168 (by weekly downloads).@tanstack/ai-utilsnpm ranking · by weekly downloads · Last 90 days#168current rank#160#180#200#220#240#260#280Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
@tanstack/ai-utils npm ranking history: currently #168 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 9, #8 (overall #168)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs378 listings · 19 pages · page 1, #3 (overall #3)
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 (170)
Recent weekly downloads observations for @tanstack/ai-utils
Date (UTC)Weekly downloadsChange vs. previous
4,948,083+85.2K
4,862,862+157.2K
4,705,629+155.1K
4,550,529+150.6K
4,399,957+108K
4,291,926+43.2K
4,248,713+29.5K
4,219,175+2.6K
4,216,577-29.4K
4,245,931+10.7K
4,235,189+40.9K
4,194,323+80.3K
4,114,051+75.9K
4,038,179—

Similar npm AI SDKs plugins

All 20 @tanstack/ai-utils 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/@tanstack/ai-utils. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.