Embed Image
POST/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
Responses
- 200
- 422
Successful Response
Validation Error