response_format, some providers occasionally return slightly broken JSON — Response Healing silently repairs it before returning the response to your application.
When It Activates
Response Healing only activates when both conditions are met:response_formatis set tojson_schemaorjson_object- The response body is valid UTF-8 but contains fixable JSON syntax errors
What Gets Fixed
What Cannot Be Fixed
Enabling Response Healing
Response Healing is enabled by default when using structured output formats. You can also enable it explicitly via theplugins array:
Detecting Healed Responses
When a response was repaired, the response includes a flag in the metadata:Limitations
- Non-streaming only — Response Healing requires the full response body to be available before repair can be attempted. It is not applied to streaming responses.
- Will not repair all JSON — Truncated output (e.g. from hitting
max_tokens) cannot be completed. - Schema validation — Healing fixes syntax errors, not semantic errors. A healed response still needs to pass your own schema validation.
Related
- Structured Outputs — Using
json_schemafor guaranteed schema compliance - Plugins Overview — All available plugins