Skip to main content

Embed Image

posthttps://api-atlas.nomic.ai/v1/embedding/image

Generate embeddings from images in .png, .jpeg, or .webp formats.

Images can be provided either as:

  • Files (filepaths or raw image bytes)

  • URLs

curl

Embedding image files using curl:

curl -X POST "https://api-atlas.nomic.ai/v1/embedding/image" \
-H "Authorization: Bearer $NOMIC_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "model=nomic-embed-vision-v1.5" \
-F "images=@path/to/image1.jpg" \
-F "images=@path/to/image2.jpg"

Embedding images via URLs using curl:

curl -X POST "https://api-atlas.nomic.ai/v1/embedding/image" \
-H "Authorization: Bearer $NOMIC_API_KEY" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "model=nomic-embed-vision-v1.5" \
-d "urls=https://static.nomic.ai/secret-model.png" \
-d "urls=https://static.nomic.ai/secret-model-2.png"

nomic Python library

Embeddings image files using the nomic Python library:

from nomic import embed

output = embed.image(
images=['path/to/image1.jpg', 'path/to/image2.jpg'],
model='nomic-embed-vision-v1.5',
)

print(output)

Embedding images via URLs using the nomic Python library:

from nomic import embed

output = embed.image(
images=[
"https://static.nomic.ai/secret-model.png",
"https://static.nomic.ai/secret-model-2.png"
],
model="nomic-embed-vision-v1.5"
)

print(output)

requests Python library

Embedding image files using the requests Python library (note that this option requires image bytes rather than image files):

import requests
import os

auth_header = "Bearer " + os.environ["NOMIC_API_KEY"]

image_filepaths = ["path/to/image1.jpg", "path/to/image2.jpg"]
image_bytes = []
for fpath in image_filepaths:
with open(fpath, "rb") as f:
image_bytes.append(("images", f.read()))

response = requests.post(
"https://api-atlas.nomic.ai/v1/embedding/image",
headers=dict(Authorization=auth_header),
data=dict(model="nomic-embed-vision-v1.5"),
files=image_bytes
)

print(response.json())

Embedding images via URLs using the requests Python library:

import requests
import os

auth_header = "Bearer " + os.environ["NOMIC_API_KEY"]

response = requests.post(
"https://api-atlas.nomic.ai/v1/embedding/image",
headers=dict(Authorization=auth_header),
data=dict(
model="nomic-embed-vision-v1.5",
urls=[
"https://static.nomic.ai/secret-model.png",
"https://static.nomic.ai/secret-model-2.png"
]
)
)

print(response.json())

Request​

Body multipart/form-data

modelstring

The model to use when embedding.

Possible values: nomic-embed-vision-v1, nomic-embed-vision-v1.5

urlsarray<string>
imagesarray<string ($binary)>

A batch of image bytes you want to embed

Responses​

200Successful Response
embeddingsarray<array<number>>*required

The embeddings

usageobject*required

The embedding usage

prompt_tokensinteger*required

The number of non-generated tokens ingested.

total_tokensinteger*required

The total tokens used.

modelstring*required

The model used to produce the embeddings.

Possible values: nomic-embed-vision-v1, nomic-embed-vision-v1.5

422Validation Error

Examples​

curl
curl -X 'POST' \
'https://api-atlas.nomic.ai/v1/embedding/image' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <token>'
Nomic
from nomic import embed

output = embed.image(
images=['path/to/image1.jpg', 'path/to/image2.jpg'],
model='nomic-embed-vision-v1.5',
)

print(output)
Shell
curl -X POST "https://api-atlas.nomic.ai/v1/embedding/image" \
-H "Authorization: Bearer $NOMIC_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "model=nomic-embed-vision-v1.5" \
-F "images=@/path/to/image1.jpg" \
-F "images=@/path/to/image2.jpg"