In this article
Response healing can make malformed JSON parseable; it cannot establish that repaired fields are true, complete or appropriate for the application’s decision.
A model can return the intended object inside Markdown or with a trailing comma that breaks a strict parser. OpenRouter’s response-healing plugin attempts to repair common formatting problems in supported non-streaming requests. It occupies a specific place in the pipeline: after generation formatting, before the application decides whether the result is a valid and useful domain record.
Enable the documented combination
The plugin activates for non-streaming requests that ask for a JSON-object or JSON-schema format and include the response-healing plugin. Responses uses text.format, while Chat Completions uses response_format. For a hypothetical inventory extractor, configure the selected family consistently. Adding the plugin name to a streaming text request should not be described as a universal repair service for every possible output shape.
Recognize the formatting problem it addresses
The documentation lists malformed punctuation and JSON wrapped in Markdown among repair targets. A trailing comma in an otherwise complete inventory object is a formatting problem. A missing inventory source is not. Distinguish these cases before adding retries or repair layers. The plugin can reduce incidental parser failures, but it should not hide an upstream task that never had enough evidence to produce the requested record.
Validate schema after obtaining parseable data
A parseable object can still omit a required product identifier or give a string where the consumer needs a numeric quantity. Validate the actual result against the application schema. For the inventory example, formatting repair and schema validation are separate observations. If the model returned an incomplete generation, do not assume that adding a closing bracket recovers the missing items or restores the intended full content.
Check values against the source
An inventory quantity can be a valid number and still refer to the wrong product row. Compare meaningful fields with the source or another authoritative system where the workflow requires it. The repaired JSON is a representation of the model’s output, not an independent measurement. This distinction is especially important when a downstream application would make a real operational decision from the extracted object.
Keep failure branches visible
Return distinct outcomes for repaired and validated content, schema rejection, absent source data and execution failure. Do not turn every parsing problem into a fabricated default object. Representative fixtures can verify that the client preserves these differences. Response healing then improves formatting resilience at its proper boundary, while the application remains responsible for deciding whether the completed content satisfies the actual extraction task.
Documentation and further study
Related engineering guides: Structured output through OpenRouter: when to use a JSON schema; OpenRouter base URL: configuring a compatible client.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.