Docs
CodeRabbit
Cloudflare
Railway
OpenRouter
SerpAPI
AG Grid
Netlify
Clerk
WorkOS
Sentry
Prisma
Electric
Unkey
CodeRabbit
Cloudflare
Railway
OpenRouter
SerpAPI
AG Grid
Netlify
Clerk
WorkOS
Sentry
Prisma
Electric
Unkey
Class References
Function References
Interface References
Type Alias References
Variable References

Open AI application SDK

TanStackAI

alpha

Own the AI stack between your UI and your models.

AI is an open-source SDK for building provider-portable AI features with AG-UI-compatible clients, server helpers, typed tools, media generation, and observable runtime primitives without a hosted gateway in the middle.

Total DownloadsWeekly DownloadsGitHub Stars
Read the docs

AG-UI native

portable client and event protocol

Provider adapters

OpenRouter, OpenAI, Anthropic, Gemini

Typed tools

client, server, approvals, media

client graph
client
server / runtime
provider
Vanilla
React
Vue
Solid
Svelte
Preact
TanStack AI ClientAG-UI
TanStack AITypeScript
Python
Go
PHP
OpenRouter
OpenAI
Anthropic
Gemini
chat runtime

event

assistant.delta

tool

approval required

provider

OpenRouter

server

TanStack AI

Type a message...

Why AI

AI apps need protocols and boundaries, not another black box.

A useful AI layer has to cross clients, servers, providers, tools, streaming events, approvals, and observability. AI keeps those seams explicit so teams can swap pieces without rewriting the product.

Protocol first, gateway never required.

Clients and servers speak AG-UI-compatible requests and event streams, so teams can own their transport, runtime, and deployment shape.

Providers are adapters, not the architecture.

Use OpenRouter, OpenAI, Anthropic, Gemini, Ollama, Groq, Grok/xAI, ElevenLabs, and fal.ai without making the app proprietary to one vendor.

Tools stay typed where they run.

Define client, server, isomorphic, and provider-native tools with input/output types, approvals, and runtime boundaries that remain visible.

Media is part of the same SDK story.

Text, structured output, reasoning streams, image, speech, transcription, realtime voice, and video can share provider-aware primitives.

1

Client

Headless client or framework hook starts the interaction from your UI.

2

Protocol

AG-UI request and event streams keep client/server interop explicit.

3

Provider

Adapters translate into model-specific capabilities and options.

4

Observe

Devtools, middleware, logs, and hooks make the runtime explainable.

Runtime pipeline

From UI intent to model output, every hop stays visible.

AI features are distributed systems wearing a chat box. The SDK gives each hop a typed place to live so the app can stream, tool call, approve, retry, observe, and render intentionally.

Observable runtime

Debug the interaction, not just the final answer.

Tool calls, approvals, model options, provider events, structured output, middleware, and media jobs all need to be inspectable if the feature is going to be operated with confidence.

agent.run({ provider, model, tools })
stream.on("tool.call", requestApproval)
devtools.record(event)

tool approval

pending: chargeCard

stream event

reasoning.delta

structured output

schema matched

media job

image generation complete

Framework adapters

Headless core, renderer-specific ergonomics.

Start from the headless client or use the adapter for your UI runtime. The provider, protocol, tools, and event model stay the same.

ReactVueSolidSveltePreactVanilla

Product control

Bring your providers, servers, and product constraints.

AI should help teams standardize the app layer without flattening provider capabilities or forcing a hosted platform into the critical path.

Open source ecosystem

AI stays useful by staying close to real product work.

Maintainers, adapters, examples, partners, and GitHub sponsors keep the SDK honest as models, providers, and app expectations keep changing.

GitHub Sponsors

Wow, you've come a long way!
Only one thing left to do...