Install
Basic usage
Pass a Zod schema togenerateObject. The AI SDK converts it to JSON Schema and sends it to dottxt:
additionalProperties: false automatically when converting Zod schemas.
Adding constraints and descriptions
Zod’s built-in methods translate to JSON Schema keywords..describe() adds field-level descriptions that guide generation:
Streaming
UsestreamObject to receive partial results as tokens stream in:
Notes
- The AI SDK converts Zod schemas to JSON Schema before sending them to the API. To inspect the generated schema directly in Zod 4, use
z.toJSONSchema():