Post-processing steps let you apply automatic fixes to model responses after generation. You can specify an ordered list of steps in the post_processing_steps parameter on any chat completions request. Steps run server-side on all LLM Gateway models in both US and EU regions.Currently, JSON repair (json-repair) is the only supported step type.
JSON repair corrects common JSON errors — such as trailing commas, unescaped characters, and missing quotes — that LLMs occasionally produce. This is especially useful when using structured outputs or tool calling, where invalid JSON would otherwise require client-side retry logic.If the response content cannot be repaired, the request returns an error rather than passing through broken JSON.
curl -X POST "https://llm-gateway.assemblyai.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: <YOUR_API_KEY>" \ -d '{ "model": "gemini-2.5-flash-lite", "messages": [ { "role": "user", "content": "Extract the user name and age from: John is 30 years old. Return as JSON." } ], "post_processing_steps": [{"type": "json-repair"}] }'