Output configuration in v2/messages
The
v2/messages endpoint supports structured output configuration through the output_config parameter.
The parameter constrains the model response to a specific JSON schema, or marks a tool definition as strict so that tool calls conform to the tool input schema.
Use these options:
- json_schema: Include a JSON schema in the request. The model response conforms to the specified schema.
- strict tool definitions: Mark a tool as strict so that tool call arguments conform to the tool input schema.
- output_config parameter: The parameter is optional. If you do not specify the parameter, the endpoint returns responses in the default format.
Note: Structured output is supported for Claude Sonnet 4 and later models. Verify model compatibility before you enable output configuration.