Malformed JSON, repaired

Response Healing

Automatically validate and repair malformed JSON responses from models when you ask for structured output.

response_format: json_schema

Model output

Sure! Here is the JSON:
```json
{name: 'Ada',
"tags": ["math",

Valid JSON

{
"name": "Ada",
"tags": ["math"]
}
01

One plugin

Add response-healing, done.

02

Common fixes

Fences, commas, truncation.

03

Healing metadata

Know when a fix happened.

04

JSON modes

json_object and json_schema.

Built for

  • Extraction

    Reliable structured data

  • Agents

    Outputs that always parse

  • Cheaper models

    Use them for JSON safely

Turn it on
terminal
1curl https://api.llmgateway.io/v1/chat/completions \2  -H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "model": "gpt-4o",6    "messages": [7      {8        "role": "user",9        "content": "Return name and age as JSON"10      }11    ],12    "response_format": {13      "type": "json_object"14    },15    "plugins": [16      {17        "id": "response-healing"18      }19    ]20  }'
Read docs

More in models & modalities

All features

Start using Response Healing today

One API key. Every model. Live in minutes.