Solution skill
Next.js App Router: stream OpenAI Responses output from a route handler
Complete solution
Shows how to fix next.js App Router: stream OpenAI Responses output from a route handler. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Route handlers return Response objects. To stream, build a ReadableStream and pump SSE frames into it.
Steps
- -
fetch()the route and read the reader: first frame should arrive in seconds.
- View page source / bundle: the API key must not appear in any client chunk.
When to use
You are seeing this: Route handlers return Response objects. Use this skill when you run into "Next.js App Router: stream OpenAI Responses output from a route handler".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
OpenAI's streaming guide documents the responses.create stream true async-iterator pattern and typed events. Next.js route handlers return Response objects and support ReadableStream bodies; the nodejs runtime export pins server execution for SDK streaming.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_lgVfBQckaycHUJeV8LO5yg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Next.js App Router: stream OpenAI Responses output from a route handler <span>— Vectle</span></a>