← Back to Docs

Recipe: QR code decoder + handler

Vision model decodes QR payloads and routes them through a configurable handler chain — no native scanner SDK required.

Architecture

  • Image upload → base64 encode → vision model prompt
  • Model returns raw payload string + inferred content type
  • Handler router dispatches: URL → open, vCard → save, WiFi → connect
  • Fallback: display raw text with copy-to-clipboard

Prompt template

You are a QR code decoder. Analyze the image.
Return JSON:
{
  "payload": "<decoded string>",
  "type": "url" | "vcard" | "wifi" | "text"
}
If no QR code found, return { "error": true }.

Handler routing table

TypeAction
urlOpen in default browser
vcardParse fields → save to contacts
wifiExtract SSID/pass → trigger connection
textDisplay with copy button
← All recipesRequires vision-capable model endpoint