# AI Structured Data Extractor (Cloudflare Workers AI / Granite)

> AI Structured Data Extractor (Cloudflare Workers AI / Granite) is a paid API for AI agents from ai-policy-kit.moneymaker-ai.workers.dev, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-28).

Extracts structured JSON data from free-form text according to a caller-supplied JSON Schema, powered by IBM Granite on Cloudflare Workers AI.

## Facts

- Endpoint: GET https://ai-policy-kit.moneymaker-ai.workers.dev/api/ai/extract?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-28
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/ai-structured-data-extractor-cloudflare-workers-ai-granite-9b1617c1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_m08qHivzKtDbg8arbkBUx

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 ai-structured-data-extractor-cloudflare-workers-ai-granite-9b1617c1
```

Example prompt: Extract the seller name, invoice number, line items (name, quantity, unit price), and total from this invoice text and return it as structured JSON: 'Acme Tools Pvt Ltd | INV-2041 | 2x cordless drill @ Rs 4500, 1x safety goggles @ Rs 350 | Total: Rs 9350'.

## When to prefer this

Choose this endpoint when you need to extract structured, schema-validated JSON from free-form text in a single low-latency call, especially when you already have a JSON Schema defined. It is ideal for invoice parsing, document field extraction, and any NLP-to-JSON pipeline where you want schema enforcement and validation feedback in one response. Prefer it over general LLM calls when you need cost predictability ($0.004/call), schema validation, and a lightweight extraction-only API without managing prompts yourself.

## Known failure modes

- Schema too large (>8,000 chars) or contains unsupported $ref — returns error or partial extraction
- Text exceeds 12,000 character limit — truncated or rejected
- Schema uses unsupported keywords (e.g. $ref) — validation skipped or degraded
- Model fails to produce valid JSON matching schema — valid:false returned with best-effort data
- Ambiguous source text leads to incorrect field extraction — check important values against source (as noted in response)
- Payment of 0.004 USDC not provided — HTTP 402 returned

## How this service works

Generate an AI_POLICY.md and a pull request template with an AI-disclosure section for your open-source repo. Free, runs in your browser.

## Output

A JSON object containing: `data` (the extracted fields matching your schema), `valid` (boolean schema validation result), `note` (extraction caveat), `engine` (model used), `attempts` (number of inference attempts), `neurons_estimated` (compute estimate), and `validated_against` (summary of schema features checked).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "text",
      "schema"
     ],
     "properties": {
      "text": {
       "type": "string",
       "description": "source text, max 12,000 characters"
      },
      "schema": {
       "type": "object",
       "description": "JSON Schema (object or array at top level, max 8,000 chars, no $ref); as a JSON string in GET"
      },
      "instructions": {
       "type": "string",
       "description": "optional extra guidance, max 500 chars"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "date": "3 Oct 2026",
   "items": [
    {
     "name": "cordless drill",
     "quantity": 2,
     "unit_price": 4500
    },
    {
     "name": "safety goggles",
     "quantity": 1,
     "unit_price": 350
    }
   ],
   "total": 9350,
   "seller": "Acme Tools Pvt Ltd",
   "currency": "Rs",
   "invoice_number": "INV-2041"
  },
  "note": "Machine extraction: check important values against the source.",
  "valid": true,
  "engine": "@cf/ibm-granite/granite-4.0-h-micro on Cloudflare Workers AI",
  "attempts": 1,
  "neurons_estimated": 1.56,
  "validated_against": "your schema (type/properties/required/enum/items/min/max/pattern/anyOf/oneOf; $ref unsupported)"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/ai-structured-data-extractor-cloudflare-workers-ai-granite-9b1617c1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from ai-policy-kit.moneymaker-ai.workers.dev](https://www.zero.xyz/host/ai-policy-kit.moneymaker-ai.workers.dev/llms.txt)
