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
node_modules/ai/docs/ exists. If not, install only the ai package using the project's package manager (e.g., pnpm add ai).@ai-sdk/openai) and client packages (e.g., @ai-sdk/react) should be installed later when needed based on user requirements.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).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 URLs from results (e.g., https://ai-sdk.dev/docs/agents/building-agents.md)node_modules/ai/src/ and node_modules/ai/docs/ToolLoopAgent pattern. Search node_modules/ai/docs/ for current agent creation APIs.useChat, always use InferAgentUIMessage<typeof agent> for type-safe tool results. See reference.package.json to detect the project's framework/stack