@tanstack/ai-svelte has 888 recorded weekly downloads on npm, a decrease of 17.9% over the past 30 days, ranking #1468 of 2,322 tracked listings.
About @tanstack/ai-svelte
Svelte bindings for TanStack AI.
Installation
npm install @tanstack/ai-svelte
# or
pnpm add @tanstack/ai-svelte
# or
yarn add @tanstack/ai-svelte
Usage
<script>
import { createChat, fetchServerSentEvents } from '@tanstack/ai-svelte'
const chat = createChat({
connection: fetchServerSentEvents('/api/chat'),
})
</script>
<div>
{#each chat.messages as message}
<div>{message.role}: {message.parts[0].content}</div>
{/each}
{#if chat.isLoading}
<button onclick={chat.stop}>Stop</button>
{/if}
<button onclick={() => chat.sendMessage('Hello!')}> Send </button>
</div>
API
createChat(options)
Creates a reactive chat instance. Returns an object with reactive getters and methods:
Reactive Properties (no $ prefix needed):
messages- Array of messages in the conversationisLoading- Boolean indicating if a response is being generatederror- Current error, if any
Methods:
sendMessage(content)- Send a messageappend(message)- Append a messagereload()- Reload the last assistant messagestop()- Stop the current response generationclear()- Clear all messagessetMessages(messages)- Set messages manuallyaddToolResult(result)- Add a tool resultaddToolApprovalResponse(response)- Respond to a tool approval request
Svelte 5 Runes
This library uses Svelte 5 runes ($state) internally, providing a clean API where you don't need to use the $ prefix to access reactive state:
<script>
const chat = createChat({})
// No $ needed - these are reactive getters!
console.log(chat.messages)
console.log(chat.isLoading)
</script>
<!-- Reactivity works automatically in templates -->
{#each chat.messages as message}
...
{/each}
License
MIT
Description from the npm listing.
- ai
- ai-sdk
- typescript
- tanstack
- svelte
- svelte5
- chat
- streaming
- tool-calling
- structured-outputs
- media-generation
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (544)Similar npm AI SDKs plugins
All 20 @tanstack/ai-svelte alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@tanstack/ai-svelte. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.