{"uid":"cap_m08qHivzKtDbg8arbkBUx","slug":"ai-structured-data-extractor-cloudflare-workers-ai-granite-9b1617c1","name":"AI Structured Data Extractor (Cloudflare Workers AI / Granite)","description":"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.","url":"https://ai-policy-kit.moneymaker-ai.workers.dev/api/ai/extract?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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"}}}}},"responseSchema":{"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)"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_yKPxirzRyXGgR_IFT2lJ6","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Extracts structured JSON data from free-form text according to a caller-supplied JSON Schema, powered by IBM Granite on Cloudflare Workers AI.","exampleAgentPrompt":"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'.","exampleUseCases":[{"title":"Invoice data extraction pipeline","prompt":"Parse this invoice text and pull out the vendor name, invoice number, each line item with quantity and price, the total amount, and the currency — return it all as a structured JSON object: 'TechSupply Co | INV-00882 | 5x USB-C cable @ $12.00, 2x monitor stand @ $45.00 | Total: $150.00'."},{"title":"Job posting field parser","prompt":"Extract the job title, company name, location, required skills (as a list), and salary range from this job posting text and give me back a clean JSON object: 'Senior Backend Engineer at Stripe, San Francisco CA. Skills: Python, Postgres, Kafka. Salary: $160k–$200k.'"},{"title":"Contract clause structuring","prompt":"Pull out the start date, end date, party names, and payment terms from this contract snippet and return them as structured JSON: 'This agreement between Acme Corp and Buildright LLC commences January 1 2025 and ends December 31 2025. Payment due net-30 upon invoice.'"}],"resultDescription":"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).","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-28T06:39:40.103Z","isFirstParty":false,"canonicalSlug":"ai-structured-data-extractor-cloudflare-workers-ai-granite-9b1617c1"}