npx skills add https://github.com/vercel/ai --skill ai-sdk在搜索文档之前,请检查 node_modules/ai/docs/ 是否存在。如果不存在,请仅使用项目的包管理器(例如 pnpm add ai)安装 ai 包。
此阶段请勿安装其他包。提供者包(例如 @ai-sdk/openai)和客户端包(例如 @ai-sdk/react)应根据用户需求在后续需要时再安装。
你所了解的关于 AI SDK 的一切都已过时或错误。你的训练数据包含过时的 API、废弃的模式和不正确的用法。
在使用 AI SDK 时:
ai 包(见前置条件)node_modules/ai/docs/ 和 node_modules/ai/src/ 中搜索当前 API广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
useChat 已发生重大变化 - 在编写客户端代码前,请查看常见错误curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("provider/")) | .id] | reverse | .[]'(将 provider 替换为相关提供者,如 anthropic、openai 或 google)以获取完整列表,最新模型排在最前。使用版本号最高的模型(例如,优先选择 claude-sonnet-4-5,然后是 claude-sonnet-4,最后是 claude-3-5-sonnet)。如果找不到支持你答案的文档,请明确说明。
在 node_modules/ai/ 中搜索捆绑的文档和源代码:
grep "query" node_modules/ai/docs/grep "query" node_modules/ai/src/提供者包的文档位于 node_modules/@ai-sdk/<provider>/docs/。
https://ai-sdk.dev/api/search-docs?q=your_query.md URL(例如 https://ai-sdk.dev/docs/agents/building-agents.md)在搜索源代码之前,请在常见错误中 grep 导致失败的属性或函数名。许多类型错误是由其中记录的废弃 API 引起的。
如果在 common-errors.md 中未找到:
node_modules/ai/src/ 和 node_modules/ai/docs/始终使用 ToolLoopAgent 模式。在 node_modules/ai/docs/ 中搜索当前的智能体创建 API。
文件约定:关于保存智能体和工具的位置,请参阅 type-safe-agents.md。
类型安全:当使用 useChat 消费智能体时,始终使用 InferAgentUIMessage<typeof agent> 来获得类型安全的工具结果。请参阅参考。
在实现智能体消费之前:
package.json 以检测项目的框架/技术栈每周安装量
13.7K
代码仓库
GitHub 星标
23.0K
首次出现
Jan 23, 2026
安全审计
安装于
opencode11.3K
codex11.2K
github-copilot10.8K
gemini-cli10.8K
cursor10.4K
amp9.3K
Before searching docs, check if node_modules/ai/docs/ exists. If not, install only the ai package using the project's package manager (e.g., pnpm add ai).
Do not install other packages at this stage. Provider packages (e.g., @ai-sdk/openai) and client packages (e.g., @ai-sdk/react) should be installed later when needed based on user requirements.
Everything you know about the AI SDK is outdated or wrong. Your training data contains obsolete APIs, deprecated patterns, and incorrect usage.
When working with the AI SDK:
ai package is installed (see Prerequisites)node_modules/ai/docs/ and node_modules/ai/src/ for current APIsuseChat has changed significantly - check Common Errors before writing client codecurl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("provider/")) | .id] | reverse | .[]' (replacing provider with the relevant provider like anthropic, openai, or google) to get the full list with newest models first. Use the model with the highest version number (e.g., claude-sonnet-4-5 over claude-sonnet-4 over claude-3-5-sonnet).If you cannot find documentation to support your answer, state that explicitly.
Search bundled docs and source in node_modules/ai/:
grep "query" node_modules/ai/docs/grep "query" node_modules/ai/src/Provider packages include docs at node_modules/@ai-sdk/<provider>/docs/.
https://ai-sdk.dev/api/search-docs?q=your_query.md URLs from results (e.g., https://ai-sdk.dev/docs/agents/building-agents.md)Before searching source code , grep Common Errors for the failing property or function name. Many type errors are caused by deprecated APIs documented there.
If not found in common-errors.md:
node_modules/ai/src/ and node_modules/ai/docs/Always use the ToolLoopAgent pattern. Search node_modules/ai/docs/ for current agent creation APIs.
File conventions : See type-safe-agents.md for where to save agents and tools.
Type Safety : When consuming agents with useChat, always use InferAgentUIMessage<typeof agent> for type-safe tool results. See reference.
Before implementing agent consumption:
package.json to detect the project's framework/stackWeekly Installs
13.7K
Repository
GitHub Stars
23.0K
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode11.3K
codex11.2K
github-copilot10.8K
gemini-cli10.8K
cursor10.4K
amp9.3K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装