MCPcopy Index your code
hub / github.com/anthropics/anthropic-sdk-typescript

github.com/anthropics/anthropic-sdk-typescript @sdk-v0.110.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release sdk-v0.110.0 ↗ · + Follow
2,006 symbols 4,451 edges 320 files 259 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
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 >= 4.9 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, open or upvote an issue.

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Interface 887
Function 522
Method 421
Class 176

Languages

TypeScript100%

Modules by API surface

src/resources/beta/messages/messages.ts223 symbols
src/resources/messages/messages.ts151 symbols
src/resources/beta/sessions/events.ts80 symbols
src/resources/beta/vaults/credentials.ts49 symbols
src/resources/beta/agents/agents.ts49 symbols
src/client.ts49 symbols
src/resources/beta/deployments.ts45 symbols
src/resources/beta/webhooks.ts41 symbols
src/resources/beta/sessions/sessions.ts41 symbols
src/lib/BetaMessageStream.ts40 symbols
src/core/pagination.ts40 symbols
src/lib/MessageStream.ts39 symbols

For agents

$ claude mcp add anthropic-sdk-typescript \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page