response_format to get JSON that matches it:
How it works
- A pydantic class becomes a strict
json_schemaresponse format. - A dict is sent as given, so you can pass
{"type": "json_object"}or your ownjson_schemablock. - The JSON arrives as the message content string. Parse it yourself, as above.
- For Claude, RouteHub enforces the schema through a forced tool call, or native structured output on Claude 5.1 and later, and still returns the result as the message content.