@cloudflare/ai-chat.
Installation
Breaking changes
1. convertToModelMessages() is now async
Add await to all calls:
2. CoreMessage removed
Replace CoreMessage with ModelMessage and convertToCoreMessages() with convertToModelMessages():
3. Tool pattern: server-side tools (recommended)
v6 introducesneedsApproval and the onToolCall callback. For most apps, define tools on the server with tool() from "ai" for full Zod type safety:
tools option on useAgentChat and createToolsFromClientSchemas() on the server are still fully supported:
4. generateObject mode option removed
Remove mode: "json" or similar from generateObject calls.
5. isToolUIPart and getToolName now include dynamic tools
In v6, these check both static and dynamic tool parts. For the old behavior, use isStaticToolUIPart and getStaticToolName. Most users do not need to change anything.
Deprecated APIs
Not deprecated:
AITool, createToolsFromClientSchemas(), extractClientToolSchemas(), and the tools option on useAgentChat are supported for SDK/platform use cases where tools are defined dynamically at runtime.Migration checklist
1
Update packages
aito^6.0.0@ai-sdk/reactto^3.0.0@ai-sdk/openai(and other providers) to^3.0.0
2
Add await to convertToModelMessages()
Add
await to all convertToModelMessages() calls3
Replace CoreMessage
Replace
CoreMessage with ModelMessage4
Replace convertToCoreMessages()
Replace
convertToCoreMessages() with convertToModelMessages()5
Remove mode from generateObject
Remove
mode from generateObject calls6
Move tool definitions to server
Move static tool definitions to server using
tool() (recommended for most apps)7
Use onToolCall callback
Use
onToolCall in useAgentChat for client-side tool execution8
Replace toolsRequiringConfirmation
Replace
toolsRequiringConfirmation with needsApproval9
Replace addToolResult()
Replace
addToolResult() with addToolOutput() or addToolApprovalResponse()Further reading
- Official AI SDK v6 migration guide
- Human in the Loop -
needsApprovalandaddToolApprovalResponse - Client Tools -
onToolCalland auto-continuation