Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Anthropic SDK

Official TypeScript SDK for calling Claude API and building agent applications.

Model SDKsNPM

GitHubWebsiteIts AgentGid profile

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Anthropic SDK does

This is Anthropic's own TypeScript client for the Claude API. It is built for server-side code across many JavaScript runtimes, and it refuses to run in a browser unless you set a flag literally named <code>dangerouslyAllowBrowser</code>.

Anthropic SDK popularity

74 / 100
Gid Score, #241 overall
75M
downloads a week, npm
2,185
GitHub stars
238
agent projects use it
Anthropic SDK: downloads per weeknpm, @anthropic-ai/sdk 74,960,251
Anthropic SDK: GitHub starsanthropics/anthropic-sdk-typescript 2,185

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Anthropic SDK is used

  • Anthropic SDK is a dependency in 238 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (4.9% of the 4,867 JavaScript/TypeScript ones), #4 of 92 in model sdks.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,035; those are left out of every share on this page.
  • The most used alternative in our scan is OpenAI (286 projects).
  • Projects that use it most often also use OpenAI (37.0%), Zod (60.1%), Express (33.6%).
  • It is more common in projects set up for OpenClaw (9.0%) than for GitHub Copilot (2.6%).

By coding agent

189 projects, 5.8%
81 projects, 3.3%
79 projects, 2.6%
30 projects, 9.0%
20 projects, 4.2%
19 projects, 6.8%
18 projects, 3.8%
11 projects, 3.2%

Often used with

In 37.0% of its projects
In 60.1% of its projects
In 33.6% of its projects
In 44.5% of its projects
In 84.0% of its projects
In 43.3% of its projects
In 24.8% of its projects

Anthropic SDK in practice

Strengths

Runs on server and edge runtimes

The README lists Node.js 20 LTS or later, Deno v1.28.0 or higher, Bun 1.0 or later, Cloudflare Workers, Vercel Edge Runtime and Nitro v2.6 or greater as supported.

Hooks around every request

The platform docs describe SDK middleware that runs your code before each request and after each response. They also describe a client-side fallback middleware that retries refused requests on other models you name.

Tracing built into the client

The docs say the Claude SDK emits OpenTelemetry spans in your application for each request and for each tool its tool runner runs.

Browser and desktop toolsets

According to the docs, the TypeScript SDK includes classes that connect Claude's browser use or computer use tool to a browser or desktop you provide.

Watch out for

Browser use is off by default

The SDK will not run in a web browser unless you set <code>dangerouslyAllowBrowser</code> to <code>true</code>. The README says this default exists to avoid exposing secret API credentials. React Native is not supported.

Jest needs the node environment

The README says Jest 28 or greater is supported only with the <code>"node"</code> environment. <code>"jsdom"</code> is not supported.

Two Google Cloud clients

On Google Cloud, <code>AnthropicGoogleCloud</code> targets the Anthropic-managed offering and <code>AnthropicVertex</code> targets the Google-managed one. Calling api.anthropic.com with an API key uses neither offering.

Send a first message

import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({
  apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted
});

const message = await client.messages.create({
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello, Claude' }],
  model: 'claude-opus-5-5',
});

console.log(message.content);

More about Anthropic SDK

Head to head
Packages around it
  • @anthropic-ai/claude-agent-sdk: Claude Agent SDK
  • @anthropic-ai/sandbox-runtime: Sandbox runtime
  • @anthropic-ai/mcpb: MCP bundles
  • @anthropic-ai/vertex-sdk: Vertex AI client
  • @anthropic-ai/claude-code: Claude Code CLI
  • @anthropic-ai/bedrock-sdk: Bedrock client
More in Model SDKs

Alternatives

Anthropic SDK This page

Apache-2.0Gid 7475M/wk

OpenAI

Official TypeScript SDK for accessing OpenAI APIs including GPT and embeddings.

Apache-2.0Gid 8162.5M/wk

Google Generative AI

Official SDK for Google Gemini API to build AI-powered applications.

Apache-2.0Gid 6934.2M/wk

Ollama JavaScript Library

Official JavaScript client library for Ollama to run and interact with local language models.

MITGid 571.3M/wk

Groq SDK

Official TypeScript SDK for calling Groq's fast language models API.

Apache-2.0Gid 471.2M/wk

Mistral AI

Official TypeScript SDK for calling Mistral's language models and APIs.

Apache-2.0Gid 456.7M/wk

Replicate

JavaScript client library for calling Replicate's AI model API.

Apache-2.0Gid 41713K/wk

Compare Anthropic SDK with another tool

Get started

Install it.

npm install @anthropic-ai/sdk

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Anthropic SDK
- Keep the client on the server. Read the key from `process.env['ANTHROPIC_API_KEY']`, which the client uses by default.
- Do not set `dangerouslyAllowBrowser: true` unless the user explicitly accepts exposing the API key in a browser. Do not target React Native.
- Assume TypeScript >= 5.0 and Node.js 20 LTS or later. Deno, Bun, Cloudflare Workers, Vercel Edge Runtime and Nitro are also supported.
- Run Jest tests that touch the SDK in the `"node"` environment, not `"jsdom"`.
- On Google Cloud, use `AnthropicGoogleCloud` for the Anthropic-managed offering and `AnthropicVertex` for the Google-managed one. Do not mix them.
- Treat refusals as normal responses. Check `stop_reason` for `"refusal"` instead of relying only on caught errors.
- Check current SDK versions at https://platform.claude.com/docs/sdk-versions.json, and query the docs MCP server at https://platform.claude.com/docs/mcp when unsure of an API.