Structured data extraction: text to JSON by your JSON Schema (LLM, validated)
ai_extractStructured extraction task: send text (max 12,000 chars) and a JSON Schema; get back JSON that has been validated against your schema (type, properties, required, enum, items, min/max, pattern, anyOf/oneOf). One automatic repair attempt; if it still does not validate you get 422 and are not charged. Fixed extraction prompt (copy, don't invent). Runs on our Cloudflare Worker using Workers AI (IBM Granite 4.0 micro, Apache-2.0). Not a chat or model-access API. Limited daily capacity: 503 (not charged) when used up. Price: $0.004 USDC on Base per call, paid with x402 (MCP transport: an unpaid call returns the x402 PaymentRequired object; retry with params._meta["x402/payment"]). Same tool over HTTP: POST /api/ai/extract.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | source text, max 12,000 characters | |
| schema | Yes | JSON Schema (object or array at top level, max 8,000 chars, no $ref); as a JSON string in GET | |
| instructions | No | optional extra guidance, max 500 chars |