{"slug": "how-to-route-images-with-the-openai-decisions-api", "title": "How to Route Images with the OpenAI Decisions API", "summary": "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.", "body_md": "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.\n\nHow the switch works\n\nThe answer options are your cases plus a built-in \"none of these\", and the API returns a probability for each.\n\nExample 1: sort a recycling line\n\nRF-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.\n\nThe 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.\n\nExample 2: add non-image data with context\n\nCrews 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.\"\n\nResults at min_confidence 0.8:\n\nPhoto\n\nAir temperature (°C)\n\nModel's answer\n\nProbability\n\nWhat ran\n\nPothole on a rural road\n\n20\n\nhot_asphalt_repair\n\n0.99\n\nPaving crew\n\nThe same photo\n\n4\n\ncold_patch\n\n0.95\n\nPothole patrol\n\nDry, intact asphalt\n\n20\n\nnone of these\n\n0.65\n\nNothing\n\nClose-up of snow with tire tracks\n\n-3\n\nspread_salt\n\n0.65\n\nNothing (below 0.8)\n\nThe 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.\n\nBlock settings\n\nA 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.\n\nYou 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.\n\nIf a detector can make the decision, a model cascade is cheaper.\n\nChoosing min_confidence\n\nRaising 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.\n\nSet 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.\n\nTry it\n\nAdd the OpenAI Decisions Switch block to a workflow and connect images.\n\nWrite the question, add one case per action, and describe each in one sentence.\n\nSet Default Next Steps and Min Confidence.\n\nTest 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.\n\nThe 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.", "url": "https://wpnews.pro/news/how-to-route-images-with-the-openai-decisions-api", "canonical_source": "https://roboflow.com/blog/how-to-route-images-with-the-openai-decisions-api", "published_at": "2026-11-25 20:35:11+00:00", "updated_at": "2026-11-25 20:43:27.143357+00:00", "lang": "en", "topics": ["computer-vision", "ai-agents", "ai-tools", "generative-ai"], "entities": ["Roboflow", "OpenAI", "GPT-6 Luna", "OpenAI Decisions API", "RF-DETR"], "also_reported_by": [], "takeaway": "The OpenAI Decisions Switch block runs a branch only when its answer is the top choice and its probability is at least min_confidence (default 0.9), otherwise sending the image to default_next_steps, and passing non-image facts such as air_temperature_c through the context field lets case descriptio", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/how-to-route-images-with-the-openai-decisions-api", "markdown": "https://wpnews.pro/news/how-to-route-images-with-the-openai-decisions-api.md", "text": "https://wpnews.pro/news/how-to-route-images-with-the-openai-decisions-api.txt", "jsonld": "https://wpnews.pro/news/how-to-route-images-with-the-openai-decisions-api.jsonld"}}