The Response Healing plugin automatically validates and repairs malformed JSON responses from AI models. When models return imperfect formatting – missing brackets, trailing commas, markdown wrappers, or mixed text – this plugin attempts to repair the response so you receive valid, parseable JSON.
Response Healing provides:
The plugin activates for non-streaming requests when you use response_format with either type: "json_schema" or type: "json_object", and include the response-healing plugin in your plugins array. See the Complete Example below for a full implementation.
The Response Healing plugin handles common issues in LLM responses:
Input: Missing closing bracket
Output: Fixed
Input: Wrapped in markdown
Output: Extracted
Input: Text before JSON
Output: Extracted
Input: Invalid trailing comma
Output: Fixed
Input: JavaScript-style
Output: Fixed
Response Healing only applies to non-streaming requests.
Some malformed JSON responses may still be unrepairable. In particular, if the response is truncated by max_tokens, the plugin will not be able to repair it.