Installation
bash
npm install @fifthrevision/axlebash
pnpm add @fifthrevision/axlebash
yarn add @fifthrevision/axleZod 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 zodWhat you'll need
- Node.js 22 or newer. Axle uses
Promise.withResolversandAbortSignal.any, which landed in 22. CI builds and tests on Node 24. - An ESM project. The package ships
"type": "module"with no CommonJS build, sorequire("@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.
| Import | What's in it |
|---|---|
@fifthrevision/axle | Everything: Agent, Instruct, providers, stream(), generate(), tools, MCP, errors. |
@fifthrevision/axle/ui | The 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
- Quick Start — a working agent in a few lines.
- Anatomy of a send — the model behind the API.