Skip to content

Latest commit

 

History

History
132 lines (93 loc) · 2.64 KB

File metadata and controls

132 lines (93 loc) · 2.64 KB
title Installation
id installation
order 2

Install TanStack AI along with a framework integration and an adapter for your preferred LLM provider.

Core

Every project needs the core package:

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

React

npm install @tanstack/ai-react

The React integration provides the useChat hook for managing chat state. See the @tanstack/ai-react API docs for full details.

import { useChat, fetchServerSentEvents } from "@tanstack/ai-react";

function Chat() {
  const { messages, sendMessage } = useChat({
    connection: fetchServerSentEvents("/api/chat"),
  });
  // ...
}

Solid

npm install @tanstack/ai-solid

The Solid integration provides the useChat primitive for managing chat state. See the @tanstack/ai-solid API docs for full details.

import { useChat, fetchServerSentEvents } from "@tanstack/ai-solid";

function Chat() {
  const { messages, sendMessage } = useChat({
    connection: fetchServerSentEvents("/api/chat"),
  });
  // ...
}

Preact

npm install @tanstack/ai-preact

The Preact integration provides the useChat hook for managing chat state. See the @tanstack/ai-preact API docs for full details.

import { useChat, fetchServerSentEvents } from "@tanstack/ai-preact";

function Chat() {
  const { messages, sendMessage } = useChat({
    connection: fetchServerSentEvents("/api/chat"),
  });
  // ...
}

Vue

npm install @tanstack/ai-vue

Svelte

npm install @tanstack/ai-svelte

Headless (Framework-Agnostic)

If you're using a framework without a dedicated integration, or building a custom solution, use the headless client directly:

npm install @tanstack/ai-client

See the @tanstack/ai-client API docs for full details.

Adapters

You also need an adapter for your LLM provider. Install one (or more) of the following:

# OpenRouter (recommended — 300+ models with one API key)
npm install @tanstack/ai-openrouter

# OpenAI
npm install @tanstack/ai-openai

# Anthropic
npm install @tanstack/ai-anthropic

# Google Gemini
npm install @tanstack/ai-gemini

# Ollama (local models)
npm install @tanstack/ai-ollama

# Groq
npm install @tanstack/ai-groq

# Grok (xAI)
npm install @tanstack/ai-grok

See the Adapters section for provider-specific setup guides.

Next Steps