AI Gateway and AI SDK Integration
AI SDK 4.2

AI SDK 4.2

3/21/2025

What this post added

AI SDK 4.2 introduces support for reasoning models with dedicated `reasoning` tokens and a `extractReasoningMiddleware`. It adds Model Context Protocol (MCP) client support for integrating external tools via stdio or SSE. The `useChat` hook now supports `message.parts` to handle diverse LLM outputs like text, sources, reasoning, tool invocations, and files. Image generation is supported via the `file` message part for models like Gemini 2.0 Flash. URL sources are standardized for models supporting grounding. Day-one support for OpenAI's Responses API is included, allowing easy migration from Completions API and enabling web search tools. Svelte 5 and middleware updates are also included.

Read the original post ↗