Elixir library for integrating LLMs such as Claude, OpenAI, Gemini, Ollama and self-hosted models into Elixir applications.
TanStack/ai
Type-safe, provider-agnostic TypeScript SDK for streaming chat, tool calling, agents, and multimodal apps across major LLM providers and UI frameworks.
Open-source alternative to:Vercel AI SDK
- Stars
- 3,337
- Forks
- 386
- Open issues
- 35
- Last commit
- 10 hours ago
What is it?
TanStack AI is a TypeScript SDK for building AI features in web apps and backend services. It groups functionality into composable activities such as chat, image, audio, video, speech, transcription, and summarization, so you can import only the parts you need. Provider adapters cover OpenAI, Anthropic, Gemini, Ollama, Groq, OpenRouter, Cloudflare Workers AI, fal.ai and others, and switching between them is designed to be simple.
The SDK provides framework bindings for React, Solid, Vue, Svelte, and Preact, along with a headless client for custom runtimes. Tools are defined once with a shared schema and can run on the server or the client with matching input and output types. Structured outputs accept JSON Schema, Zod, ArkType, or Valibot schemas.
The project also includes realtime voice chat, a Code Mode feature where a model writes and runs TypeScript in an isolated sandbox, middleware hooks, devtools, and OpenTelemetry tracing.
Key features
- 01Streaming chat with typed messages, tool calls, and reasoning parts.
- 02Shared tool definitions that run on either the server or the client.
- 03Structured outputs validated with Zod, ArkType, Valibot, or JSON Schema.
- 04Tree-shakeable adapters for many providers, including OpenAI, Anthropic, and Gemini.
- 05Framework hooks for React, Solid, Vue, Svelte, and Preact.
- 06OpenTelemetry traces and devtools for inspecting messages and tool calls.
Use cases
- Adding a streaming AI chat panel to a React or Vue web app.
- Giving an LLM typed tools that query your application's database.
- Extracting typed JSON from model responses with a schema.
- Building a multi-provider AI backend that can switch models at runtime.
Quick start
- 1
Install the core package and OpenAI adapter
pnpm add @tanstack/ai @tanstack/ai-openai - 2
Add a streaming chat endpoint using the chat function and toServerSentEventsResponse
Things to know
- Many features (realtime, Code Mode, media generation) are broad in scope and may be less mature than core chat.
In collections
Topics
FAQ
- What is ai?
- Type-safe, provider-agnostic TypeScript SDK for streaming chat, tool calling, agents, and multimodal apps across major LLM providers and UI frameworks. TanStack AI is a TypeScript SDK for building AI features in web apps and backend services. It groups functionality into composable activities such as chat, image, audio, video, speech, transcription, and summarization, so you can import only the parts you need. Provider adapters cover OpenAI, Anthropic, Gemini, Ollama, Groq, OpenRouter, Cloudflare Workers AI, fal.ai and others, and switching between them is designed to be simple.
- Is ai free to use? What license does it have?
- ai is open source under the MIT license. Check the license terms before using it in commercial products.
- Is ai still maintained?
- Actively maintained. The last commit to ai was on Nov 6, 2026.
- What can I use ai for?
- Adding a streaming AI chat panel to a React or Vue web app. Giving an LLM typed tools that query your application's database. Extracting typed JSON from model responses with a schema. Building a multi-provider AI backend that can switch models at runtime.
- How do I install ai?
- Install the core package and OpenAI adapter: pnpm add @tanstack/ai @tanstack/ai-openai Add a streaming chat endpoint using the chat function and toServerSentEventsResponse
- Where can I get ai?
- The source code and installation instructions are on GitHub: https://github.com/TanStack/ai
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Ruby on Rails framework for building AI-powered apps where agents are implemented as controllers with actions and views.
A Laravel package for building, tool-equipping and deploying LLM-powered AI agents with persistent memory, tracing and a web dashboard (now retired; v0.0.48 is final).
Async Scala client for the OpenAI API and many other LLM providers, covering chat, responses, streaming, batches, and more.
A Laravel package that gives PHP applications a single fluent interface for calling LLMs across multiple AI providers.
Python client library that wraps multiple AI provider APIs behind one simple interface for text, structured data, and conversations.