How to Route Images with the OpenAI Decisions API Roboflow introduced an OpenAI Decisions Switch block that routes each image in a Roboflow Workflow to one of several branches by asking GPT-6 Luna on the OpenAI Decisions API a single multiple-choice question and running the branch whose answer clears a probability threshold. In a test on 100 photos from a public garbage dataset with six classes as cases, the block sorted recycling items into PET, HDPE, film, multilayer, paper or aluminum streams, and a road-maintenance workflow using air_temperature_c as context routed a 20 °C pothole photo to hot_asphalt_repair at 0.99 probability while a -3 °C snow close-up scored 0.65 for spread_salt and ran nothing at min_confidence 0.8. Roboflow recommends setting min_confidence by the cost of a wrong route — 0.5 for recycling items that fall back to manual sorters, 0.8 for road dispatch — and bills the block in Roboflow credits by default or the user's own OpenAI key, with each photo one request of a few hundred to a few thousand input tokens. The OpenAI Decisions Switch block routes each image in a Roboflow Workflow to one branch. It prompts GPT-6 Luna on the OpenAI Decisions API with one multiple-choice question about the image, then runs the branch whose answer clears a probability threshold. The two examples below sort items on a recycling line and dispatch road crews based on the air temperature. How the switch works The answer options are your cases plus a built-in "none of these", and the API returns a probability for each. Example 1: sort a recycling line RF-DETR instance segmentation segments and tracks every item on the belt. The switch gets a crop of each item, outlined in magenta so overlapping items don't confuse it, and picks one of six streams: PET, HDPE, film, multilayer, paper or aluminum. The video calls the Decisions API directly to draw the probabilities, checks each item three times as it moves, and averages the answers. Gray tags mark items whose top stream stayed below 0.5. Example 2: add non-image data with context Crews pave potholes with hot asphalt only in warm weather 10 °C or above here and use cold patch otherwise. The photo can't show the temperature, so the workflow takes air temperature c from a weather feed and passes it in context. The case descriptions refer to it by name. For example, cold patch reads: "The road has potholes or a broken surface but air temperature c is below 10, too cold for hot asphalt, so fill them with cold patch for now." Results at min confidence 0.8: Photo Air temperature °C Model's answer Probability What ran Pothole on a rural road 20 hot asphalt repair 0.99 Paving crew The same photo 4 cold patch 0.95 Pothole patrol Dry, intact asphalt 20 none of these 0.65 Nothing Close-up of snow with tire tracks -3 spread salt 0.65 Nothing below 0.8 The snow close-up scored 0.65 for spread salt, below 0.8, so nothing ran. In production, route default next steps to a dispatcher. context accepts any workflow value, such as a sensor reading, OCR text or a detection count. Block settings A case runs when it is the top answer and its probability is at least min confidence default 0.9 . Otherwise the image goes to default next steps, or the workflow stops if that list is empty. At most one branch runs per image. You set a question, the cases each pointing at the first step of its branch , a one-sentence case descriptions entry per case, and optional context: named values sent with the image as JSON, for facts the image can't show. If a detector can make the decision, a model cascade is cheaper. Choosing min confidence Raising min confidence trades wrong routes for more photos in review. We measured it on 100 photos from a public garbage dataset, with its six classes as cases. Set it by the cost of a wrong route. An unsure recycling item stays on the belt for the manual sorters, so 0.5 is enough. A wrong road dispatch sends a crew out for nothing, so that workflow uses 0.8. To see probabilities while tuning, run the OpenAI Decisions block in questions mode with the same question; its answers output lists each option's probability. Try it Add the OpenAI Decisions Switch block to a workflow and connect images. Write the question, add one case per action, and describe each in one sentence. Set Default Next Steps and Min Confidence. Test on real photos with sinks disabled wire a dry run input to each sink's disable sink . If good photos land in review, fix the descriptions before lowering the threshold. The block bills Roboflow credits by default, or your own OpenAI key. Each photo is one request with a few hundred to a few thousand input tokens.