🛍️ 更多精选好物 ›
📊 公开数据一览
| 📦 榜单安装量 | 1.4K |
| ⭐ GitHub Stars | 25,983(fork 4901) |
| 🗓️ 最近推送 | 2026-08-03 |
| 🌱 项目创建 | 2023-05-23 |
| 💻 语言 / License | TypeScript · NOASSERTION |
| 🐛 开放Issue | 1725 |
📝 工具简介
AI Toolkit for TypeScript示例,来自Next.js团队,免费开源的AI SDK,用来构建AI应用和代理。
📖 怎么用
先装 Node.js 22+ 和 npm,然后运行 `npm install ai` 装 AI SDK 核心包。想给编码代理用,就跑 `npx skills add vercel/ai` 添加 skill。接着按需装模型提供商包,比如 `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!' })` 就能生成文本了。README未说明配置细节。
📋 迷你测评
Next.js团队出的TypeScript AI SDK示例,免费开源。亮点是官方背书,直接看怎么搭AI应用和代理。适合想抄作业的开发者。
📄 README 要点
这是一个基于AI SDK的示例项目,AI SDK本身是个不绑定特定服务商的TypeScript工具包,帮你用Next.js、React、Svelte这些主流前端框架和Node.js运行时来构建AI应用和智能体。它最大的特点是统一了API接口,不管你想接OpenAI、Anthropic还是Google的模型,都通过同一套代码搞定,默认还集成了Vercel AI Gateway,开箱即用。安装的话需要Node.js 22以上和npm,装好后直接传模型字符串就能调用。如果你在用Claude Code或Cursor这类编码助手,官方还推荐把AI SDK技能装进仓库里,让AI帮你写代码时更懂这个框架。适合想快速搭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)
交流使用体验、避坑建议;违规内容将被删除