/query

Ask questions about images and get natural language answers.

Quick Start

First, install the package:

pip install moondream pillow

Place an image file in your working directory, then:

import moondream as md
from PIL import Image
 
# Initialize with API key
model = md.vl(api_key="your-api-key")
 
# Load an image
image = Image.open("path/to/image.jpg")
 
# Ask a question
answer = model.query(image, "What's in this image?")["answer"]
print("Answer:", answer)
 
# Stream the response
for chunk in model.query(image, "What's in this image?", stream=True)["answer"]:
    print(chunk, end="", flush=True)

The client libraries provide the simplest integration for working with the Moondream API.