Skip to content

Installation ​

bash
npm install @fifthrevision/axle
bash
pnpm add @fifthrevision/axle
bash
yarn add @fifthrevision/axle

Zod is a peer dependency (^4.2.0), so schemas work as long as your project lists it — which it already does if you define tools:

typescript
import * as z from "zod";
bash
npm install @fifthrevision/axle zod

What you'll need ​

  • Node.js 22 or newer. Axle uses Promise.withResolvers and AbortSignal.any, which landed in 22. CI builds and tests on Node 24.
  • An ESM project. The package ships "type": "module" with no CommonJS build, so require("@fifthrevision/axle") won't work.
  • An API key for Anthropic, OpenAI, or Gemini — or a local OpenAI-compatible endpoint like Ollama or vLLM, which needs no key at all.

The two entry points ​

Most of the time you'll only use the first one.

ImportWhat's in it
@fifthrevision/axleEverything: Agent, Instruct, providers, stream(), generate(), tools, MCP, errors.
@fifthrevision/axle/uiThe render and client surface: the Turn, TurnEvent, Citation and Stats types, plus the runtime pieces a UI needs — Transcript, computeCost, the isCall / isActionOf / isTimeoutReason narrowing helpers, renderTerminalMarkdown, Instruct, and the RemoteAgent client with httpTransport. Import this in UI code so you don't pull three provider SDKs into your browser bundle: it depends on chalk, marked and zod, and nothing else.

API keys ​

Axle never reads environment variables behind your back — you hand the key to the provider factory yourself. Load it however you like:

typescript
import { anthropic, openai, gemini, chatCompletions } from "@fifthrevision/axle";

const provider = anthropic(process.env.ANTHROPIC_API_KEY!);

Running against a local model? No key needed:

typescript
const local = chatCompletions({ baseUrl: "http://localhost:11434/v1" });

Providers & models covers the full list, plus retry and timeout options.

Next ​