Skip to main content

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

Body

    model NomicVisionEmbeddingModel

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

    An enumeration.

    urls string[]
    images binary[]

    A batch of image bytes you want to embed

Responses

Successful Response

Schema

    embeddings array[]required

    The embeddings

    usage

    object

    required

    prompt_tokens Prompt Tokens (integer)required

    The number of non-generated tokens ingested.

    total_tokens Total Tokens (integer)required

    The total tokens used.

    model NomicVisionEmbeddingModelrequired

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

    An enumeration.

Loading...