Shim: JSON Repair Layer for LLM Outputs
Shim intercepts malformed JSON from language models and repairs it in sub-millisecond time. Prevents production API failures caused by truncated JSON, markdown fences, and syntax errors.
Stop your LLM from breaking production.
Repair broken JSON from LLMs as it streams. Sub-millisecond fixes. Zero data stored. No retries needed.
{
name: "Widget A",
status: 'active',
score: NaN,
tags: ['new', 'promo',],
}Sub-Millisecond Repair
Repair engine runs in <0.1ms. Total API response in 5-15ms. 200x faster than OutputFixingParser.
Streaming Support
Repair JSON as it streams from your LLM. No waiting for complete output. Zero retries.
Confidence Scoring
Every repair includes a confidence level. Know when to trust the output or flag for review.
Zero Data Persistence
We don't want your data. Privacy is built-in: ephemeral processing only.
100% Reliability
Never throw a 500 error again. Shim guarantees valid JSON or a structured error.
Developer First
Simple API. Typed SDKs. Console shows exactly what we fixed.
3 lines. 0 crashes.
Drop in Shim. Never worry about broken JSON again.
Without Shim
const llmOutput = await getLLMResponse();
// ❌ Crashes on malformed JSON
const data = JSON.parse(llmOutput);
// Your app never reaches here
processData(data);SyntaxError: Unexpected end of JSON inputWith Shim
import { shim } from 'shim-sdk';
const llmOutput = await getLLMResponse();
// ✓ Repairs and returns valid JSON
const data = await shim.repair(llmOutput);
// Always reaches here
processData(data);Repaired in 1.2ms • High confidenceFaster and cheaper than alternatives
Compare Shim to OutputFixingParser, LLM retries, and custom parsing solutions.
| Solution | Latency | Cost | Success Rate |
|---|---|---|---|
| Shim | 8-50ms | $0.001 | 99.7% |
| OutputFixingParser | 1,500-3,000ms | $0.03 | 94% |
| Full LLM Retry | 3,000-8,000ms | $0.05-$0.10 | ~100% |
| try/catch only | 0ms | $0 | 0% |
Migrate in under 5 minutes
from langchain.output_parsers \
import OutputFixingParser
parser = OutputFixingParser\
.from_llm(llm, base_parser)
# 1,500-3,000ms 😓
result = parser.parse(broken_json)from shim import ShimClient
shim = ShimClient(api_key="sk_...")
# 8-50ms ⚡
result = shim.repair.create(
content=broken_json,
schema=schema
)Frequently asked questions
Everything you need to know about Shim.
Still have questions?
Contact support →