anthropics/anthropic-sdk-typescript

Access to Anthropic's safety-first language model APIs in TypeScript

2,111

stars

1,266

commits

TypeScript

primary language

Sep 10, 2026

updated

www.npmjs.com/package/@anthropic-ai/sdk

README

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-4-6',
});

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 MIT License. See the LICENSE file for details.

Contributors

(top 30 of 47)

stainless-bot

345 commits

RobertCraigie

109 commits

jspahrsummers

64 commits

anthropics/anthropic-sdk-typescript

Access to Anthropic's safety-first language model APIs in TypeScript

2,111

stars

1,266

commits

TypeScript

primary language

Sep 10, 2026

updated

www.npmjs.com/package/@anthropic-ai/sdk

README

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-4-6',
});

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 MIT License. See the LICENSE file for details.

Contributors

(top 30 of 47)

stainless-bot

345 commits

RobertCraigie

109 commits

jspahrsummers

64 commits

Languages

TypeScript

98.0%

JavaScript

1.3%