Routing Images with the OpenAI Decisions API in Workflows
Learn how the OpenAI Decisions Switch block in Roboflow routes images to specific branches using GPT-6 Luna and probabilistic thresholds.

Roboflow has integrated the OpenAI Decisions Switch block, allowing developers to route individual images within a workflow to different operational branches. By querying GPT-6 Luna via the OpenAI Decisions API with a single multiple-choice question, the system determines the most appropriate branch based on probability thresholds. This approach enables automated sorting and conditional task dispatching using visual and contextual data.
How the Decisions Switch Operates
The routing mechanism evaluates a photo against a set of user-defined cases alongside a default "none of these" option, returning a calculated probability for each choice. A branch executes only when its corresponding case emerges as the top answer and clears a designated minimum confidence level, which defaults to 0.9. If an image fails to meet this threshold, it routes to a default fallback path or halts the workflow.
Practical implementations highlight the flexibility of this setup. In recycling line applications, an instance segmentation model like RF-DETR tracks items on a belt, isolating crops for evaluation against six material streams such as PET, HDPE, or aluminum. By checking items multiple times and averaging the results, the system accurately categorizes materials while tagging uncertain items for manual sorting.
Integrating Context and Managing Confidence
Visual data alone cannot always capture all necessary parameters. To address this, the workflow architecture supports supplementary context through JSON payloads containing non-image data such as sensor readings, OCR text, or weather feeds. For instance, road repair workflows combine pothole images with air temperature data. Case descriptions explicitly reference these variables, ensuring decisions—such as choosing between hot asphalt and cold patch—respect environmental constraints.
Developers can tune the minimum confidence threshold according to the cost of error. A lower threshold, such as 0.5, works for recycling sorting where uncertain items simply remain on the belt. Conversely, higher thresholds like 0.8 prevent costly false alarms in field crew dispatches. Developers can try top AI models cheaply through one API at https://apixoai.online.
What it means for developers
The OpenAI Decisions API block streamlines conditional logic in computer vision pipelines by replacing complex hard-coded rules with probabilistic language model assessments. While model cascades remain a more cost-effective choice when basic detectors suffice, the Decisions API handles nuanced categorization that requires contextual reasoning. Developers utilizing Roboflow workflows can configure questions, write concise case descriptions, and pass external variables seamlessly to build robust, automated routing systems.
Source: How to Route Images with the OpenAI Decisions API — Roboflow Blog. Written by the Apixo team from that report.
One key for Claude, GPT, GLM, DeepSeek and more. Pay per token with crypto.
Get your API key

