New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@anthropic-ai/sdk

Package Overview
Dependencies
Maintainers
15
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anthropic-ai/sdk

The official TypeScript library for the Anthropic API

latest
Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
65M
24.52%
Maintainers
15
Weekly downloads
 
Created
Source

Claude SDK for TypeScript

NPM version

The Claude SDK for TypeScript provides access to the Claude API from server-side TypeScript or JavaScript applications.

Documentation

Full documentation is available at platform.claude.com/docs/en/api/sdks/typescript.

Installation

npm install @anthropic-ai/sdk

Getting started

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);

Requirements

TypeScript >= 5.0 is supported.

The following runtimes are supported:

  • Node.js 20 LTS or later (non-EOL) versions.
  • Deno v1.28.0 or higher.
  • Bun 1.0 or later.
  • Cloudflare Workers.
  • Vercel Edge Runtime.
  • Jest 28 or greater with the "node" environment ("jsdom" is not supported at this time).
  • Nitro v2.6 or greater.
  • Web browsers: disabled by default to avoid exposing your secret API credentials (see API key best practices). Enable browser support by explicitly setting dangerouslyAllowBrowser to true.

Note that React Native is not supported at this time.

If you are interested in other runtime environments, please open or upvote an issue.

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details. Versions released before the change from the MIT License, and third-party contributions merged before it, remain under the MIT License. See LICENSE-MIT.

FAQs

Package last updated on 02 Nov 2026

Related posts