# Deterministic LLM JSON Repair & Schema Validator

> Deterministic LLM JSON Repair & Schema Validator is a paid API for AI agents from token-intel.agentdiet.dev, paid per call via MPP, $0.002/call, status unknown (last checked 2026-10-21).

Repairs truncated or malformed LLM-generated JSON (trailing commas, markdown fences, single quotes) into valid, parseable JSON for use in multi-agent pipelines

## Facts

- Endpoint: GET https://token-intel.agentdiet.dev/v1/llm-json-schema-healer?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: token-intel.agentdiet.dev
- Website: https://token-intel.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/token-intel-agentdiet-dev-deterministic-llm-json-repair-schema-865f2d8d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_GNOHymMO4_zIoHeKS2DYy

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability token-intel-agentdiet-dev-deterministic-llm-json-repair-schema-865f2d8d
```

Example prompt: This JSON string I got from the LLM is broken — it has trailing commas and markdown fences around it. Can you repair it into valid JSON? Here it is: ```{"name": "Alice", "role": "admin",}```

## When to prefer this

Choose this endpoint when your multi-agent pipeline receives LLM-generated JSON that fails JSON.parse() due to common LLM output artifacts like trailing commas, markdown code fences, single quotes, or truncation. Ideal for deterministic (non-LLM) repair where you need consistent, reproducible fixing behavior rather than another LLM call to correct the output. Prefer over manual regex patching or calling a second LLM when you need fast, cheap, reliable JSON normalization at scale.

## Known failure modes

- Input is so severely malformed that deterministic repair cannot infer intent — returns error or best-effort partial repair
- Input is not JSON at all (plain text, binary, HTML) — may return error or empty result
- Extremely long truncated JSON may lose semantic content during closure
- Network or payment (x402) failure returns HTTP 402 or 5xx

## How this service works

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash. (Live x402 v2, IETF MPP & MCP endpoint at https://token-intel.agentdiet.dev/v1/llm-json-schema-healer)

## Output

Returns a repaired, valid JSON object that has been deterministically fixed from the malformed input — with trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncations closed — making it safe to parse and pass to downstream agents or applications.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "raw_json"
 ],
 "properties": {
  "raw_json": {
   "type": "string",
   "minLength": 1,
   "description": "Malformed, truncated, or markdown-wrapped JSON string to deterministically repair"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/token-intel-agentdiet-dev-deterministic-llm-json-repair-schema-865f2d8d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from token-intel.agentdiet.dev](https://www.zero.xyz/host/token-intel.agentdiet.dev/llms.txt)
