Prism 2 scores an image against labels you choose ("invoice", "receipt", "selfie", "screenshot") with no training, and can return an image embedding and embed text queries into the same space. It takes the same options and returns the same fields as Prism 1, so you switch by changing the model id.
It is much more accurate. In our tests it tagged everyday photos with 0.883 mean average precision (Prism 1: 0.719), named the right breed for 94.7% of photos across 37 cat and dog breeds (Prism 1: 86.5%), and found the right caption for a photo first 90% of the time (Prism 1: 75%).
Choose Prism 1 instead when speed matters more than accuracy (it runs about 2.5 times faster per image), when your labels or queries aren't in English, or when you already store Prism 1 embeddings: the two models' vectors live in different spaces and can't be mixed.
Use it
curl https://labs.greatwork.company/v1/run \
-H "Authorization: Bearer $GWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "prism-2",
"input": "https://labs.greatwork.company/examples/receipt.png",
"labels": [
"a receipt",
"a selfie",
"a screenshot",
"a landscape photo",
"a pet"
]
}'const res = await fetch("https://labs.greatwork.company/v1/run", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GWL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "prism-2",
"input": "https://labs.greatwork.company/examples/receipt.png",
"labels": [
"a receipt",
"a selfie",
"a screenshot",
"a landscape photo",
"a pet"
]
}),
});
const { output, usage } = await res.json();import os, requests
res = requests.post(
"https://labs.greatwork.company/v1/run",
headers={"Authorization": f"Bearer {os.environ['GWL_API_KEY']}"},
json={
"model": "prism-2",
"input": "https://labs.greatwork.company/examples/receipt.png",
"labels": [
"a receipt",
"a selfie",
"a screenshot",
"a landscape photo",
"a pet"
]
},
)
output = res.json()["output"]# Send a local file instead of a URL
curl https://labs.greatwork.company/v1/run \
-H "Authorization: Bearer $GWL_API_KEY" \
-F model=prism-2 \
-F input=@photo.jpgSet GWL_API_KEY to a key from your dashboard. The bare name prism works too and follows new versions.
Options
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.
| Name | Type | Default | What it does |
|---|---|---|---|
labels | string[] | 2 to 50 labels to score. Plain nouns work best ("a dog", "a cat"). | |
template | string | "a photo of {label}" | Sentence each label is placed in. |
embed | boolean | false | Return the image's 768-number embedding. |
texts | string[] | Text queries to embed into the same space (for image search), up to 100. |
Output
| Field | Type | Meaning |
|---|---|---|
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[] | 768 floats, normalized (with embed: true). |
text_embeddings | number[][] | One 768-float vector per entry in texts. |
Every response wraps this in {"id", "model", "output", "usage": {"units", "unit", "cost_usd"}, "latency_ms"}.
Examples
Upload type
{
"model": "prism-2",
"input": "/examples/receipt.png",
"labels": [
"a receipt",
"a selfie",
"a screenshot",
"a landscape photo",
"a pet"
]
}{
"label": "a receipt",
"score": 0.9986,
"labels": [
{
"label": "a receipt",
"score": 0.9986,
"similarity": 0.1528
},
{
"label": "a screenshot",
"score": 0.0014,
"similarity": 0.0872
},
{
"label": "a landscape photo",
"score": 0,
"similarity": 0.0296
},
{
"label": "a pet",
"score": 0,
"similarity": 0.0238
},
{
"label": "a selfie",
"score": 0,
"similarity": 0.0231
}
],
"width": 560,
"height": 760
}Captured on our production servers: 302 ms, 1 image, $0.00025.
Scene
{
"model": "prism-2",
"input": "/examples/street.jpg",
"labels": [
"a city street",
"a beach",
"a forest",
"an office"
]
}{
"label": "a city street",
"score": 0.9982,
"labels": [
{
"label": "a city street",
"score": 0.9982,
"similarity": 0.1275
},
{
"label": "an office",
"score": 0.0017,
"similarity": 0.064
},
{
"label": "a beach",
"score": 0,
"similarity": 0.0271
},
{
"label": "a forest",
"score": 0,
"similarity": 0.0064
}
],
"width": 1024,
"height": 1024
}Captured on our production servers: 266 ms, 1 image, $0.00025.
Pet or not
{
"model": "prism-2",
"input": "/examples/dog.jpg",
"labels": [
"a dog",
"a cat",
"a bird",
"no animal"
]
}{
"label": "a dog",
"score": 0.9934,
"labels": [
{
"label": "a dog",
"score": 0.9934,
"similarity": 0.1187
},
{
"label": "no animal",
"score": 0.0038,
"similarity": 0.063
},
{
"label": "a cat",
"score": 0.0017,
"similarity": 0.0548
},
{
"label": "a bird",
"score": 0.0012,
"similarity": 0.0514
}
],
"width": 1024,
"height": 765
}Captured on our production servers: 253 ms, 1 image, $0.00025.
Room type
{
"model": "prism-2",
"input": "/examples/desk.jpg",
"labels": [
"a home office",
"a kitchen",
"a bedroom",
"a store"
]
}{
"label": "a home office",
"score": 0.9991,
"labels": [
{
"label": "a home office",
"score": 0.9991,
"similarity": 0.1332
},
{
"label": "a bedroom",
"score": 0.0004,
"similarity": 0.0553
},
{
"label": "a kitchen",
"score": 0.0003,
"similarity": 0.052
},
{
"label": "a store",
"score": 0.0001,
"similarity": 0.0449
}
],
"width": 1024,
"height": 765
}Captured on our production servers: 248 ms, 1 image, $0.00025.
Good for
- Tag product photos by style with labels you choose
- Text-to-image search over a photo library
- Sort uploads into documents, photos and screenshots
- Find near-duplicate images
Limits and caveats
- Languages: Labels and text queries in English
- Scores are relative to the labels you send: always include a catch-all like "something else".
- Embeddings are not compatible with Prism 1's: re-embed your library (images and text queries) when you switch.
- Labels and queries in English only; use Prism 1 for other languages.
- Not reliable for counting or reading text in images (use Scout and Ink).
Pricing
$0.25 per 1,000 images. One unit per image; every 10 `texts` add one unit. Failed calls aren't charged, and a call never costs more than its estimate (POST /v1/estimate tells you before you run it).
