Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Claude Code Review

on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"

jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

50 changes: 50 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'

# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'

8 changes: 4 additions & 4 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
".": "0.71.2",
"packages/vertex-sdk": "0.14.1",
"packages/bedrock-sdk": "0.26.1",
"packages/foundry-sdk": "0.2.1"
".": "0.71.3",
"packages/vertex-sdk": "0.14.2",
"packages/bedrock-sdk": "0.26.2",
"packages/foundry-sdk": "0.2.2"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-a49e89deec4e00d1da490808099d66e2001531b12d8666a7f5d0b496f760440d.yml
openapi_spec_hash: c93ef3808c58e233b01966ff154f31ce
config_hash: a5d8cd02f9a686d4e0baa7ba652e3e55
config_hash: 269cb3d4ee1981862834b04f1511263d
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 0.71.3 (2026-01-04)

Full Changelog: [sdk-v0.71.2...sdk-v0.71.3](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.71.2...sdk-v0.71.3)

### Bug Fixes

* **mcp:** correct code tool API endpoint ([ba21721](https://github.com/anthropics/anthropic-sdk-typescript/commit/ba21721557b96dd0fd89e2b3459aed7e95dd733a))
* **mcp:** return correct lines on typescript errors ([0b98943](https://github.com/anthropics/anthropic-sdk-typescript/commit/0b98943430f7d6c5c85047d9d676efbf2b6b8052))


### Chores

* **ci:** Add Claude Code GitHub Workflow ([#612](https://github.com/anthropics/anthropic-sdk-typescript/issues/612)) ([0a6c372](https://github.com/anthropics/anthropic-sdk-typescript/commit/0a6c372e5c9524aef125c854a0f39680d82be642))
* **internal:** codegen related update ([a7fbcd8](https://github.com/anthropics/anthropic-sdk-typescript/commit/a7fbcd8733d554a7682d612ab0cf4873a4d05265))
* **internal:** codegen related update ([2a6e2cd](https://github.com/anthropics/anthropic-sdk-typescript/commit/2a6e2cd068a6c5846054e4d0d0103be9750b1f57))
* **internal:** version bump ([f3e89e8](https://github.com/anthropics/anthropic-sdk-typescript/commit/f3e89e84a2c807d7ded1738a9a9090710cb6605e))
* **tests:** remove extraneous header test ([fd388c6](https://github.com/anthropics/anthropic-sdk-typescript/commit/fd388c6a113d655409659aff82dd3336b946f8b4))


### Documentation

* update README with Claude branding ([#611](https://github.com/anthropics/anthropic-sdk-typescript/issues/611)) ([203223a](https://github.com/anthropics/anthropic-sdk-typescript/commit/203223ac1720b1387b37dc83d6e36a89c2af9179))

## 0.71.2 (2025-12-05)

Full Changelog: [sdk-v0.71.1...sdk-v0.71.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.71.1...sdk-v0.71.2)
Expand Down
81 changes: 37 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Anthropic TypeScript API Library
# <img src=".github/logo.svg" alt="" width="32"> Claude SDK for TypeScript

[![NPM version](<https://img.shields.io/npm/v/@anthropic-ai/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@anthropic-ai/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@anthropic-ai/sdk)

This library provides convenient access to the Anthropic REST API from server-side TypeScript or JavaScript.
This library provides convenient access to the Claude API from TypeScript or JavaScript.

The REST API documentation can be found on [docs.anthropic.com](https://docs.anthropic.com/claude/reference/). The full API of this library can be found in [api.md](api.md).
The full API documentation can be found at [platform.claude.com/docs](https://platform.claude.com/docs/en/api/typescript/messages/create) or in [api.md](api.md).

## Installation

Expand All @@ -14,8 +14,6 @@ npm install @anthropic-ai/sdk

## Usage

The full API of this library can be found in [api.md](api.md).

<!-- prettier-ignore -->
```js
import Anthropic from '@anthropic-ai/sdk';
Expand Down Expand Up @@ -124,42 +122,9 @@ Streaming with `client.messages.stream(...)` exposes [various helpers for your c

Alternatively, you can use `client.messages.create({ ..., stream: true })` which only returns an async iterable of the events in the stream and thus uses less memory (it does not build up a final message object for you).

## Tool Helpers

This SDK provides helpers for making it easy to create and run tools in the Messages API. You can use Zod schemas or JSON Schemas to describe the input to a tool. You can then run those tools using the `client.messages.toolRunner()` method. This method will handle passing the inputs generated by the chosen model into the right tool and passing the result back to the model.

```ts
import Anthropic from '@anthropic-ai/sdk';

import { betaZodTool } from '@anthropic-ai/sdk/helpers/beta/zod';
import { z } from 'zod';

const anthropic = new Anthropic();

const weatherTool = betaZodTool({
name: 'get_weather',
inputSchema: z.object({
location: z.string(),
}),
description: 'Get the current weather in a given location',
run: (input) => {
return `The weather in ${input.location} is foggy and 60°F`;
},
});

const finalMessage = await anthropic.beta.messages.toolRunner({
model: 'claude-3-5-sonnet-20241022',
max_tokens: 1000,
messages: [{ role: 'user', content: 'What is the weather in San Francisco?' }],
tools: [weatherTool],
});
```

You can find more details on how to use these tool helpers [here](helpers.md#tool-helpers).

## Message Batches

This SDK provides support for the [Message Batches API](https://docs.anthropic.com/en/docs/build-with-claude/message-batches) under the `client.messages.batches` namespace.
This SDK provides support for the [Message Batches API](https://platform.claude.com/docs/en/api/typescript/messages/batches/create) under the `client.messages.batches` namespace.

### Creating a batch

Expand Down Expand Up @@ -203,7 +168,35 @@ for await (const entry of results) {

## Tool use

This SDK provides support for tool use, aka function calling. More details can be found in [the documentation](https://docs.anthropic.com/claude/docs/tool-use).
This SDK provides support for tool use, aka function calling. More details can be found in [the documentation](https://platform.claude.com/docs/en/api/tool-use).
The SDK provides helpers for making it easy to create and run tools. You can use Zod schemas or JSON Schemas to describe the input to a tool. You can then run those tools using the `client.messages.toolRunner()` method. This method will handle passing the inputs generated by the chosen model into the right tool and passing the result back to the model.

```ts
import Anthropic from '@anthropic-ai/sdk';

import { betaZodTool } from '@anthropic-ai/sdk/helpers/beta/zod';
import { z } from 'zod';

const anthropic = new Anthropic();

const weatherTool = betaZodTool({
name: 'get_weather',
inputSchema: z.object({
location: z.string(),
}),
description: 'Get the current weather in a given location',
run: (input) => {
return `The weather in ${input.location} is foggy and 60°F`;
},
});

const finalMessage = await anthropic.beta.messages.toolRunner({
model: 'claude-3-5-sonnet-20241022',
max_tokens: 1000,
messages: [{ role: 'user', content: 'What is the weather in San Francisco?' }],
tools: [weatherTool],
});
```

## AWS Bedrock

Expand Down Expand Up @@ -294,7 +287,7 @@ Error codes are as follows:

## Request IDs

> For more information on debugging requests, see [these docs](https://docs.anthropic.com/en/api/errors#request-id)
> For more information on debugging requests, see [these docs](https://platform.claude.com/docs/en/api/errors#request-id)

All object responses in the SDK provide a `_request_id` property which is added from the `request-id` response header so that you can quickly log failing requests and report them back to Anthropic.

Expand Down Expand Up @@ -381,7 +374,7 @@ This can be [overriden](#configuring-an-https-agent-eg-for-proxies) by configuri

## Auto-pagination

List methods in the Anthropic API are paginated.
List methods in the Claude API are paginated.
You can use the `for await … of` syntax to iterate through items across all pages:

```ts
Expand Down Expand Up @@ -645,9 +638,9 @@ const client = new Anthropic({

### Beta Features

We introduce beta features before they are generally available to get early feedback and test new functionality. You can check the availability of all of Claude's capabilities and tools [here](https://docs.anthropic.com/en/docs/build-with-claude/overview).
We introduce beta features before they are generally available to get early feedback and test new functionality. You can check the availability of all of Claude's capabilities and tools [here](https://platform.claude.com/docs/en/api/overview).

You can access most beta API features through the beta property of the client. To enable a particular beta feature, you need to add the appropriate [beta header](https://docs.anthropic.com/en/api/beta-headers) to the `betas` field when creating a message.
You can access most beta API features through the beta property of the client. To enable a particular beta feature, you need to add the appropriate [beta header](https://platform.claude.com/docs/en/api/beta-headers) to the `betas` field when creating a message.

For example, to use code execution:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anthropic-ai/sdk",
"version": "0.71.2",
"version": "0.71.3",
"description": "The official TypeScript library for the Anthropic API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
13 changes: 13 additions & 0 deletions packages/bedrock-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.26.2 (2026-01-04)

Full Changelog: [bedrock-sdk-v0.26.1...bedrock-sdk-v0.26.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/bedrock-sdk-v0.26.1...bedrock-sdk-v0.26.2)

### Chores

* **internal:** version bump ([f3e89e8](https://github.com/anthropics/anthropic-sdk-typescript/commit/f3e89e84a2c807d7ded1738a9a9090710cb6605e))


### Documentation

* update README with Claude branding ([#611](https://github.com/anthropics/anthropic-sdk-typescript/issues/611)) ([203223a](https://github.com/anthropics/anthropic-sdk-typescript/commit/203223ac1720b1387b37dc83d6e36a89c2af9179))

## 0.26.1 (2025-11-24)

Full Changelog: [bedrock-sdk-v0.26.0...bedrock-sdk-v0.26.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/bedrock-sdk-v0.26.0...bedrock-sdk-v0.26.1)
Expand Down
10 changes: 5 additions & 5 deletions packages/bedrock-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Anthropic Bedrock TypeScript API Library
# <img src=".github/logo.svg" alt="" width="32"> Claude SDK for AWS Bedrock

[![NPM version](https://img.shields.io/npm/v/@anthropic-ai/bedrock-sdk.svg)](https://npmjs.org/package/@anthropic-ai/bedrock-sdk)
[![NPM version](https://img.shields.io/npm/v/@anthropic-ai/bedrock-sdk.svg?color=blue)](https://npmjs.org/package/@anthropic-ai/bedrock-sdk)

This library provides convenient access to the Anthropic Bedrock API.
This library provides convenient access to the Claude API via AWS Bedrock. See the [documentation](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock) for more details.

For the non-Bedrock Anthropic API at api.anthropic.com, see [`@anthropic-ai/sdk`](https://github.com/anthropics/anthropic-sdk-typescript).
For the direct Claude API at api.anthropic.com, see [`@anthropic-ai/sdk`](https://github.com/anthropics/anthropic-sdk-typescript).

## Installation

Expand Down Expand Up @@ -66,7 +66,7 @@ const client = new AnthropicBedrock({
});
```

For more details on how to use the SDK, see the [README.md for the main Anthropic SDK](https://github.com/anthropics/anthropic-sdk-typescript/tree/main#anthropic-typescript-api-library) which this library extends.
For more details on how to use the SDK, see the [README.md for the main Claude SDK](https://github.com/anthropics/anthropic-sdk-typescript/tree/main#readme) which this library extends.

## Requirements

Expand Down
4 changes: 4 additions & 0 deletions packages/bedrock-sdk/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ rm -rf dist; mkdir dist
# Copy src to dist/src and build from dist/src into dist, so that
# the source map for index.js.map will refer to ./src/index.ts etc
cp -rp src README.md dist
if [ -d "../../.github" ]; then
mkdir -p dist/.github
cp -p ../../.github/logo.svg dist/.github/ 2>/dev/null || true
fi

for file in LICENSE; do
if [ -e "../../${file}" ]; then cp "../../${file}" dist; fi
Expand Down
2 changes: 1 addition & 1 deletion packages/bedrock-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anthropic-ai/bedrock-sdk",
"version": "0.26.1",
"version": "0.26.2",
"description": "The official TypeScript library for the Anthropic Bedrock API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
13 changes: 13 additions & 0 deletions packages/foundry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.2.2 (2026-01-04)

Full Changelog: [foundry-sdk-v0.2.1...foundry-sdk-v0.2.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/foundry-sdk-v0.2.1...foundry-sdk-v0.2.2)

### Chores

* **internal:** version bump ([f3e89e8](https://github.com/anthropics/anthropic-sdk-typescript/commit/f3e89e84a2c807d7ded1738a9a9090710cb6605e))


### Documentation

* update README with Claude branding ([#611](https://github.com/anthropics/anthropic-sdk-typescript/issues/611)) ([203223a](https://github.com/anthropics/anthropic-sdk-typescript/commit/203223ac1720b1387b37dc83d6e36a89c2af9179))

## 0.2.1 (2025-11-20)

Full Changelog: [foundry-sdk-v0.2.0...foundry-sdk-v0.2.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/foundry-sdk-v0.2.0...foundry-sdk-v0.2.1)
Expand Down
9 changes: 6 additions & 3 deletions packages/foundry-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Anthropic Foundry
# <img src=".github/logo.svg" alt="" width="32"> Claude SDK for Microsoft Foundry

To use this library with Foundry, use the `AnthropicFoundry`
class instead of the `Anthropic` class.
[![NPM version](https://img.shields.io/npm/v/@anthropic-ai/foundry-sdk.svg?color=blue)](https://npmjs.org/package/@anthropic-ai/foundry-sdk)

This library provides convenient access to the Claude API via Microsoft Azure AI Foundry. See the [documentation](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry) for more details.

For the direct Claude API at api.anthropic.com, see [`@anthropic-ai/sdk`](https://github.com/anthropics/anthropic-sdk-typescript).

## Installation

Expand Down
Loading
Loading