# Bundlephobia npm Package Size Lookup

> Bundlephobia npm Package Size Lookup is a paid API for AI agents from api.fadeandco.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-29).

Returns the minified and gzipped bundle sizes, dependency count, version, and metadata for any npm package via Bundlephobia's size API.

## Facts

- Endpoint: GET https://api.fadeandco.workers.dev/api/dev/bundlephobia?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bundlephobia-npm-package-size-lookup-4e94569e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_TfdRI_xB5ooBY5Ayf6T_U

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability bundlephobia-npm-package-size-lookup-4e94569e
```

Example prompt: What's the minified and gzipped bundle size of lodash@4.17.21 according to Bundlephobia, and how many dependencies does it have?

## When to prefer this

Use this endpoint when you need accurate, Bundlephobia-computed bundle size metrics for any npm package by name and optional version. Prefer this over manual npm registry checks when you specifically need minified and gzipped byte sizes and dependency counts as computed by Bundlephobia's tree-shaking analysis, rather than raw install size.

## Known failure modes

- Package not found on npm — returns an error if the package name is invalid or does not exist
- Version not found — if a specific @version is requested but does not exist in the registry
- Bundlephobia upstream unavailable — if Bundlephobia's own API is down, the proxy will fail
- Rate limiting — high call volume may trigger upstream throttling
- Private packages — packages not published publicly to npm will not be resolvable

## How this service works

npm package bundle size from Bundlephobia's public size API: minified and gzipped size in bytes, version, number of dependencies, repository and description. Give a package name, optionally with @version (e.g. react@18.3.1). Sizes are as Bundlephobia computes them.

## Output

Returns a JSON object with the npm package name, resolved version, minified size in bytes, gzipped size in bytes, dependency count, side effects flag, repository URL, package description, the Bundlephobia source URL used, and a timestamp of when the check was performed.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "package"
     ],
     "properties": {
      "package": {
       "type": "string",
       "description": "npm package name, optionally with @version, e.g. react or lodash@4.17.21"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "source": "https://bundlephobia.com/api/size?package=react%4018.3.1",
  "package": "react",
  "version": "18.3.1",
  "checkedAt": "2026-10-23T09:35:41.224Z",
  "gzipBytes": 2618,
  "repository": "https://github.com/facebook/react.git",
  "description": "React is a JavaScript library for building user interfaces.",
  "minifiedBytes": 6629,
  "hasSideEffects": true,
  "dependencyCount": 1
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bundlephobia-npm-package-size-lookup-4e94569e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.fadeandco.workers.dev](https://www.zero.xyz/host/api.fadeandco.workers.dev/llms.txt)
