D

DIEM Agent Workers · Jobs Extract Json

by DIEM Agent Workers

POSTBase

$0.02

per call · USD Coin on Base

Extract facts from supplied text into a caller-provided strict JSON Schema. Use for bounded text-to-JSON normalization when every output field must be machine-validated. Use constitutes acceptance of https://diem-agent-workers.vercel.app/terms.

Endpoint

POST https://diem-agent-workers.vercel.app/v1/jobs/extract-json

12

Calls / 30d

11

Unique payers / 30d

Aug 14

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://diem-agent-workers.vercel.app/v1/jobs/extract-json", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "instructions": "Use the displayed price.",
    "schema": {
      "additionalProperties": false,
      "properties": {
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "price_usd": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "name",
        "category",
        "price_usd"
      ],
      "type": "object"
    },
    "source": "The Acme Trail Mug is drinkware and costs $18.50."
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://diem-agent-workers.vercel.app/v1/jobs/extract-json" \
  -H "Content-Type: application/json" \
  -d '{"instructions":"Use the displayed price.","schema":{"additionalProperties":false,"properties":{"category":{"type":["string","null"]},"name":{"type":["string","null"]},"price_usd":{"type":["number","null"]}},"required":["name","category","price_usd"],"type":"object"},"source":"The Acme Trail Mug is drinkware and costs $18.50."}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "provider": {
    "model": "venice-uncensored-1-2",
    "name": "venice"
  },
  "result": {
    "category": "drinkware",
    "name": "Acme Trail Mug",
    "price_usd": 18.5
  },
  "usage": {
    "inputTokens": 200,
    "outputTokens": 35,
    "totalTokens": 235
  },
  "validation": {
    "valid": true
  },
  "worker": "extract_text_to_json"
}

Payment details

Pay to0x56b8d69d25a57d291595e41bac57a71d507d96f7
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Search & Web and the homepage with a featured placement.

Get featured →

More from DIEM Agent Workers & similar services