Search across all documentation pages
6 pages in this section.
Request a JSON schema response and parse it with client.messages.parse.
Understand how output_config.format guarantees schema-valid responses directly from the Claude API, instead of relying on prompt instructions that ask the model to "please return JSON."
Write a JSON Schema with required fields and additionalProperties set to false so output_config.format returns exactly the shape your code expects.
Parse and validate a schema-constrained response using Pydantic models automatically with client.messages.parse.
Reference table for supported types, enums, string formats, and unsupported schema constraints when designing a schema for output_config.format.
Numbered best practices for designing schemas, validating responses, and handling malformed or truncated structured output.