 # AI SDK The [AI SDK](https://sdk.vercel.ai/docs) 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](https://sdk.vercel.ai/docs/reference) and [Documentation](https://sdk.vercel.ai/docs). ## Installation You will need Node.js 18+ and pnpm installed on your local development machine. ```shell npm install ai ``` ## Usage ### AI SDK Core The [AI SDK Core](https://sdk.vercel.ai/docs/ai-sdk-core/overview) module provides a unified API to interact with model providers like [OpenAI](https://sdk.vercel.ai/providers/ai-sdk-providers/openai), [Anthropic](https://sdk.vercel.ai/providers/ai-sdk-providers/anthropic), [Google](https://sdk.vercel.ai/providers/ai-sdk-providers/google-generative-ai), and more. You will then install the model provider of your choice. ```shell npm install @ai-sdk/openai ``` ###### @/index.ts (Node.js Runtime) ```ts import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; // Ensure OPENAI_API_KEY environment variable is set const { text } = await generateText({ model: openai('gpt-4o'), system: 'You are a friendly assistant!', prompt: 'Why is the sky blue?', }); console.log(text); ``` ### AI SDK UI The [AI SDK UI](https://sdk.vercel.ai/docs/ai-sdk-ui/overview) 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, and Vue. You need to install the package for your framework: ```shell npm install @ai-sdk/react ``` ###### @/app/page.tsx (Next.js App Router) ```tsx 'use client'; import { useChat } from '@ai-sdk/react'; export default function Page() { const { messages, input, handleSubmit, handleInputChange, status } = useChat(); return (