Repolode
anthropics

anthropics/anthropic-sdk-typescript

Official TypeScript SDK for calling Anthropic's Claude API from server-side JavaScript and TypeScript applications.

Stars
2,147
Forks
427
Open issues
98
Last commit
15 hours ago

What is it?

This is the official TypeScript and JavaScript client library for Anthropic's Claude API. It wraps the HTTP API in a typed client so applications can send messages to Claude models, install it with npm, and receive responses without hand-writing requests.

The SDK covers streaming responses, structured outputs, tool helpers and a tool runner, with separate guides for browser and computer toolsets. It also reports each API call as an OpenTelemetry span when a tracer provider is registered, with options to change content capture and trace propagation.

It runs on Node.js 20 and later, Deno, Bun, Cloudflare Workers, Vercel Edge Runtime, Nitro and Jest's node environment. Browser use is disabled by default to avoid exposing API keys and must be enabled explicitly. React Native is not supported.

Key features

  • 01Typed client for the Claude Messages API with an npm install.
  • 02Streaming responses, structured outputs and tool helpers.
  • 03Tool runner for executing tool calls within a conversation.
  • 04OpenTelemetry spans for each API call, with configurable content capture.
  • 05Runs on Node.js, Deno, Bun, Cloudflare Workers and Vercel Edge Runtime.

Use cases

  • Adding Claude-powered chat or text generation to a Node.js backend.
  • Building serverless or edge functions that call Claude.
  • Implementing tool-using agents with the built-in tool runner.
  • Tracing LLM calls in an application that already uses OpenTelemetry.

Quick start

  1. 1

    Install the SDK from npm

    npm install @anthropic-ai/sdk
  2. 2

    Set your ANTHROPIC_API_KEY environment variable

  3. 3

    Create a client and call client.messages.create in your app

Things to know

  • Calling the Claude API requires an Anthropic API key.
  • Browser use is disabled by default to protect API credentials and must be enabled explicitly.
  • React Native is not supported at this time.

Topics

FAQ

What is anthropic-sdk-typescript?
Official TypeScript SDK for calling Anthropic's Claude API from server-side JavaScript and TypeScript applications. This is the official TypeScript and JavaScript client library for Anthropic's Claude API. It wraps the HTTP API in a typed client so applications can send messages to Claude models, install it with npm, and receive responses without hand-writing requests.
Is anthropic-sdk-typescript free to use? What license does it have?
anthropic-sdk-typescript is open source under the MIT license. Check the license terms before using it in commercial products.
Is anthropic-sdk-typescript still maintained?
Actively maintained. The last commit to anthropic-sdk-typescript was on Oct 20, 2026.
What can I use anthropic-sdk-typescript for?
Adding Claude-powered chat or text generation to a Node.js backend. Building serverless or edge functions that call Claude. Implementing tool-using agents with the built-in tool runner. Tracing LLM calls in an application that already uses OpenTelemetry.
How do I install anthropic-sdk-typescript?
Install the SDK from npm: npm install @anthropic-ai/sdk Set your ANTHROPIC_API_KEY environment variable Create a client and call client.messages.create in your app
Where can I get anthropic-sdk-typescript?
The source code and installation instructions are on GitHub: https://github.com/anthropics/anthropic-sdk-typescript

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects