# Prism (`prism-1`): Image tagging and image embeddings

Tag images with any labels, or embed them for search.

Prism scores an image against labels you choose ("invoice", "receipt", "selfie", "screenshot") with no training. It can also return an image embedding, and embed text queries into the same space, so "red sneakers on a beach" finds the right photo.

It's a good first filter in an upload flow: is this a document, a product photo, a meme or a person?

- **Price:** $0.10 per 1,000 images. One unit per image; every 10 `texts` add one unit.
- **Languages:** Labels and text queries in English
- **Input:** An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB.
- **Batch:** no, one input per call
- **Status:** live
- **Built on:** [openai/clip-vit-base-patch32](https://huggingface.co/openai/clip-vit-base-patch32), MIT, 151M

## Request

```bash
curl https://labs.greatwork.company/v1/run \
  -H "Authorization: Bearer $GWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"prism-1","input":"https://labs.greatwork.company/examples/receipt.png","labels":["a receipt","a selfie","a screenshot","a landscape photo","a pet"]}'
```

Upload a local file with multipart: `curl https://labs.greatwork.company/v1/run -H "Authorization: Bearer $GWL_API_KEY" -F model=prism-1 -F input=@file`

## Options

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `input` | image (URL, data URL or upload) | yes | | An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB. |
| `labels` | string[] | no |  | 2 to 50 labels to score. Plain nouns work best ("a dog", "a cat"). |
| `template` | string | no | `"a photo of {label}"` | Sentence each label is placed in. |
| `embed` | boolean | no | `false` | Return the image's 512-number embedding. |
| `texts` | string[] | no |  | Text queries to embed into the same space (for image search), up to 100. |

## Output

| Field | Type | Description |
|---|---|---|
| `label` | string | Best label (when `labels` is sent). |
| `score` | number | Its probability among your labels. |
| `labels` | object[] | Every label with `score` and raw `similarity`. |
| `embedding` | number[] | 512 floats, normalized (with `embed: true`). |
| `text_embeddings` | number[][] | One vector per entry in `texts`. |

The response envelope is always `{"id", "object": "run", "model", "created", "output", "usage": {"units", "unit", "cost_usd", "cost_micros"}, "latency_ms"}`.

## Examples (real outputs from our servers)

### Upload type

```json
{
  "model": "prism-1",
  "input": "https://labs.greatwork.company/examples/receipt.png",
  "labels": [
    "a receipt",
    "a selfie",
    "a screenshot",
    "a landscape photo",
    "a pet"
  ]
}
```

```json
{
  "label": "a receipt",
  "score": 0.8389,
  "labels": [
    {
      "label": "a receipt",
      "score": 0.8389,
      "similarity": 0.2391
    },
    {
      "label": "a screenshot",
      "score": 0.129,
      "similarity": 0.2203
    },
    {
      "label": "a pet",
      "score": 0.0256,
      "similarity": 0.2042
    },
    {
      "label": "a landscape photo",
      "score": 0.0037,
      "similarity": 0.1848
    },
    {
      "label": "a selfie",
      "score": 0.0029,
      "similarity": 0.1822
    }
  ],
  "width": 560,
  "height": 760
}
```

268 ms, $0.0001.

### Scene

```json
{
  "model": "prism-1",
  "input": "https://labs.greatwork.company/examples/street.jpg",
  "labels": [
    "a city street",
    "a beach",
    "a forest",
    "an office"
  ]
}
```

```json
{
  "label": "a city street",
  "score": 0.9765,
  "labels": [
    {
      "label": "a city street",
      "score": 0.9765,
      "similarity": 0.2746
    },
    {
      "label": "an office",
      "score": 0.0138,
      "similarity": 0.2321
    },
    {
      "label": "a forest",
      "score": 0.0053,
      "similarity": 0.2224
    },
    {
      "label": "a beach",
      "score": 0.0043,
      "similarity": 0.2205
    }
  ],
  "width": 1024,
  "height": 1024
}
```

212 ms, $0.0001.

## Good for

- Sort uploads into documents, photos and screenshots
- Text-to-image search over a photo library
- Find near-duplicate images
- Tag product photos by style

## Limits and caveats

- Scores are relative to the labels you send: always include a catch-all like "something else".
- Not reliable for counting or reading text in images (use Scout and Ink).
