docs: update Route Handler AI SDK streaming examples (#102192)
### What?
Update the TypeScript and JavaScript chat streaming examples in the
[Route Handler
reference](https://nextjs.org/docs/app/api-reference/file-conventions/route#streaming)
to use the current AI SDK APIs, and link to the SDK guide for a complete
chat UI.
### Why?
Both chat snippets import `StreamingTextResponse` and call
`toAIStream()`, which current AI SDK releases no longer expose. Copying
them causes a compilation failure. Keep a usable chat example alongside
the existing Web Streams example.
Finding: https://next-maintainer-agent.vercel.tools/agent-feedback/5601
### How?
Follow the current AI SDK App Router guide: convert UI messages with
`convertToModelMessages`, then wrap `result.stream` with
`toUIMessageStream` and `createUIMessageStreamResponse`. Retain the
OpenAI provider, use the current model shown in the guide, and state the
package and API-key prerequisites. Preserve both Web Streams examples
and the `#streaming` anchor. The reference remains the home for these
response construction examples. Audited the streaming guide, Route
Handlers introduction, Backend for Frontend guide, Pages API Routes
reference, migration/error guidance, examples, and generated guidance
source; no other occurrences of the removed APIs need correction. No
related pages changed.
### Verification
- Confirmed the removed APIs remain in current canary (`794836c3cbb`)
and the public page. Read the latest Slack replies and checked open PRs;
#101848 adds a streaming lifetime caveat but retains the broken SDK
snippets. The current AI SDK App Router guide uses
`createUIMessageStreamResponse` and `toUIMessageStream`.
- Compared release tags `v16.4.1` → `v16.4.2`, `v16.4.2` → `v16.4.3`,
`v16.4.5` → `v16.4.6`, and `v16.5.0-canary.58` → `v16.5.0-canary.59`,
including release notes and relevant history. Both chat snippets are
identical across all tags and current canary. Docs backports
#100246/#100262 shipped in 16.4.2 without changing this reference; Route
Handler compression #101280 shipped in 16.4.6 but cannot explain a
missing SDK export during compilation. The recent reference changes
(#100753 and #101990) only change an MDN link and caching guidance. This
is longstanding documentation drift, with no established Next.js
regression boundary. The same snippets already exist at the checkout's
shallow history boundary (`3e97d89d0f3`, May 20, 2026); their original
introducing commit is unavailable locally.
- Extracted the TypeScript chat snippet and type-checked it with
`ai@7.0.179`, `@ai-sdk/openai@4.0.122`, and TypeScript 5.9.3; JavaScript
syntax validation also passed. No provider call or API key was needed.
- Changed-file Prettier and ESLint passed. Verified both retained Web
Streams code blocks are byte-identical and the AI SDK guide resolves.
- Full `pnpm lint` failed on 10 unused turbo-tasks items in untouched
Rust files; parallel-task cleanup also encountered sandbox `spawn
EPERM`.
- Reused the supplied hosted reproduction on 16.4.2 and
16.5.0-canary.59. Runtime builds, browser tests, and an earlier runtime
baseline were not rerun for this docs-only correction.
<!-- NEXT_JS_LLM -->