ai
π€ Type-safe, provider-agnostic TypeScript AI SDK for streaming chat, tool calling, agents, and multimodal apps across OpenAI, Anthropic, Gemini, React, Vue, Sv
What is ai?
π€ Type-safe, provider-agnostic TypeScript AI SDK for streaming chat, tool calling, agents, and multimodal apps across OpenAI, Anthropic, Gemini, React, Vue, Svelte, and Solid.
Overview of ai
What it is
TanStack AI is a type-safe, provider-agnostic TypeScript SDK for building AI-powered applications. It supports streaming chat, tool calling, structured outputs, realtime voice, media generation, and framework-native AI apps. The SDK is built from composable activities and provider adapters, allowing users to import only the packages they need for their specific use case.
Key features
- Provider-agnostic design with official adapters for OpenAI, Anthropic, Gemini, Ollama, Grok, Groq, ElevenLabs, and many more.
- Streaming chat with typed messages, tool calls, reasoning parts, and configurable connection adapters.
- Type-safe tools defined once with a shared
toolDefinition()contract, supporting server and client implementations. - Structured output flows backed by JSON Schema, Zod, ArkType, Valibot, or plain JSON Schema.
- Multimodal prompts and responses including text, images, audio, video, and documents.
- Realtime voice chat with provider adapters for realtime sessions and token minting.
- Code Mode agents that let an LLM write and execute TypeScript in an isolated sandbox to orchestrate tools.
- Framework-native clients for React, Solid, Vue, Svelte, and Preact, plus a headless client for custom runtimes.
Use cases
Streaming chat experiences, type-safe tool calling, structured output generation, multimodal AI applications, realtime voice chat, Code Mode agents that orchestrate tools with loops and branches, image/audio/video generation pipelines, and observability pipelines for inspecting messages and traces.
Getting started
pnpm add @tanstack/ai @tanstack/ai-openaiFor a React chat UI:pnpm add @tanstack/ai @tanstack/ai-client @tanstack/ai-react @tanstack/ai-openai
License and pricing
License: MIT. The metadata indicates the pricing type is open source, meaning the SDK is free to use and modify under the MIT license.
Based on the project's public README and repository metadata.