Skip to main content

Overview

Veri computes a SHA-256 hash of every image submitted for detection. The imageHash and cached fields are included in every response to support future caching infrastructure.
Caching is not yet active. The cached field is currently always false. When caching is enabled, previously analyzed images will return instantly without consuming credits.

How It Will Work

  1. When you submit an image, Veri computes a SHA-256 hash of the image data
  2. If a cached result exists for that hash, it will be returned immediately
  3. If not, the image is processed and the result is stored

Identifying Cached Results

Check the cached field in the response:
result = client.detect(image)

if result.cached:
    print("Result from cache")
    print(f"Original detection: {result.timestamp}")
else:
    print("Fresh detection")

Image Hashing

The image hash is based on the raw image bytes. This means:
  • Same image, different format → Different hash → Analyzed separately
  • Resized image → Different hash → Analyzed separately
  • Identical bytes → Same hash → Will use cache when available
# These would be hashed separately (different bytes)
result1 = client.detect(image_as_jpeg)
result2 = client.detect(image_as_png)

Best Practices

  1. Use original images - Don’t re-encode before sending to maximize future cache hits
  2. Store the image hash - Use result.image_hash to track what you’ve analyzed