ky
Tiny and elegant HTTP client based on the Fetch API
The fetch API is great but verbose for common patterns: checking response.ok manually, parsing JSON, setting timeouts, and adding retry logic each require boilerplate. Axios solves this but adds 13KB and XMLHttpRequest for a browser-only app that already has fetch. Ky wraps fetch with the ergonomics you actually want in under 2KB.
Ky is fetch with sensible defaults: it throws on non-2xx responses, parses JSON automatically with .json(), and accepts an options object that extends the RequestInit interface. Hooks replace axios interceptors โ beforeRequest, afterResponse, and beforeRetry give you the same insertion points.
Install ky
npm install ky
import { } from 'ky';Use it when
Use Ky in browser-only or Deno applications where bundle size matters and you don't need Node.js compatibility. It's a direct replacement for axios in these contexts with a fraction of the footprint.
Skip it when
Ky doesn't support Node.js's older http module (though it works in Node 18+ with native fetch). For isomorphic code (same HTTP client in browser and Node), use axios or got. For React apps that need caching and state, React Query provides the better abstraction.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.