# Mold (`mold-1`): Structured extraction (JSON from text)

Messy text in, JSON that matches your schema out.

Mold reads an email, invoice text, listing or message and fills in a JSON Schema you send. The answer always parses and always has every field: anything the text doesn't say comes back `null` instead of an invented value.

Describe tricky fields in the schema (`"description": "ISO date"`) or add `instructions`. Best for 2 to 20 fields from text up to a couple of pages.

- **Price:** $0.40 per 1,000 texts. One unit per started 2,000 characters of input.
- **Languages:** ~30 languages
- **Input:** The text to read (string or array of up to 8, up to 6,000 characters each).
- **Batch:** yes, up to 8 inputs per call
- **Status:** live
- **Built on:** [Qwen/Qwen3-0.6B (with JSON-schema constrained decoding)](https://huggingface.co/Qwen/Qwen3-0.6B), Apache-2.0, 0.6B

## Request

```bash
curl https://labs.greatwork.company/v1/run \
  -H "Authorization: Bearer $GWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"mold-1","input":"Hi team, this is Maria Gonzalez from Acme Logistics. Our invoice INV-2291 for $4,380.50 is due on March 3rd 2026. Call me at (415) 555-0137 if anything looks off.","schema":{"type":"object","properties":{"name":{"type":"string"},"company":{"type":"string"},"invoice_number":{"type":"string"},"amount":{"type":"number"},"due_date":{"type":"string","description":"ISO date YYYY-MM-DD"},"phone":{"type":"string"}}}}'
```

## Options

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `input` | string or string[] | yes | | The text to read (string or array of up to 8, up to 6,000 characters each). |
| `schema` | object | yes |  | JSON Schema with `"type": "object"` and `properties`. Strings, numbers, integers, booleans, enums, arrays and nested objects work. |
| `instructions` | string | no |  | Extra guidance, e.g. "amounts in cents" or "use the billing address, not shipping". |

## Output

| Field | Type | Description |
|---|---|---|
| `data` | object | An object matching your schema. Fields the text doesn't mention are null. |

The response envelope is always `{"id", "object": "run", "model", "created", "output", "usage": {"units", "unit", "cost_usd", "cost_micros"}, "latency_ms"}`. With an array input, `output` is an array in the same order.

## Examples (real outputs from our servers)

### Invoice email

```json
{
  "model": "mold-1",
  "input": "Hi team, this is Maria Gonzalez from Acme Logistics. Our invoice INV-2291 for $4,380.50 is due on March 3rd 2026. Call me at (415) 555-0137 if anything looks off.",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string"
      },
      "company": {
        "type": "string"
      },
      "invoice_number": {
        "type": "string"
      },
      "amount": {
        "type": "number"
      },
      "due_date": {
        "type": "string",
        "description": "ISO date YYYY-MM-DD"
      },
      "phone": {
        "type": "string"
      }
    }
  }
}
```

```json
{
  "data": {
    "name": "Maria Gonzalez",
    "company": "Acme Logistics",
    "invoice_number": "INV-2291",
    "amount": 4380.5,
    "due_date": "2026-03-03",
    "phone": "(415) 555-0137"
  }
}
```

8380 ms, $0.0004.

### Apartment listing

```json
{
  "model": "mold-1",
  "input": "Sunny 2BR/1BA in Capitol Hill, 850 sq ft, $2,150/mo. Cats OK, no dogs. In-unit washer/dryer. Available Dec 1.",
  "schema": {
    "type": "object",
    "properties": {
      "bedrooms": {
        "type": "integer"
      },
      "bathrooms": {
        "type": "number"
      },
      "square_feet": {
        "type": "integer"
      },
      "rent": {
        "type": "number"
      },
      "neighborhood": {
        "type": "string"
      },
      "cats_allowed": {
        "type": "boolean"
      },
      "dogs_allowed": {
        "type": "boolean"
      },
      "laundry": {
        "type": "string",
        "enum": [
          "in-unit",
          "shared",
          "none"
        ]
      }
    }
  }
}
```

```json
{
  "data": {
    "bedrooms": 2,
    "bathrooms": 1,
    "square_feet": 850,
    "rent": 2150,
    "neighborhood": "Capitol Hill",
    "cats_allowed": true,
    "dogs_allowed": false,
    "laundry": "in-unit"
  }
}
```

6367 ms, $0.0004.

## Good for

- Pull order details out of emails
- Turn listing descriptions into filterable fields
- Read contact details from signatures
- Fill a CRM from inbound forms written as prose

## Limits and caveats

- A small model: it copies and normalizes well, it doesn't reason. Calculated fields (totals, ages from birth dates) can be wrong.
- Keep schemas under about 30 fields.
