Skip to content
PluginStats

@tanstack/ai-anthropic weekly downloads statistics

By tanstack (53 listings) · npm · AI SDKs

Anthropic Claude adapter for TanStack AI chat, tool calling, thinking, and structured outputs.

View on npm Fresh · Dec 6, 2026

@tanstack/ai-anthropic has 399,916 recorded weekly downloads on npm, an increase of 9.2% over the past 30 days, ranking #430 of 3,247 tracked listings.

Weekly downloads
399,916
Official API · Dec 5, 2026
7-day growth
+14.8%
+51.4K weekly downloads
30-day growth
+9.2%
+33.9K weekly downloads
90-day growth
+416%
+322.5K weekly downloads
Rank
#430
▲ 2 in 7 days

About @tanstack/ai-anthropic

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/api/readme/ai.png?theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/api/readme/ai.png" /> <img src="https://tanstack.com/api/readme/ai.png" alt="TanStack AI" width="900" /> </picture> </div> <br />

@tanstack/ai-anthropic

Anthropic Claude adapter for TanStack AI chat, tool calling, thinking, and structured outputs

Installation

npm install @tanstack/ai-anthropic
# or
pnpm add @tanstack/ai-anthropic
# or
yarn add @tanstack/ai-anthropic

Setup

Set your API key as an environment variable:

export ANTHROPIC_API_KEY="sk-ant-..."

Usage

Text/Chat Adapter
import { chat } from '@tanstack/ai'
import { anthropicText } from '@tanstack/ai-anthropic'

const stream = chat({
  adapter: anthropicText('claude-sonnet-4-6'),
  messages: [{ role: 'user', content: 'Hello!' }],
  threadId: 'thread-1',
})
With Explicit API Key
import { createAnthropicChat } from '@tanstack/ai-anthropic'

const adapter = createAnthropicChat(
  'claude-sonnet-4-6',
  process.env.ANTHROPIC_API_KEY!,
  {
    baseURL: 'https://api.anthropic.com', // optional, for custom endpoints
  },
)
With Tools
import { chat, toServerSentEventsResponse, toolDefinition } from '@tanstack/ai'
import { anthropicText } from '@tanstack/ai-anthropic'
import { z } from 'zod'

const searchDatabase = toolDefinition({
  name: 'search_database',
  description: 'Search the database',
  inputSchema: z.object({ query: z.string() }),
}).server(async ({ query }) => {
  return { results: [] }
})

export async function POST(request: Request) {
  const { messages, threadId } = await request.json()

  const stream = chat({
    adapter: anthropicText('claude-sonnet-4-6'),
    messages,
    threadId,
    tools: [searchDatabase],
  })

  return toServerSentEventsResponse(stream)
}
Thinking

Set how hard Claude thinks with reasoning on chat(). The adapter sends the right thinking fields for the model:

import { chat } from '@tanstack/ai'
import { anthropicText } from '@tanstack/ai-anthropic'

const stream = chat({
  adapter: anthropicText('claude-sonnet-5'),
  messages: [{ role: 'user', content: 'Plan a database migration.' }],
  threadId: 'thread-1',
  reasoning: 'xhigh',
  modelOptions: { max_tokens: 64_000 },
})

Models that think with a token budget, such as Claude Haiku 4.5, also take reasoning: { level: 'high', budgetTokens: 8000 }. The adapter raises max_tokens when it is below the budget. The types take only the levels and options of the selected model. See the docs for the levels of each model.

Prompt Caching

Mark a content part with cache_control to cache it:

import { chat } from '@tanstack/ai'
import { anthropicText } from '@tanstack/ai-anthropic'

