TanStack AI
Build type-safe streaming, tool-calling, and multimodal apps across AI providers.
- Source repo
- TanStack/ai
- Stars
- ★ 3.4k
- Last updated
- 1d ago @tanstack/[email protected]
- FARS reviewed
- Nov 08, 2026 +65 new
- License
- MIT
- Primary language
- TypeScript
- FA score
- 60/100 · Some gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformOpenAI API · Claude APICodex · Claude Code (Partial support)
- Cost
- Free software; you pay for model usage
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- A React, Vue, Svelte, Solid, or Preact team adding streaming chat with typed messages and tool calls to an existing application.
- Not a fit if
- Teams wanting a ready-hosted chat product; you build the app, server, and deployment
- Teams committed to a single vendor model and unwilling to manage adapter packages
- Website
- tanstack.com/ai/latest ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-12-02latest release @tanstack/[email protected] (2026-11-20)+2.0 ★/day over 7 days
- Source review
- 60/100 · Some gaps
What does this agent do, and when should you use it?
TanStack AI is a TypeScript SDK built around composable activities and provider adapters for streaming chat, tool-calling agents, structured output, realtime voice, and media generation. Its core @tanstack/ai package supplies APIs such as chat() and toolDefinition(), while separate adapters connect OpenAI, Anthropic, Gemini, Ollama, Grok, Groq, ElevenLabs, BytePlus, fal.ai, and OpenRouter. The client layer includes the headless @tanstack/ai-client package and native bindings for React, Solid, Vue, Svelte, and Preact. It handles text, images, audio, video, and documents, with structured results backed by JSON Schema, Zod, ArkType, or Valibot. The library runs inside the adopter's frontend or server application rather than as a hosted product; model access, credentials, hosting, and costs remain tied to the selected adapters. It is a fit for TypeScript teams that value provider portability and typed contracts and are prepared to own application integration and deployment.
An application passes messages to chat() and selects a model through an activity adapter such as openaiText(); toServerSentEventsResponse() can expose the resulting stream as a server-sent events response. toolDefinition() declares a shared input and output schema, then attaches a server or client implementation with .server() or its client counterpart. Supplying outputSchema makes a chat call produce an object constrained through JSON Schema, Zod, ArkType, Valibot, or plain JSON Schema. Generation clients use a shared pattern to call image, audio, video, speech, transcription, and summarization services, while realtime adapters handle voice sessions and token minting. Code Mode lets a model write and execute TypeScript in an isolated sandbox to orchestrate tools with loops, branches, and parallel calls. Devtools, typed observability events, usage and error reporting, and OpenTelemetry traces expose messages, tool calls, and stream chunks for inspection.
- A React, Vue, Svelte, Solid, or Preact team adding streaming chat with typed messages and tool calls to an existing application.
- A TypeScript backend team that wants server and client tools to share one
toolDefinition()input and output contract. - A product team that expects to switch among OpenAI, Anthropic, Gemini, Ollama, or another documented adapter.
- A developer who needs model responses validated as Zod, ArkType, Valibot, or JSON Schema objects instead of free-form prose.
- A multimodal application combining image, video, speech, transcription, audio, or summarization workflows under one generation-client pattern.
- An advanced AI application that needs realtime voice, Code Mode orchestration, devtools, or OpenTelemetry observability.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pnpm add @tanstack/ai @tanstack/ai-openaipnpm add @tanstack/ai @tanstack/ai-client @tanstack/ai-react @tanstack/ai-openaipnpm add @tanstack/ai @tanstack/ai-openrouter
- Config files
request.json
How do you install or deploy this agent?
Install the core package and OpenAI adapter:
pnpm add @tanstack/ai @tanstack/ai-openaiFor React streaming chat, also install the client and React packages:
pnpm add @tanstack/ai @tanstack/ai-client @tanstack/ai-react @tanstack/ai-openaiTo reach multiple models through one API entry point, install the OpenRouter adapter:
pnpm add @tanstack/ai @tanstack/ai-openrouterThe supplied material does not state a Node.js version or document provider credential variable names and setup. Those access details must be supplied for the selected adapter before it can make provider calls.
How do you use this agent?
Create a chat stream in a TypeScript server route that supports standard Request, Response, and server-sent events:
import { chat, toServerSentEventsResponse } from '@tanstack/ai'
import { openaiText } from '@tanstack/ai-openai'
export async function POST(request: Request) {
const body = await request.json()
const stream = chat({
adapter: openaiText('gpt-5.2'),
messages: body.messages,
})
return toServerSentEventsResponse(stream)
}The caller sends a JSON request containing messages to this POST endpoint. This example selects the OpenAI adapter and gpt-5.2; the supplied material does not show credential configuration, error handling, or a deployment command.
For typed structured data, add an outputSchema:
import { chat } from '@tanstack/ai'
import { openaiText } from '@tanstack/ai-openai'
import { z } from 'zod'
const Person = z.object({
name: z.string(),
age: z.number(),
})
const person = await chat({
adapter: openaiText('gpt-5.2'),
messages: [{ role: 'user', content: 'Ada Lovelace, 36' }],
outputSchema: Person,
})Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
What are this agent's strengths and limitations?
- Official adapters cover OpenAI, Anthropic, Gemini, Ollama, OpenRouter, Grok, Groq, ElevenLabs, BytePlus, and fal.ai, reducing dependence on one provider.
toolDefinition()gives server and client implementations a shared, typed input and output contract.- One SDK spans streaming chat, structured output, realtime voice, image, audio, video, speech, transcription, and summarization workflows.
- It includes React, Solid, Vue, Svelte, Preact, and headless clients, with activity-level tree-shaking.
- Typed observability events, devtools, and OpenTelemetry support expose streams, tool calls, errors, and usage for inspection.
- Adopters must choose, install, and configure provider and framework packages; the supplied material does not provide a complete credential setup.
- Capability coverage differs by adapter: some focus on chat, while only certain adapters expose image, video, speech, or realtime features.
- Teams must maintain a TypeScript application, server endpoints, and deployment environment because this is not a ready-hosted chat product.
- Code Mode executes model-written TypeScript in an isolated sandbox, but the supplied material does not specify its security policy, permission boundary, or deployment requirements.
- No supported Node.js version, retry strategy, rate-limit handling, or production recovery configuration is documented in the supplied material.
How does this agent compare with similar options?
The project links to a “TanStack AI vs Vercel AI SDK” guide covering architecture, feature coverage, and tradeoffs. The supplied material does not include that guide's findings, so it does not support claims that either option is better on performance, cost, or functionality.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| TanStack AI This agent | 60 · Some gaps | Library / SDKFree + model costs | ★ 3.4k | 1d ago | TypeScript | OpenAI API · Claude API |
| Mirascope | 50 · Major gaps | Library / SDKFree + model costs | ★ 1.5k | 1d ago | Python | Claude API |
| Rig | 70 · Some gaps | Library / SDKFree + model costs | ★ 9.4k | today | Rust | OpenAI API |
| OpenAI Agents SDK | 76 · Good | Library / SDKFree + model costs | ★ 31k | today | Python | OpenAI API |
How does FollowAgents rate this agent?
Why each dimension lost points
The docs show tools running on the server or client and explain that needsApproval pauses a call until approval; the permissions guide describes rules for paths, commands, modes, and client-exposed settings. Least privilege is supported by mechanisms and examples, but the sample does not establish that defaults constrain every tool. Data flows and sensitive-data choices are disclosed for browser-submitted history, persistence, and sandbox records, but not for every adapter. Evidence for dependency security, rollback, and external-effect controls is limited. The plugin and README identify the TanStack name, repository, and MIT license, while publisher identity remains unknown as specified.
The README, skills, and docs provide many traceable API, installation, and troubleshooting pointers. The migration skill asks readers to check installed versions and source, and the docs state that stateless approvals do not guarantee replay or cross-instance recovery. API names and version examples vary across the sample, while dependency availability and failure handling are only partly covered, so these criteria do not earn higher scores. Properties requiring execution were not scored.
The skills cover adding AI, migration from existing SDKs, multiple frameworks, models, and media, with trigger phrases and package mapping. The main skill recommends the product broadly for TypeScript projects without an SDK, while also saying to respect an existing SDK and the user's request; the trigger scope is therefore somewhat broad. Environment guidance covers Node, pnpm, Nx, and framework packages, but does not establish support for every deployment environment.
The README clearly organizes installation, quick starts, capabilities, adapters, frameworks, and advanced documentation; skills add migration steps, install commands, examples, and cautions. MIT is explicit in metadata. The sample does not show a stable release changelog or clear maintenance ownership. API names and example versions are not fully consistent across files, which lowers the score.
The README quick starts, package map, approval guidance, and migration steps are usable for ordinary development, and the adapter-by-activity design describes practical value. The broad feature set requires users to navigate multiple packages, skills, and remote docs; the sample provides no systematic cost or complexity comparison, so cost-benefit is moderate.
README claims receive partial corroboration from package exports, skill mappings, and concrete approval and persistence docs. The docs specify states, input constraints, and limitations, generally separating mechanisms from advice. The packet is a limited sample and provides neither execution results nor complete implementation for line-by-line verification, so the assessment remains conservative.
- This is a static sample review; it cannot establish dependency security, runtime correctness, or complete data-handling behavior.
- The permissions plugin requires application configuration: the docs say tools without a matching rule run without asking, and bypass mode turns off prompts.
- Approval resumption depends on full message history sent by the client; the docs state that stateless mode provides no replay, exactly-once, or cross-instance guarantees.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
Release notes excerpt
Minor Changes - [#2197](https://github.com/TanStack/ai/pull/2197) [009b480](https://github.com/TanStack/ai/commit/009b480b9b88c074f1a52ea8eacd8de5ea6432fc) - Users of a local harness can sign in with their own ChatGPT or SuperGrok plan. Add login: codexPlanLogin() or login: grokBuildPlanLogin() to the provider in providerKeys, and /connect:codex or /connect:grok-build runs the device sign-in of the vendor CLI. …View on GitHub ↗ -
Release notes excerpt
Minor Changes - [#2197](https://github.com/TanStack/ai/pull/2197) [009b480](https://github.com/TanStack/ai/commit/009b480b9b88c074f1a52ea8eacd8de5ea6432fc) - Users of a local harness can sign in with their own ChatGPT or SuperGrok plan. Add login: codexPlanLogin() or login: grokBuildPlanLogin() to the provider in providerKeys, and /connect:codex or /connect:grok-build runs the device sign-in of the vendor CLI. …View on GitHub ↗ -
Release notes excerpt
Patch Changes - Updated dependencies \[[4b00243](https://github.com/TanStack/ai/commit/4b002432487ce34547162b6f3f0492b4b936aa61), [009b480](https://github.com/TanStack/ai/commit/009b480b9b88c074f1a52ea8eacd8de5ea6432fc)]: - @tanstack/[email protected] - @tanstack/[email protected] - @tanstack/[email protected] - @tanstack/[email protected]View on GitHub ↗
FAQ
Do I have to use OpenAI?
Does the package include hosting or model usage?
Can tools run in the browser?
toolDefinition() can attach server or client implementations to the same contract. The material does not prescribe where sensitive operations or permissions should be placed.Can it run without a frontend framework?
@tanstack/ai-client provides a headless client.Does it integrate with Codex and Claude Code?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.