Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

undici

The web request engine behind Node.js fetch.

HTTP clients and networkingNPM

GitHubWebsite

1. License

“Permission is hereby granted, free of charge, to any person obtaining a copy”

Paid and closed-source products may use it; no fee and no on-screen credit needed.

github.com/nodejs/undici/blob/main/LICENSE

From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error

What undici does

undici is the free JavaScript package that makes web requests from Node.js servers; Node's own fetch() runs on a copy of it. Installing it yourself gives your app the newest version plus extras such as proxies, retries, caching and fake answers for tests. It does not run in the browser.

What people build with it

Call outside services from your server

Your Node.js backend asks a weather, payment or AI service for data and reads the JSON answer, with less overhead than fetch().

Send every fetch through a company proxy

On a work network, one setting makes all fetch() calls follow the usual proxy settings, while local addresses skip the proxy.

Fake outside services in tests

Tests for code that calls other services get prepared answers instead of real network calls, so they run fast and offline.

Retry when a service hiccups

When another service answers 503 or 429 or drops the connection, the request waits and tries again a few times.

Cache answers that rarely change

Repeated requests for the same data are answered from memory while the other service says the data is still fresh.

A newer fetch than your Node.js has

Get request fixes and features before your Node.js version ships them, without upgrading Node.js itself.

undici popularity

76 / 100
Gid Score, #187 overall
355M
downloads a week, npm
7,762
GitHub stars
107
agent projects use it
undici: downloads per weeknpm, undici 355,342,579
undici: GitHub starsnodejs/undici 7,762

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How undici is used

  • undici is a dependency in 107 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (2.2% of the 4,867 JavaScript/TypeScript ones), #9 of 126 in http clients and networking.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 363; those are left out of every share on this page.
  • The most used alternative in our scan is Axios (470 projects).
  • Projects that use it most often also use tsx (69.2%), Vitest (74.8%), Zod (80.4%).
  • It is more common in projects set up for OpenClaw (11.7%) than for Cursor (0.9%).

By coding agent

80 projects, 2.4%
58 projects, 1.9%
39 projects, 11.7%
27 projects, 5.7%
22 projects, 0.9%
8 projects, 2.3%
8 projects, 1.7%

Often used with

In 69.2% of its projects
In 74.8% of its projects
In 80.4% of its projects
In 52.3% of its projects
In 56.1% of its projects
In 48.6% of its projects
In 47.7% of its projects

More about undici

Funding
  • GitHub Sponsors: https://github.com/nodejs
  • Open Collective: https://opencollective.com/nodejs
  • 57 GitHub sponsors

See all

Head to head
More in HTTP clients and networking

Alternatives

undici This page

MITGid 76355M/wk

Axios

Pick Axios when the same request code must run in the browser and in Node.js and you want interceptors.

MITGid 9115M/wk

Got

Pick Got when you want a Node.js request library with retries, hooks and streams in one friendly interface.

httpx

Pick httpx when your server is written in Python rather than Node.js.

cross-fetch

Universal WHATWG Fetch API implementation for Node, browsers and React Native.

MITGid 6053.9M/wk

Compare undici with another tool

Get started

Tell your AI assistant

“Use the npm package undici (pin undici@8.12.4, Node.js 22.19+) for server-side requests; always consume or dump the response body, and use EnvHttpProxyAgent with setGlobalDispatcher if we are behind a proxy.”

  1. Add undici to your Node.js project (version 8 needs Node.js 22.19 or newer).

    npm i undici

    From github.com/nodejs/undici/blob/main/README.md

  2. Make a request and read the answer; always read or discard the body.

    import { request } from 'undici'
    const { statusCode, body } = await request('https://api.example.com/data');
    const data = await body.json();
    

    From github.com/nodejs/undici/blob/main/README.md

Mistakes to avoid

const { statusCode } = await request(url) and never touching body
Read the body, or call await body.dump() when you only need the status or headers

Unread bodies keep connections busy; for request() reading the body is mandatory.

Passing { agent } from https-proxy-agent to fetch()
fetch(url, { dispatcher: new ProxyAgent(proxyUrl) }) or setGlobalDispatcher(new EnvHttpProxyAgent())

undici and Node's fetch route requests through dispatchers, not through an agent option.

Mixing undici's fetch with the global FormData (or the other way round)
Take fetch and FormData from the same place, or call install() from undici first

The two copies are different implementations and can break when mixed.

await body.json() followed by await body.text()
const text = await body.text(); const data = JSON.parse(text)

A body can be consumed only once; the second call throws TypeError unusable.

Installing undici 8 on Node.js 20
Upgrade to Node.js 22.19+ or pin undici 7.x

undici 8 declares Node.js 22.19.0 as its minimum.

Questions

Do I need it if Node.js already has fetch()?

Not for simple requests. Install it when you need proxies, test mocks, retries, connection tuning or a newer version than your Node.js bundles.

Does setGlobalDispatcher also change Node's built-in fetch?

Yes. The global dispatcher is shared with the copy of undici inside Node.js.

Why do I get "TypeError unusable" after reading the body?

A body can be read only once; read it as text first if you need it twice, then parse the text.

Can it go through a SOCKS proxy?

Yes. ProxyAgent handles HTTP, HTTPS and SOCKS5 proxy addresses.

Can I use it in a paid product?

Yes. It is MIT licensed; keep the license notice with its files.