Recipes

Overview

Complete, runnable solutions to things people actually build. Each recipe is one file you can paste into a project — no framework, no scaffolding.

The recipes#

RecipeShows you
A streaming chatbotStreaming to a browser without exposing your key, and keeping the conversation.
Extract structured dataTurning messy documents into rows that match a schema, with validation.
Read a screenshotSending an image and asking a specific question about it.
Handle errors and retriesA production-grade wrapper: what to retry, what never to, and how to back off.

Read these two first

Quickstart gets you a working call; Errors is the one page that will save you the most time. Everything here assumes both.

Conventions in these examples#

Every recipe reads the key from UPFYN_API_KEY, runs server-side, and sets max_retries=0 so retry policy is explicit rather than inherited. Model choices are deliberate and explained where they matter.