Up until now, we've been flying blind with the AI SDK. We send requests to the LLM and get responses back, but we haven't had much visibility into what's actually happening under the hood.
The AI SDK V6 shipped with DevTools - a powerful local development tool that lets you inspect every interaction with your language model. You can see request payloads, response streams, token usage, and even watch reasoning tokens get consumed in real-time.
This observability is critical when building with LLMs. It helps you debug issues, understand what's being sent to the provider, and optimize your prompts based on actual usage data.
devToolsMiddleware from @ai-sdk/devtoolsThe middleware comes from the AI SDK DevTools package and allows you to intercept and inspect LLM calls.
wrapLanguageModel()Use the wrapLanguageModel() function from the AI SDK to add the middleware to your model. Pass the model and the middleware to it:
import { google } from '@ai-sdk/google';import { devToolsMiddleware } from '@ai-sdk/devtools';import { wrapLanguageModel } from 'ai';const model = wrapLanguageModel({model: google('gemini-2.5-flash'),middleware: devToolsMiddleware(),});
pnpm run devThis starts your local dev server which will be instrumented with DevTools.
npx @ai-sdk/devtools@latestThis launches the DevTools UI at http://localhost:4983.
One terminal runs your app, the other runs the DevTools interface.
http://localhost:3000 in your browserThis is where your application is running.
Send a message through your application UI.
http://localhost:4983You should now see a new run appear in the DevTools interface.
Explore the different tabs available:
Notice the input tokens, output tokens, and any reasoning tokens that were consumed.
Confirm you can see exactly what was sent to the LLM provider.
Understand how the response was streamed back from the provider.