const stream = chat({
  adapter: anthropicText('claude-sonnet-4-6'),
  messages: [
    {
      role: 'user',
      content: [
        {
          type: 'text',
          content: 'What is the capital of France?',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
      ],
    },
  ],
  threadId: 'thread-1',
})
Summarization
import { summarize } from '@tanstack/ai'
import { anthropicSummarize } from '@tanstack/ai-anthropic'

const result = await summarize({
  adapter: anthropicSummarize('claude-sonnet-4-6'),
  threadId: 'thread-1',
  text: 'Your long text to summarize...',
  maxLength: 100,
  style: 'concise', // "concise" | "bullet-points" | "paragraph"
})

console.log(result.summary)
Provider Tools

Anthropic's native tools live on @tanstack/ai-anthropic/tools and go into chat({ tools }) alongside your own: webSearchTool, webFetchTool, codeExecutionTool, computerUseTool, bashTool, textEditorTool, memoryTool, and customTool.

import { chat } from '@tanstack/ai'
import { anthropicText } from '@tanstack/ai-anthropic'
import { webSearchTool } from '@tanstack/ai-anthropic/tools'

const stream = chat({
  adapter: anthropicText('claude-opus-4-7'),
  messages: [{ role: 'user', content: "What's new in AI this week?" }],
  threadId: 'thread-1',
  tools: [
    webSearchTool({
      name: 'web_search',
      type: 'web_search_20250305',
      max_uses: 2,
    }),
  ],
})
Claude on Vertex AI

Install @anthropic-ai/vertex-sdk next to this package and import from @tanstack/ai-anthropic/vertex:

import { chat } from '@tanstack/ai'
import { anthropicVertexText } from '@tanstack/ai-anthropic/vertex'

const stream = chat({
  adapter: anthropicVertexText('claude-sonnet-5', {
    project: 'my-project',
    location: 'europe-west1',
  }),
  messages: [{ role: 'user', content: 'Hello!' }],
  threadId: 'thread-1',
})

location is required (on the factory or via GOOGLE_CLOUD_LOCATION, GOOGLE_VERTEX_LOCATION, or CLOUD_ML_REGION); project can come from Application Default Credentials. Only the Claude models in the Vertex catalog are accepted.

Features

  • ✅ Streaming chat
  • ✅ Function/tool calling and Anthropic's native provider tools
  • ✅ Extended and adaptive thinking
  • ✅ Structured output
  • ✅ Prompt caching
  • ✅ Summarization (anthropicSummarize)
  • ✅ Claude on Vertex AI (@tanstack/ai-anthropic/vertex)

Documentation

  • Anthropic adapter: configuration, per-model thinking rules, every provider tool, and the API reference
  • Provider Tools: the concept, comparison matrix, and which models support which tools

License

MIT

Description from the npm listing.

  • ai
  • ai-sdk
  • typescript
  • tanstack
  • anthropic
  • claude
  • adapter
  • chat
  • tool-calling
  • structured-outputs
  • thinking

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@tanstack/ai-anthropic weekly downloads on npm, last 90 days: 399,916 weekly downloads as of Dec 5, 2026, +416% over 90 days.@tanstack/ai-anthropicWeekly downloads on npm · Last 90 days399,916downloads / week+416% over 90 days0100K200K300K400K500KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@tanstack/ai-anthropic weekly downloads on npm, last 90 days: 399,916 weekly downloads as of Dec 5, 2026, +416% over 90 days.

7/30/90-day growth

@tanstack/ai-anthropic weekly downloads growth on npm: +14.8% over 7 days, +9.2% over 30 days, +416% over 90 days.@tanstack/ai-anthropicWeekly downloads growth on npm399,916downloads / week now7-day growth+51,438 weekly downloads+14.8%30-day growth+33,856 weekly downloads+9.2%90-day growth+322,457 weekly downloads+416%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@tanstack/ai-anthropic weekly downloads growth on npm: +14.8% over 7 days, +9.2% over 30 days, +416% over 90 days.

Ranking history

@tanstack/ai-anthropic npm ranking history: currently #430 (by weekly downloads).@tanstack/ai-anthropicnpm ranking · by weekly downloads · Last 90 days#430current rank#410#420#430#440#450#460#470Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
@tanstack/ai-anthropic npm ranking history: currently #430 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 22, #10 (overall #430)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs378 listings · 19 pages · page 1, #20 (overall #20)
AI SDKs: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for @tanstack/ai-anthropic
Date (UTC)Weekly downloadsChange vs. previous
399,916-3K
402,932+6.4K
396,552+231
396,321+19.6K
376,716+22.1K
354,607-1.4K
355,969+7.5K
348,478+11.3K
337,174-781
337,955+14.3K
323,683-3.2K
326,915+5.7K
321,241-10.3K
331,563—

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@tanstack/ai-anthropic. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.