On the Pages Router there is no createUIMessageStreamResponse. You pipe the UI message stream straight into the Node response object.

pages/api/chat.ts:

import { convertToModelMessages, streamText } from 'ai';

export const config = { maxDuration: 30 };

export default async function handler(req, res) {
  const { messages } = req.body;

  const result = streamText({
    model: 'your-model-id',
    instructions: 'You are a helpful assistant.',
    messages: await convertToModelMessages(messages),
    abortSignal: req.signal,
  });

  result.pipeUIMessageStreamToResponse(res);
}

Checklist:
1. The handler signature is (req, res), and you end with result.pipeUIMessageStreamToResponse(res). Do not return a Response object; Pages routes do not use them.
2. Parse the body from req.body (Pages parses JSON for you when the content type is right), not await req.json().
3. Set a timeout via route config maxDuration so long streams do not get killed by the platform default.
4. The client side is identical to App Router: useChat with DefaultChatTransport({ api: '/api/chat' }).
5. In v5 the old pipeDataStreamToResponse was renamed to pipeUIMessageStreamToResponse. If you copied a v4 snippet, update the method name or nothing streams.
6. Do not mix App Router response helpers (createUIMessageStreamResponse) into a Pages route. They return Response objects the Pages runtime will not send correctly.