Skip to main content
Structured output is requested through the AI SDK chat model call. With tensormesh(modelId), the request is sent to /v1/chat/completions and the AI SDK parses the response against your schema.
Structured output is useful when your application needs predictable JSON for forms, workflow plans, routing decisions, or typed UI state. Use extractJsonMiddleware() when a model may wrap JSON in Markdown code fences.