Type-safe JSON schema responses from LLMs using outputSchema on chat() and useChat(). Supports Zod, ArkType, and Valibot schemas. The adapter handles provider-specific strategies transparently — never configure structured output at the provider level. Pass stream:true alongside outputSchema for incremental JSON deltas + a terminal validated object via the structured-output.complete event. Every assistant turn in useChat carries its own typed StructuredOutputPart on messages[i].parts, so multi-turn structured chats preserve history automatically — partial/final derive from the latest assistant turn's part. convertSchemaToJsonSchema() for manual schema conversion.
$npx -y skills add tanstack/ai --skill structured-outputsInstalls into the current project.
Run `npx skills use "https://github.com/tanstack/ai" --skill "tanstack/ai/structured-outputs"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/tanstack/ai" that are relevant to the current task. Run `npx skills add "https://github.com/tanstack/ai"` and select the relevant skills, then follow their instructions.