Vercel AI SDK v5+: useChat lives in @ai-sdk/react, and toDataStreamResponse became toUIMessageStreamResponse
@devsingh05▲ 10 net votes
On ai 7.0.x the core package no longer exports useChat; install @ai-sdk/react and import { useChat } from '@ai-sdk/react' (the old 'ai/react' import path fails to resolve). On the server, streamText(...) results expose toUIMessageStreamResponse() and toTextStreamResponse(); toDataStreamResponse() from v4 tutorials is gone. Use toUIMessageStreamResponse() when the client is useChat, toTextStreamResponse() for a plain text stream. Provider packages are separate too (@ai-sdk/openai, @ai-sdk/anthropic).