🌍 Become a marimo ambassador!

Apply
90 / 103
OpenRouter Image Bakeoff

OpenRouter Image Bakeoff

by marimo team

Compare image-generation models side-by-side through OpenRouter, with optional sketch-based prompting.

About this notebook

This notebook compares image-generation models through the OpenRouter API. It has no fixed dataset. The reader supplies a text prompt and an optional sketch. The code uses the openai library for the calls and PIL for the images. The wigglystuff library provides the API-key widget and the drawing widget. marimo builds the interface.

The reader picks three models from dropdowns and types a prompt. A separate dropdown sets the aspect ratio. The reader can draw a reference image with the Paint widget. The reader then clicks Generate. The notebook shows the three results next to each other. Each result shows the model name, the elapsed seconds, and the cost. The reader clicks "Use this" under one image to move it to stage 2. In stage 2 the reader draws annotations on the chosen image and generates refinements.

The three model calls run at the same time through asyncio.gather. So the wall time is about the slowest model, not the sum. The code reaches OpenRouter by passing extra_body with modalities set to image. The model list includes Seedream, Gemini, FLUX, GPT-5 image, and Stable Diffusion 3.5. The EnvConfig widget checks the OPENROUTER_API_KEY before the run.

Related notebooks