# Anthropic SDK — card for AI agents

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

Category: Model SDKs · npm package `@anthropic-ai/sdk` · latest version 1.3.0 (checked 2026-11-01)
Install: `npm install @anthropic-ai/sdk`
License: Apache-2.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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.

## Docs written for agents
- [llms.txt (index of the docs)](https://docs.anthropic.com/llms.txt)

## What it is
- The Anthropic SDK for TypeScript is the official client for the Claude API, published on npm as `@anthropic-ai/sdk`. The README says it serves "server-side TypeScript or JavaScript applications". The GitHub repository was created on 2023-01-30 and is Apache-2.0 licensed.
- You create an `Anthropic` client, which reads `ANTHROPIC_API_KEY` from the environment by default, and call methods such as `client.messages.create()`. The README lists support for Node.js 20 LTS or later, Deno, Bun, Cloudflare Workers, Vercel Edge Runtime, Nitro and Jest's node environment. Anthropic's platform docs describe extra SDK-side pieces: request middleware, a tool runner, client-side refusal fallback, OpenTelemetry tracing and MCP type helpers.
- Releases track the API closely. The latest listed release is sdk-v1.8.0, published 2026-11-10, and its features are new API fields.

## Caveats
- Browser use is off by default: The SDK will not run in a web browser unless you set `dangerouslyAllowBrowser` to `true`. 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 `"node"` environment. `"jsdom"` is not supported.
- Two Google Cloud clients: On Google Cloud, `AnthropicGoogleCloud` targets the Anthropic-managed offering and `AnthropicVertex` targets the Google-managed one. Calling api.anthropic.com with an API key uses neither offering.
- Refusals arrive as normal responses: The docs say safety classifiers on some models can decline a request. The decline comes back as a normal response, not an error, so code that only catches exceptions will miss it.
- Older versions stay MIT: The project moved from MIT to Apache-2.0. Versions released before the change, and third-party contributions merged before it, remain under the MIT License.

## Numbers (AgentGid data)
- Gid Score: 73.8 (#241 of all tools, 7 of 92 in its category)
- Used in 238 public projects set up for AI coding agents (3.8%)
- Downloads last week: 74,960,251 (as of 2026-11-24), +53.3% over 4 weeks
- GitHub stars: 2,185 (as of 2026-11-24)
- Last push: 2026-11-23

## Often used with
OpenAI 37.0%, Zod 60.1%, Express 33.6%, tsx 44.5%, TypeScript 84.0%, Model Context Protocol SDK (JavaScript) 34.9%

## Checked alternatives (same job)
- OpenAI: https://agentgid.com/tools/openai-npm/agent.md
- Google Generative AI: https://agentgid.com/tools/google-genai-npm/agent.md
- Ollama JavaScript Library: https://agentgid.com/tools/ollama-npm/agent.md
- Groq SDK: https://agentgid.com/tools/groq-sdk/agent.md
- Mistral AI: https://agentgid.com/tools/mistralai-mistralai/agent.md
- Replicate: https://agentgid.com/tools/replicate-npm/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/anthropic-ai/
- Homepage: https://github.com/anthropics/anthropic-sdk-typescript#readme
- Repository: https://github.com/anthropics/anthropic-sdk-typescript
- Source: https://github.com/anthropics/anthropic-sdk-typescript#readme
- Source: https://github.com/anthropics/anthropic-sdk-typescript
- Source: https://github.com/anthropics/anthropic-sdk-typescript/releases
- Source: https://docs.anthropic.com/llms.txt
- Source: https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview.md
- Source: https://platform.claude.com/docs/en/build-with-claude/overview.md

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
