🛍️ 更多精选好物 ›
📊 公开数据一览
| 📦 榜单安装量 | 2.5K |
| ⭐ GitHub Stars | 25,973(fork 4900) |
| 🗓️ 最近推送 | 2026-08-02 |
| 🌱 项目创建 | 2023-05-23 |
| 💻 语言 / License | TypeScript · NOASSERTION |
| 🐛 开放Issue | 1722 |
📝 工具简介
TypeScript的AI工具包,来自Next.js团队,免费开源的AI应用和代理构建库。
📖 怎么用
先确保 Node.js 22+ 和 npm 装好。装 AI SDK 核心包,跑 `npm install ai`。给 coding agent(如 Claude Code 或 Cursor)加技能,执行 `npx skills add vercel/ai`。想用具体模型商,再装对应包,比如 `npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google`。然后代码里导入模型,像 `import { anthropic } from '@ai-sdk/anthropic'`,调用 `generateText({ model: anthropic('claude-opus-4-6'), prompt: 'Hello!' })` 就能生成文本了。
📋 迷你测评
名字看是迁移工具,但简介跟ai-sdk完全一样,没提迁移细节。亮点不明,可能是模板或教程。简介未提数据点,建议直接看原版ai-sdk说明。
📄 README 要点
这是AI SDK的迁移指南,AI SDK本身是一个与具体厂商无关的TypeScript工具包,用来构建AI应用和代理,支持Next.js、React、Svelte、Vue、Angular这些主流框架,也支持Node.js运行时。安装需要Node.js 22以上版本和npm。如果你用Claude Code或Cursor这类编程代理,强烈建议把AI SDK技能加到你的仓库里。它的核心是提供一个统一的API来对接OpenAI、Anthropic、Google等模型提供商,默认通过Vercel AI Gateway访问所有主流提供商,你只需要传一个模型字符串就能用。适合想在不同AI模型之间灵活切换的开发者,避免被单一厂商锁定。
查看英文原文
AI SDK The AI SDK is a provider agnostic TypeScript toolkit designed to help you build AI powered applications and agents using popular UI frameworks like Next.js, React, Svelte, Vue, Angular, and runtimes like Node.js. To learn more about how to use the AI SDK, check out our API Reference and Documentation. Installation You will need Node.js 22+ and npm (or another package manager) installed on your local development machine. [安装/使用命令见下方] Skill for Coding Agents If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository: [安装/使用命令见下方] Unified Provider Architecture The AI SDK provides a unified API to interact with model providers like OpenAI, Anthropic, Google, and more. By default, the AI SDK uses the Vercel AI Gateway to give you access to all major providers out of the box. Just pass a model string for any supported model: [安装/使用命令见下方] You can also connect to providers directly using their SDK packages: [安装/使用命令见下方] [安装/使用命令见下方] Usage Generating Text [安装/使用命令见下方] Generating Structured Data [安装/使用命令见下方] Agents [安装/使用命令见下方] UI Integration 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, and Vue. You need to install the package for your framework, e.g.: [安装/使用命令见下方] Agent @/agent/image generation agent.ts [安装/使用命令见下方] Route (Next.js App Router) @/app/api/chat/route.ts [安装/使用命令见下方] UI Component for Tool @/component/image generation view.tsx [安装/使用命令见下方] Page @/app/page.tsx [安装/使用命令见下方] Templates 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. Community The AI SDK community can be found on the Vercel Community where you can ask questions, voice ideas, and share your projects with other people. Contributing Contributions to the AI SDK are
💬 评论(0)
交流使用体验、避坑建议;违规内容将被删除