Reference · How-to · ~10 min

How to call a vision API

Last updated

Send an image + question in one request, then verify before any side effect.

Send an image + question in one request, then verify before any side effect.

#Prerequisites

  • Vision-capable model ID
  • Image you are allowed to upload (strip secrets from screenshots)
  • Clear acceptance test (“list the three prices visible”)

#Steps

1. **Resize** large images; strip sensitive EXIF / metadata.

2. **Encode** as base64 or host behind a short-lived signed URL.

3. **Build** a user message with text + image parts (provider schema varies).

4. **Constrain** the answer: only visible evidence; mark unclear regions.

5. **Parse** the text response; never auto-execute tool calls from vision guesses.

6. **Verify** critical fields against the image yourself on a sample.

#Copy-paste prompt pattern

Only use what is visible in the image.
If text is unreadable, write [unclear] instead of guessing.
Return: bullet list of items + any prices exactly as printed.

#Failure notes

  • Model invents UI text that is not in the screenshot
  • Tiny fonts after over-aggressive compression
  • Sending ID photos or customer PII into a public vendor
  • **Try the lesson:** `multimodal-api-lab` in Lane D · Glossary: [multimodal](/reference/multimodal)