How to use
- Copy the installation command and review the source package before installing it in your own agent environment.
- Check the source document for required tools, credentials and supported hosts.
- Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/tanstack/ai --skill tanstack-ai-migrationBefore you start
- Installation does not include a model subscription, API allowance or permission to access your files.
- Repository stars and installation counts describe activity, not an independent quality or security test.
Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.
Migrating to TanStack AI
Two different jobs. Pick the one that matches the code in front of you.
Coming from another SDK
The name-by-name mapping lives in the docs, and it is longer than any summary that fits here:
https://tanstack.com/ai/latest/docs/migration/migration-from-vercel-ai
The shape of the change:
streamTextandgenerateTextbecome onechat()call with a streaming
option.
createOpenAI(...)becomes a tree-shakeable adapter, such asopenaiText()
from @tanstack/ai-openai.
onFinishand friends become middleware hooks.- Manual SSE wiring becomes the built-in response helpers.
generateObjectbecomes structured outputs onchat().
Read the guide, then load the target API's own skill with npx @tanstack/intent@latest load @tanstack/ai#ai-core. Do not port from memory: a half-remembered mapping produces code that type-checks in neither SDK.
Upgrading TanStack AI itself
Start with the version the app has, and the current release:
node -p "require('@tanstack/ai/package.json').version"
npm view @tanstack/ai versionThen read the guides for what changed:
- https://tanstack.com/ai/latest/docs/migration/migration
- https://tanstack.com/ai/latest/docs/migration/ag-ui-compliance
- https://tanstack.com/ai/latest/docs/migration/sampling-options-to-model-options
- https://tanstack.com/ai/latest/docs/migration/create-ui
Deprecated APIs keep working, so upgrade in steps rather than rewriting everything at once.
Codemods
Some renames have a jscodeshift transform. Run it straight from the repo, and preview first with --dry --print:
npx jscodeshift \
-t https://raw.githubusercontent.com/TanStack/ai/main/codemods/ag-ui-compliance/transform.ts \
--dry --print src/Each guide names the codemod that covers it, and what the codemod cannot reach. Server-side rewrites are usually manual.
After the port
Run the project's type checker. Most errors after a migration come from an API that was remembered rather than read, so check the failing name against node_modules/@tanstack/ai/src/ before changing it again.




