AI Output Warranty
+ Controlled Repair

Validate AI-generated outputs against hard, deterministic rules — schema, arithmetic, consistency — and fix violations with bounded LLM calls.

Get API Key → Read Docs

Why Guardail?

Your AI outputs need a warranty. Guardail provides deterministic validation that catches errors before they reach production.

📋

Schema Enforcement

Validate JSON structure against your schema. Required fields, correct types, no unexpected keys — deterministically checked.

🔢

Arithmetic Sanity

Catch math errors automatically. Subtotal + VAT ≠ Total? Line items don't sum? We flag it.

🔍

Consistency Checks

Detect hallucinations. Numbers, dates, and entities in the output should exist in the source input.

🔧

Bounded Repair

Optionally fix violations with LLM calls. BYOK for unlimited, or use our capped fallback token.

<50ms Edge Latency

Validation runs locally on Cloudflare's edge. No LLM round-trip needed for warranty checks.

💰

Cost Control

Warranty checks are free. Repair is BYOK or quota-capped. Zero surprise bills.

How It Works

One POST request. Three validation rules. Optional repair.

1

Send Output

POST your AI output along with the original input and your expected schema.

2

Validate

Guardail checks structure, arithmetic, and consistency against objective rules.

3

Repair (Optional)

If validation fails and repair is enabled, an LLM attempts to fix the violations.

4

Get Result

Receive validated output with status (pass/failed/repaired) and any warnings.

Simple API

One endpoint. Clear request/response format.

curl -X POST "https://guardail-api.workers.dev/v1/guard" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_SECRET" \
  -d '{
    "input": "Invoice INV-001 subtotal £83.33 VAT £16.67 total £100",
    "output": {
      "invoice_number": "INV-001",
      "subtotal": 83.33,
      "vat": 16.67,
      "total": 100
    },
    "schema": {
      "invoice_number": "string",
      "subtotal": "number",
      "vat": "number",
      "total": "number"
    },
    "policy": {
      "rules": ["structure", "arithmetic"],
      "repair": false
    }
  }'

// Response
{
  "ok": true,
  "status": "pass",
  "output": { ... },
  "violations": [],
  "warnings": [],
  "meta": {
    "request_id": "abc123",
    "latency_ms": 12
  }
}

Validation Rules

Three objective rules that catch real problems.

Rule Type What It Checks
structure Error JSON validity, schema match, required fields, correct types, no extra keys (strict mode)
arithmetic Error subtotal + vat = total, sum(line_items.amount) = total
consistency Warning Numbers, dates, and entities in output should exist in input

Ready to Validate Your AI Outputs?

Get started in minutes with our simple API.

Get API Key →