Gathering detailed insights and metrics for ai
Gathering detailed insights and metrics for ai
Build AI-powered applications with React, Svelte, Vue, and Solid
npm install ai
Typescript
Module System
Min. Node Version
Node Version
NPM Version
82.4
Supply Chain
98.8
Quality
99.8
Maintenance
100
Vulnerability
99.6
License
@ai-sdk/vue@1.1.14
Updated on Feb 12, 2025
@ai-sdk/valibot@0.0.3
Updated on Feb 12, 2025
@ai-sdk/xai@1.1.9
Updated on Feb 12, 2025
@ai-sdk/ui-utils@1.1.13
Updated on Feb 12, 2025
@ai-sdk/togetherai@0.1.10
Updated on Feb 12, 2025
@ai-sdk/swarm@0.1.36
Updated on Feb 12, 2025
TypeScript (62.5%)
MDX (36.81%)
JavaScript (0.38%)
Vue (0.31%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
23,208,582
Last Day
204,342
Last Week
1,186,647
Last Month
4,572,440
Last Year
21,164,208
NOASSERTION License
11,801 Stars
2,731 Commits
1,799 Forks
70 Watchers
100 Branches
348 Contributors
Updated on Feb 13, 2025
Minified
Minified + Gzipped
Latest Version
4.1.36
Package Id
ai@4.1.36
Unpacked Size
1.92 MB
Size
387.68 kB
File Count
33
NPM Version
10.8.2
Node Version
18.20.6
Published on
Feb 12, 2025
Cumulative downloads
Total Downloads
Last Day
-9.7%
204,342
Compared to previous day
Last Week
3.7%
1,186,647
Compared to previous week
Last Month
78.4%
4,572,440
Compared to previous month
Last Year
938.8%
21,164,208
Compared to previous year
6
The AI SDK is a TypeScript toolkit designed to help you build AI-powered applications using popular frameworks like Next.js, React, Svelte, Vue and runtimes like Node.js.
To learn more about how to use the AI SDK, check out our API Reference and Documentation.
You will need Node.js 18+ and pnpm installed on your local development machine.
1npm install ai
The AI SDK Core module provides a unified API to interact with model providers like OpenAI, Anthropic, Google, and more.
You will then install the model provider of your choice.
1npm install @ai-sdk/openai
1import { generateText } from 'ai'; 2import { openai } from '@ai-sdk/openai'; // Ensure OPENAI_API_KEY environment variable is set 3 4const { text } = await generateText({ 5 model: openai('gpt-4o'), 6 system: 'You are a friendly assistant!', 7 prompt: 'Why is the sky blue?', 8}); 9 10console.log(text);
The AI SDK UI module provides a set of hooks that help you build chatbots and generative user interfaces. These hooks are framework agnostic, so they can be used in Next.js, React, Svelte, Vue, and SolidJS.
1'use client'; 2 3import { useChat } from 'ai/react'; 4 5export default function Page() { 6 const { messages, input, handleSubmit, handleInputChange, isLoading } = 7 useChat(); 8 9 return ( 10 <div> 11 {messages.map(message => ( 12 <div key={message.id}> 13 <div>{message.role}</div> 14 <div>{message.content}</div> 15 </div> 16 ))} 17 18 <form onSubmit={handleSubmit}> 19 <input 20 value={input} 21 placeholder="Send a message..." 22 onChange={handleInputChange} 23 disabled={isLoading} 24 /> 25 </form> 26 </div> 27 ); 28}
1import { streamText } from 'ai'; 2import { openai } from '@ai-sdk/openai'; 3 4export async function POST(req: Request) { 5 const { messages } = await req.json(); 6 7 const result = streamText({ 8 model: openai('gpt-4o'), 9 system: 'You are a helpful assistant.', 10 messages, 11 }); 12 13 return result.toDataStreamResponse(); 14}
We've built templates that include AI SDK integrations for different use cases, providers, and frameworks. You can use these templates to get started with your AI-powered application.
The AI SDK community can be found on GitHub Discussions where you can ask questions, voice ideas, and share your projects with other people.
Contributions to the AI SDK are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have smooth experience contributing to AI SDK.
This library is created by Vercel and Next.js team members, with contributions from the Open Source Community.
No vulnerabilities found.
No security vulnerabilities found.