Socket
Book a DemoInstallSign in
Socket

@tanstack/ai-react-ui

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/ai-react-ui

Headless React components for building AI chat interfaces

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
4
Created
Source

Become a Sponsor!

TanStack AI

A powerful, type-safe AI SDK for building AI-powered applications.

  • Provider-agnostic adapters (OpenAI, Anthropic, Gemini, Ollama, etc.)
  • Tree-shakeable adapters - Import only what you need for smaller bundles
  • Multimodal content support - Send images, audio, video, and documents
  • Image generation - Generate images with OpenAI DALL-E/GPT-Image and Gemini Imagen
  • Chat completion, streaming, and agent loop strategies
  • Headless chat state management with adapters (SSE, HTTP stream, custom)
  • Isomorphic type-safe tools with server/client execution
  • Enhanced integration with TanStack Start - Share implementations between AI tools and server functions

Read the docs →

Tree-Shakeable Adapters

Import only the functionality you need for smaller bundle sizes:

// Only chat functionality - no summarization code bundled
import { openaiText } from '@tanstack/ai-openai/adapters'
import { generate } from '@tanstack/ai'

const textAdapter = openaiText()

const result = generate({
  adapter: textAdapter,
  model: 'gpt-4o',
  messages: [{ role: 'user', content: [{ type: 'text', content: 'Hello!' }] }],
})

for await (const chunk of result) {
  console.log(chunk)
}

Available adapters: openaiText, openaiEmbed, openaiSummarize, anthropicText, geminiText, ollamaText, and more.

Bonus: TanStack Start Integration

TanStack AI works with any framework (Next.js, Express, Remix, etc.).

With TanStack Start, you get a bonus: share implementations between AI tools and server functions with createServerFnTool:

import { createServerFnTool } from '@tanstack/ai-react'

// Define once, get AI tool AND server function (TanStack Start only)
const getProducts = createServerFnTool({
  name: 'getProducts',
  inputSchema: z.object({ query: z.string() }),
  execute: async ({ query }) => db.products.search(query),
})

// Use in AI chat
chat({ tools: [getProducts.server] })

// Call directly from components (no API endpoint needed!)
const products = await getProducts.serverFn({ query: 'laptop' })

No duplicate logic, full type safety, automatic validation. The serverFn feature requires TanStack Start. See docs for details.

Get Involved

Partners

CodeRabbit Cloudflare
AI & you?

We're looking for TanStack AI Partners to join our mission! Partner with us to push the boundaries of TanStack AI and build amazing things together.

LET'S CHAT

Explore the TanStack Ecosystem

… and more at TanStack.com »

Keywords

tanstack

FAQs

Package last updated on 22 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts