Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
JavaScript HTTP client libraries send requests to web servers and read the responses. Apps and AI agents use these libraries to call external APIs with features the built-in fetch lacks, such as retries and response caching.
Popularity
Undici has the most monthly downloads in this comparison, at 1.2B.
Undici is an HTTP client written from scratch for Node.js, and the built-in fetch in Node.js runs on a bundled copy of it. Installing the package adds APIs the built-in version lacks: request, stream, and pipeline for lower-level calls, and ProxyAgent and MockAgent for proxies and tests. An Agent or Pool controls connection pooling, and setGlobalDispatcher applies one to every request. Undici's HTTP parser runs on WebAssembly, so requests fail in a Node.js setup that turns WebAssembly off.
Downloads / mo
1.3B
Stars
7.7K
Last release
8.12.4
License
MIT
Strengths
Controls reusable connection pools.Choose Agent or Pool when connection behavior needs explicit control.
Retries through dispatcher composition.Wrap a dispatcher in RetryAgent to retry eligible failed requests.
Limitations
Response bodies must be consumed.Read or cancel each response body so its connection can be reused.
Fetch bodies use web streams.Convert the response body when a Node stream is required.
async function createDispatcher (gyp) {
const env = process.env
const hasProxyEnv = env.http_proxy || env.HTTP_PROXY || env.https_proxy || env.HTTPS_PROXY
if (!gyp.opts.proxy && !gyp.opts.cafile && !hasProxyEnv) {
return new RetryAgent(new Agent(), { maxRetries: 3 })
}
const opts = {}
if (gyp.opts.cafile) {
const ca = await readCAFile(gyp.opts.cafile)
// EnvHttpProxyAgent forwards opts to both its internal Agent (direct) and // ProxyAgent (proxied). Agent reads TLS config from `connect`; ProxyAgent // reads it from `requestTls` (origin) / `proxyTls` (proxy). Set all three // so the custom CA is applied regardless of which path a request takes. opts.connect = { ca }
opts.requestTls = { ca }
opts.proxyTls = { ca }
}
if (gyp.opts.proxy) {
opts.httpProxy = gyp.opts.proxy
opts.httpsProxy = gyp.opts.proxy
}
if (gyp.opts.noproxy) {
opts.noProxy = gyp.opts.noproxy
}
return new RetryAgent(new EnvHttpProxyAgent(opts), { maxRetries: 3 })
}
node-fetch
node-fetch brings the browser's Fetch API to Node.js, built on the native http module rather than a browser polyfill. A call to fetch(url) returns a promise of a Response, read with res.json() or res.text(). Request and response bodies are Node streams, and the library decodes gzip, deflate, and Brotli responses. Options add a redirect limit and a response size limit that the Fetch standard leaves out. The current major version is an ES module only, and the previous one still loads with require.
Downloads / mo
1.1B
Stars
8.8K
Last release
3.3.2
License
MIT
Limitations
ES module only.The current version can't be loaded with require; CommonJS projects stay on the previous major version.
async () => {
const response = await fetch('https://sindresorhus.com/unicorn');
// Abort retrying if the resource doesn't exist if (response.status === 404) {
throw new AbortError(response.statusText);
}
return response.blob();
}
Gaxios
Gaxios is an HTTP client from Google that offers an interface like Axios on top of node-fetch. request({ url }) sends a request and resolves to a response whose data field holds the parsed body. A Gaxios instance stores defaults such as a base URL and headers for every request it sends, and instance.fetch offers a Fetch-compatible call. The package is built for calls to Google APIs and services.
request<T>(opts: GaxiosOptions): GaxiosPromise<T> {
// ensure the user isn't passing in request-style options opts = this.configure(opts);
validate(opts);
return this.instance.request<T>(opts).catch(e => {
throw this.processError(e);
});
}
Axios
Axios sends HTTP requests from the browser and from Node.js with the same promise-based API. Methods such as axios.get resolve to a response whose data field holds the parsed body, and objects passed as data serialize to JSON. Interceptors run code on every request or response to add logic or transform data. axios.create makes an instance with its own base URL, headers, and timeout. Requests can be cancelled, and a response with an error status rejects the promise.
Downloads / mo
563.5M
Stars
109.4K
Last release
1.21.1
License
MIT
Strengths
Works in browsers and Node.Use browser and server adapters through the same request interface.
Intercepts requests and responses.Add shared request configuration and response handling through interceptors.
Limitations
Retry policies need an integration.Add axios-retry when transient request failures should trigger retries.
Timeouts are disabled by default.Set a timeout explicitly when requests must stop waiting.
const axiosRetry: AxiosRetry = (axiosInstance, defaultOptions) => {
const requestInterceptorId = axiosInstance.interceptors.request.use((config) => {
setCurrentState(config, defaultOptions, true);
if (config[namespace]?.validateResponse) {
// by setting this, all HTTP responses will be go through the error interceptor first config.validateStatus = () => false;
}
return config;
});
const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (error) => {
const { config } = error;
// If we have no information to retry the request if (!config) {
return Promise.reject(error);
}
const currentState = setCurrentState(config, defaultOptions);
if (error.response && currentState.validateResponse?.(error.response)) {
// no issue with response return error.response;
}
if (await shouldRetry(currentState, error)) {
return handleRetry(axiosInstance, currentState, error, config);
}
await handleMaxRetryTimesExceeded(currentState, error);
return Promise.reject(error);
});
return { requestInterceptorId, responseInterceptorId };
};
Got
Got is an HTTP request library for Node.js with promise and stream interfaces. got.post(url, { json }) sends a JSON body, and .json() on the returned promise parses the response. Failed requests retry by default, and options cover timeouts, caching, proxies, and Unix sockets. The package is an ES module only. Its README points browser code to Ky, a Fetch-based client from the same authors.
Downloads / mo
205.1M
Stars
15.0K
Last release
16.2.0
License
MIT
Strengths
Provides promise and stream APIs.Choose parsed responses or streaming transfers for Node applications.
Includes configurable retry behavior.Set eligible methods, failure codes, and retry delays.
Limitations
Requires ES module imports.Convert CommonJS integration code before importing current Got.
POST is excluded from retries.Configure retry.methods explicitly when repeating a POST request is safe.
export default async function packageJson(packageName, options) {
options = {
version: 'latest',
...options,
};
const scope = packageName.split('/')[0];
const registryUrl_ = options.registryUrl || registryUrl(scope);
const packageUrl = new URL(encodeURIComponent(packageName).replace(/^%40/, '@'), registryUrl_);
const authInfo = registryAuthToken(registryUrl_.toString(), {recursive: true});
const headers = {
accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
};
if (options.fullMetadata) {
delete headers.accept;
}
if (authInfo) {
headers.authorization = `${authInfo.type} ${authInfo.token}`;
}
const gotOptions = {
headers,
agent: {
http: httpAgent,
https: httpsAgent,
},
};
if (options.agent) {
gotOptions.agent = options.agent;
}
let data;
try {
data = await got(packageUrl, gotOptions).json();
} catch (error) {
if (error?.response?.statusCode === 404) {
throw new PackageNotFoundError(packageName);
}
throw error;
}
if (options.allVersions) {
return data;
}
let {version} = options;
const versionError = new VersionNotFoundError(packageName, version);
if (data['dist-tags'][version]) {
const time = data.time;
data = data.versions[data['dist-tags'][version]];
data.time = time;
} else if (version) {
if (!data.versions[version]) {
const versions = Object.keys(data.versions);
version = semver.maxSatisfying(versions, version);
if (!version) {
throw versionError;
}
}
const time = data.time;
data = data.versions[version];
data.time = time;
if (!data) {
throw versionError;
}
}
return data;
}
make-fetch-happen
make-fetch-happen is a Node.js Fetch client that adds an HTTP cache, retries, request pooling, and proxy support to minipass-fetch. Setting cachePath stores responses on disk and follows HTTP caching rules, including Cache-Control, ETag, and conditional requests. Retries follow HTTP semantics, and a cached copy can answer when the network fails. fetch.defaults returns a fetch function with preset options.
SuperAgent sends HTTP requests with a chained API that runs the same way in Node.js and in the browser. Methods such as .post, .send, and .set build the request, which goes out on .end with a callback or when awaited as a promise. An object passed to .send becomes a JSON request body. The browser build also loads from a script tag through jsDelivr or unpkg.
ofetch wraps the Fetch API with defaults for JSON and errors, and runs in Node.js, browsers, and workers. ofetch('/api/users') parses a JSON response on its own, and an object passed as body goes out as JSON with matching headers. A response with an error status throws a FetchError that carries the parsed error body. Failed requests retry once by default, except for POST, PUT, PATCH, and DELETE, which retry only when configured.
Downloads / mo
105.7M
Stars
5.4K
Last release
1.5.1
License
MIT
Limitations
No retries for writes.POST, PUT, PATCH, and DELETE requests don't retry unless retry is set.
In Node.js with no extra package, use the built-in fetch, which runs on Undici. For one API across the browser and Node.js with interceptors and instances, use Axios. For Node.js with retries and streams, use Got, and for Fetch with JSON parsing and retries in any runtime, use ofetch.
node-fetch brings the browser's Fetch API to Node.js. Node.js now ships a built-in fetch powered by Undici, so current Node.js versions can call fetch without a package. node-fetch adds Node streams for request and response bodies and options such as a response size limit.
Axios parses JSON responses, rejects the promise on an error status, and supports interceptors and preconfigured instances. Fetch is built into browsers and Node.js, returns a response whose body needs a separate json() call, and resolves even when the server returns an error status.
Axios has no retry option of its own, and the axios-retry package adds one. Got, ofetch, and SuperAgent retry failed requests without an extra package.
Pass timeout in milliseconds in the request config, or on an instance made with axios.create. Axios sets no timeout by default.
Got runs only in Node.js, retries failed requests by default, and offers a stream interface. Axios runs in browsers and Node.js with one API and needs the axios-retry package for retries.
For coding agents
Found your HTTP client library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.