const result = openRouter.callModel({
model: 'openai/gpt-5.2',
instructions: 'model instructions!',
input: 'hi!',
parallelToolCalls: false,
tools: [tool1, tool2, tool3...]
});
Will create the function
try {
const textStream = result.getTextStream();
for await (const item of textStream) {
console.log('item:', item);
}
} catch (error) {
console.log('got error:', error);
}
Causes an error, Unexpected response type from API
To recreate, just create a route.ts on Nextjs 15/16+ , run npm run build -> npm run start.
In production, the function will fail