TanStack
TanStack

AI

beta

Own the path between your interface and every model.

TanStack AI is a typed, composable SDK for streaming model output, tools, structured data, media, and realtime experiences through infrastructure you control.

Docs
A client graph shows six UI adapters converging on the TanStack AI Client over AG-UI, then reaching a TypeScript runtime and interchangeable model providers.
client graph
chat runtime

Typed tools

One contract. Two execution boundaries.

Define the input and output once, then choose where the work belongs. Client tools can touch local UI state. Server tools can reach private systems. Isomorphic tools share the same definition and can still pause for approval.

tool contract

const lookupInvoice = toolDefinition({

  name: 'lookup_invoice',

  inputSchema: z.object({ id: z.string() }),

  outputSchema: invoiceSchema,

  needsApproval: true,

})

lookupInvoice.server(readPrivateLedger)

Runs behind your server boundary with private credentials and data.

provider capability types

selected model

gpt-5

textreasoningtoolsimagemedia

Adapter-specific types expose the options and outputs available for this model.

Provider types

The adapter changes. The capability surface stays honest.

Providers share a common SDK shape without pretending every model is identical. Model names, options, tool support, and modality-specific results remain typed at the adapter boundary.

AG-UI both ways

The protocol is the seam, not a hosted middleman.

Headless clients send AG-UI-compatible requests and consume AG-UI events. Your runtime can live in TypeScript or interoperate with another AG-UI server while your application keeps control of transport, auth, and deployment.

UI

headless client

AG-UI

request + events

Runtime

your server

Provider

typed adapter

Beyond chat

Different media. The same observable runtime.

Text and structured output sit beside image generation, speech, transcription, realtime voice, and video. Middleware, hooks, devtools, and OpenTelemetry can observe work at the activity level.

Text + objects

chat · outputSchema

01

Speech + transcription

generateSpeech · generateTranscription

02

Realtime voice

realtimeToken · RealtimeClient

03

Images + video

generateImage · generateVideo

04