Anthropic TypeScript SDK

The official TypeScript and JavaScript SDK for building on Anthropic's Claude API.

SDK
npm
v0.117.1
2,091stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
94/100Excellent
Development Activity100
Maintenance100
Community84
Maturity52
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
91/100Excellent
Architecture92
Code Quality90
Innovation93
Learning Curve88

The Anthropic TypeScript SDK is the official client library for the Claude API, giving server-side TypeScript and JavaScript applications a fully typed interface to Anthropic’s language models. It wraps the REST API with ergonomic resource methods for messages, streaming, token counting, batches, and model metadata, so you can go from an API key to a working request in a handful of lines.

Beyond the raw endpoints, the SDK ships higher-level helpers for streaming events, tool use, and structured outputs backed by Zod or JSON Schema, plus automatic retries, configurable timeouts, and pluggable middleware. It runs across Node.js, Deno, Bun, Cloudflare Workers, and Vercel Edge, and serves as the foundation for the Bedrock, Vertex, AWS, Google Cloud, and Foundry adapter packages in the same repository.

What You Get

  • A fully typed client covering the Messages, Models, Completions, and Batches endpoints of the Claude API.
  • Streaming helpers that surface incremental message, text, and thinking events with typed accessors.
  • Tool-use and structured-output helpers backed by Zod or JSON Schema for validated, typed responses.
  • Built-in resilience: automatic retries with backoff, configurable timeouts, and request middleware hooks.
  • Broad runtime support across Node.js, Deno, Bun, Cloudflare Workers, and Vercel Edge.

Common Use Cases

  • Calling Claude for chat, summarization, extraction, or classification from a Node.js backend.
  • Streaming model responses token-by-token into a web app or terminal UI.
  • Building tool-using agents that validate model output against Zod or JSON Schema.
  • Running high-volume asynchronous jobs through the Message Batches API.

Under The Hood

Architecture

The library is generated from Anthropic’s OpenAPI specification by Stainless and then extended with hand-written helpers. The entry point src/client.ts defines the Anthropic client, which composes a request pipeline (src/internal/request-options.ts, src/core/api-promise.ts), a credentials chain (src/lib/credentials/), platform detection (src/internal/detect-platform.ts), retry/backoff logic, and pluggable middleware (src/core/middleware.ts). Endpoints are modeled as resource classes under src/resources/ (for example messages/, models.ts, completions.ts, and the beta/ namespace), while streaming, pagination, and uploads live in dedicated modules (src/lib/MessageStream.ts, src/core/pagination.ts, src/core/uploads.ts). Higher-level ergonomics — tool toolsets, memory, and structured outputs — sit in src/helpers/ and src/tools/.

Tech Stack

Written almost entirely in TypeScript (~99% of the codebase), the runtime footprint is deliberately small: only standardwebhooks and json-schema-to-ts are hard dependencies, with zod as an optional peer dependency for schema-validated helpers. The build uses tsc-multi to emit CommonJS and ESM outputs plus Deno-compatible builds, and the project targets TypeScript 4.9+ and Node.js 20+. Tooling includes Jest with SWC for tests, ESLint 9, and Prettier.

Code Quality

The repository carries a substantial test suite — roughly 83 test files under tests/ covering client behavior, streaming, pagination, and helpers, exercised with nock for HTTP mocking. Generated code keeps naming and typing consistent across every endpoint, and hand-written helper modules follow the same conventions. Error handling is centralized through a typed error hierarchy (src/core/error.ts) that maps HTTP failures to specific exception classes, and releases are automated via release-please with a detailed changelog.

API Design

The public API is intentionally minimal and discoverable: instantiate new Anthropic({ apiKey }) and call resource methods like client.messages.create(...). Streaming is a first-class .stream() variant with typed event handlers, and tool use plus structured outputs are wrapped in Zod/JSON-Schema helpers that eliminate manual parsing boilerplate. Documentation is thorough — a README quickstart, a large api.md reference, a helpers.md guide, a MIGRATION.md, and 30-plus runnable examples — making the getting-started path short despite the breadth of capabilities.

Used by 54 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
TypeScript
83%
Apache 2.0

agentmemory

AI Agents

27,166

Persistent memory for AI coding agents — built on the iii engine, it works across Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, Codex CLI, and any MCP client, so agents stop needing everything re-explained every session.

View details
81
Repo Health
69
Technical
81
Dependency
Built with
TypeScript83%
Updated 2 days ago
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

64,914

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
68
Dependency
Built with
JavaScript95%
Updated today
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,872

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
95
Repo Health
82
Technical
66
Dependency
Built with
TypeScript100%
Updated yesterday
TypeScript
75%
GPL 3.0

Bramble

Password Manager · Security · Authentication

315

Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.

View details
73
Repo Health
84
Technical
72
Dependency
Built with
TypeScript75%
Updated today
TypeScript
99%
Other

byterover-cli

AI Agents · AI Code Assistants

4,941

A portable memory layer for AI coding agents — curate structured project knowledge into a version-controlled context tree that syncs across tools, machines, and teammates.

View details
77
Repo Health
83
Technical
71
Dependency
Built with
TypeScript99%
Updated 1 months ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search