Build garageTry it → read → next · ~10 min

Tutorials · Chapter D (4/4) · ~10 min

Multimodal API lab

Try it → see it → read → next

Send **image + text** in one chat request — vision models read pixels, you verify outputs.

On paths: Builder · Student

Try tools: Code & developers

Try yourself

Playground

Vision API wiring

Image in → text out — same chat API, multimodal message parts.

  1. Base64 or URL-encode image
  2. User message with image + text parts
  3. POST chat/completions with vision model
  4. Parse text answer — verify before act

Recap

What you just did

You stepped through encode → multimodal message → API call → parse.

Read

Message shape

{
  "role": "user",
  "content": [
    { "type": "text", "text": "What's in this diagram?" },
    { "type": "image_url", "image_url": { "url": "data:image/png;base64,..." } }
  ]
}

Read

Safety

  • Don't log raw customer images
  • Block EXIF/metadata leaks in public demos