01 / Meet the game
Which lane should the car take? Look at the road. The gap is on the left. Can a model spot it too?
We will send this picture to a model, read its answer, and use that answer to steer.
Image input Typed answers Live control
This is a real frame from our game. Which lane would you choose?
Start with the picture. Ask students to name the open lane before introducing the API. The screenshot is real, but this deck is a recorded lesson; it does not make API calls. We will launch the live game at the end.
02 / Start with the names
A model answers. An API lets our code ask. We need to separate the model, the way we call it, and the code that uses its answer.
LM / LLM Language in, text out A language model works with text. We can give it a JSON description of the road and ask which lane to take.
{ "blocked": ["middle", "right"] } VLM It can read the picture A vision-language model also accepts images. It has to recognize the blocks before choosing a lane.
Road picture → lane answer
API The software interface Our program sends a request and reads a response. The API defines the fields; a model evaluates the input.
Request → model → response
Then our code acts. The returned answer does not move the car by itself. Our controller validates it and chooses when to apply it.
LM means language model; LLM means large language model. VLM means vision-language model. JSON is text with named fields, not a separate visual modality. API means application programming interface: the agreement between programs about requests and responses. A VLM can return ordinary text or structured JSON. The output format and the model's input capability are separate choices.
03 / The idea behind Decisions
Ask a small question with known answers. Instead of asking for a description, tell the API what decision our program needs.
01 · STATE What do we know? Send the road image, or a JSON description of the current scene.
state: image or JSON 02 · QUESTION What do we need? “Which lane is open?” Give the allowed labels and what each means.
left · middle · right 03 · ANSWER What did it choose? Read the typed answer and its probability fields. Our code decides what to do next.
{ "choice": "left", … }
Good for repeated decisions. Choose a lane, route an item, or flag something for review. The question stays fixed while the input changes.
Request format: OpenRouter Decisions reference
The API takes state and named questions. In this demo the question types are choice, noul and score, explained shortly. Calling this an API does not mean it is a separate robot or autonomous agent. There is no automatic control loop: our application repeatedly captures state, sends the request, reads the result and applies its policy. A typed answer can still be wrong.
04 / Model, provider and interface
Jev is one model we can call. Jev is made by TypeSafe. In this demo, it reads text or structured JSON and returns typed decisions.
THE INTERFACE Decisions API Defines the request and answer contract: state, questions and typed results.
/api/alpha/decisionsTHE MODELS Jev, Luna and Clef Different models can serve the same contract. Jev uses JSON here; Luna and Clef can also use the image.
Choose the model in the dropdown.
THE ROUTER OpenRouter Our app sends the request through OpenRouter to the selected model's provider.
One connection, several model choices.
Keep these choices separate. Changing the model can change speed, cost and accuracy even when the question and API stay the same.
Jev model and supported input · Clef-flash model and supported input
Jev is the model name, not the Java programming language. This project uses JavaScript in the browser and Python for local measurement; Java is not required. TypeSafe describes Jev as a structured decision model. OpenRouter is the service through which this demo reaches it. A Decisions-compatible model need not support images, and a model's latency is not an API guarantee.
05 / The task
Find the gap, then move the car. Each barrier has one open lane. Our job is to reach it before the car hits the blocks.
01 See Capture the road as a PNG.
→ 02 Ask Ask which lane is open.
→ 03 Decide Read the lane and its probabilities.
→ 04 Steer Game code completes the lane change.
What does the model see? In image mode, we send the picture. Our code handles steering, collisions and the clock. In JSON mode, we send the obstacle positions instead.
Ask students to separate the two jobs. The model names a lane. Our code moves the car, checks whether the answer is still useful, and handles the clock. Image mode sends pixels; JSON mode sends the scene coordinates.
06 / Make the task precise
What do we ask about this frame? We can ask all three questions about the same picture. Only the first one is needed to drive.
choice Which lane is the gap? The model chooses from left, middle, right.
Steers the car noul Is the middle lane blocked? Ask for the probability that the answer is yes.
Describes the scene score Where is the barrier vertically? Give it three ordered levels: top = 0, middle = 1, bottom = 2.
Describes the scene
Ask: if we remove the last two questions, can the car still drive? Yes. They describe the scene, but the controller only uses the lane choice. The three answers can disagree, so inspect them rather than assuming they tell one consistent story.
07 / The answer shapes
What will the answer look like?
choice A category We get one of our labels, a probability for each label, and a separate confidence value.
{ "choice": "left",
"probabilities": { "left": 0.99, "middle": 0.01, "right": 0 },
"confidence": 0.99 } noul A probability A value of 1 means the model estimates a 100% chance of yes. This is a number, not the boolean true.
{ "noul": 1 } score An ordered scale The API averages the level numbers using their probabilities. That is why the answer can fall between levels.
0 × 0.1 + 1 × 0.3 + 2 × 0.6 = 1.5 Illustrative distribution. Our recorded frame returned score 0.
The first two snippets are excerpts of the recorded answer. The score arithmetic is deliberately labelled illustrative so students see why the value can be fractional. A score of 1.5 is not a 150% danger probability. Noul has no separate confidence field.
08 / From an answer to a use
When would we use each type? The question you want to ask tells you which type to use.
choice Choose a lane. "Which lane is open?"
"left"One of the labels we supplied: left / middle / right.
What our code does We steer left. We can also inspect how much probability the other lanes received.
Use choice when the answer is one of a few options.
noul Ask whether it is blocked. "Is the middle lane blocked?"
0.8An estimated 80% chance of yes ; 20% of no.
What our code does We display 80%. If we wanted a yes/no action, we would have to choose a cutoff ourselves.
Use noul when you want a probability for a yes/no question.
score Ask how far down it is. "Where is the barrier?"
1.5Between middle (1) and bottom (2) on our ordered scale.
What our code does We display the score as the barrier approaches. Its units are our level numbers, not metres or seconds.
Use score when your answer levels have an order.
Ask students which type they would use for "Which lane?", "Is it blocked?", and "How far down the image?". Choice names an option; left and right are not numbers to average. Its probabilities compare the supplied alternatives, while confidence is a separate model-reported estimate, not a guarantee. Noul 0.8 is a probability, not the boolean true; a hypothetical application threshold of 0.7 would classify it as yes, while 0.9 would not. This game does not threshold noul to steer. Score 1.5 summarizes a distribution over the supplied level indices. It does not say the barrier is physically halfway between two positions, and different distributions can have the same average. Reopen the probability distribution when the distinction matters. All values on this slide are illustrative.
09 / Same input, different jobs
Describe the road, or choose a lane? Both are useful questions. They ask the model to do different work.
CONVENTIONAL CHAT Explain what you see “Describe the obstacles and suggest a driving strategy.”
The middle and right lanes are blocked. Move left… Useful when a person needs an explanation.
CHAT + JSON SCHEMA Generate a small object “Return only a lane from these three labels.”
{ "lane": "left" } Useful when we define a custom output shape.
DECISIONS Evaluate fixed options “Which lane is open?” Use a choice question.
{ "choice": "left",
"probabilities": { … } } Useful for a repeated classification or routing step.
Chat structured outputs · Clef's option-scoring design
Conventional chat generates tokens, including JSON tokens when using a schema. Specialized decision models may score the allowed options directly; Cloudflare documents this single-forward-pass approach for Clef. The API shape alone does not prove every provider uses identical internals. A schema constrains syntax and labels, not factual correctness. A model-written confidence number is not automatically a calibrated probability. Even decision probabilities need validation on our own data. Choose chat for explanation or open-ended analysis and a decision interface when the allowed outputs are already known.
10 / Why use this API?
Why use Decisions for this game? The car needs a lane label. We also want to see how the model rated the alternatives.
What we need Plain text LLM call LLM + structured output Decisions API Machine-readable result We have to interpret the wording We supply a JSON schema The API supplies the answer types One of three lanes We ask for a lane in the prompt We can restrict it to three labels We ask a choice question Uncertainty The model may describe uncertainty We can ask it to write a number Choice and score include distributions Best use here Explain a driving strategy Produce a custom plan or object Ask the same small questions each frame
We write less code to interpret the answer, and we get a distribution over the supplied choices.
A normal chat model can return structured JSON too. Let's compare the time each approach takes on this game.
Source: OpenAI Decisions guide . Use Responses for explanations/custom schemas; function calling for tool requests.
The useful distinction is the output contract. Chat with a JSON schema can already return a valid lane label. Our chat baseline asks for a short answer with no explanation, so we do not slow it down with extra prose. The next slides use our measured calls. They compare different models and API paths together; they cannot isolate API overhead or establish better calibration, accuracy or cost.
11 / Compare models with images
How long did we wait for an answer? Choose the question count and image size. Each measured setting uses the same three scenes in run D.
Recording D · full matched benchmark A · earlier model check B · earlier chat comparison C · question-count check Questions 1 · lane only 2 · + middle blocked 3 · + barrier position PNG size 210 × 240 420 × 480 840 × 960
A median is the middle measured time after sorting; for even samples, average the two middle values. The mean is the arithmetic average. Fastest and slowest show the observed range. Times are local-server round trips to a complete response, including network, TLS and routing. They are not provider-only compute times. D is the complete 189-attempt run, with three scenes for each of 63 settings. A is the earlier model check, B the earlier chat comparison, and C the earlier question-count check. The same scenes and lane question are used within each run, with model order rotated. Separate runs remain separate, including Luna's two results. Correctness means the chosen lane was open, not that a live game avoided collision. Errors remain in the denominator; timing and usage summaries use successful calls with the field supplied. Missing values are labelled; zero output tokens is exactly what some Decisions providers reported, not a claim of zero computation. Cost is a scaled display of recorded charges, not a current price quote. The smaller-image and question-count measurements appear on the next comparison slides.
12 / Compare models with JSON
What if we send the road as JSON? All six models receive obstacle positions as JSON. Choose one, two or three questions.
Recording D · full matched benchmark A · earlier model check B · earlier chat comparison Questions 1 · lane only 2 · + middle blocked 3 · + barrier position
Keep every number: Summary CSV Every call CSV Measurements JSON
D uses the same three scenes for every model and question count, with setting order shuffled per scene and model order rotated. All six JSON models are measured. JSON supplies obstacle positions directly, so lower times do not isolate image-encoder latency. Earlier A and B rows are available separately; no runs are pooled. Unmeasured combinations in older recordings are not failures or zero latency. Correctness checks the lane answer; reported tokens and cost come from each provider.
13 / Compare the request itself
Smaller image? Fewer questions? Run D measures all three sizes and question counts for every supported model. Select a model to inspect.
Model Question-count input 420 × 480 image 210 × 240 image 840 × 960 image Structured JSON
Image size Run D · one question · three scenes per size
The scene is the same at each size. Three samples per setting still leave room for network variation.
Question count Run D · selected input · three scenes per version
All values on this slide come from D. Image size holds the model and one-question schema fixed. Question count holds the selected input and model fixed. Each setting has three scenes. Sizes, input kinds and question counts were shuffled within each scene; model order rotated, calls serial, no warm-up omitted and no retries. The recorded Jev 1.13 baseline was tested only with JSON; it has no image-size comparison in this historical run. The game now also offers Jev 1.14 with experimental images. More questions need not increase measured latency monotonically. The lane answer alone is scored, not the two optional answers. Rows repeated across slides are counted once in the totals.
14 / Read the numbers together
All six models. Both input types. One question, all six models in run D. The image panel uses 420 × 480 PNGs. Both panels use the same scale.
Road image · median complete answer
Structured JSON · median complete answer
Both panels use one common zero-based scale and only D, one-question settings, with 420px image input. Every supported model is shown. The summary does not average medians across input types or models. D has 63 settings and 189 attempts; A, B and C add 75 earlier attempts, retained in exports and separately selectable. Repeated display of a group does not duplicate its calls. General chat receives short schema-constrained JSON instructions, temperature 0 and a 120-token cap, with no requested explanation. This compares whole model/API paths and does not isolate API overhead.
15 / The real request
Here is the request we sent. POST https://openrouter.ai/api/alpha/decisions
Input Questions Full request
This tab shows the input. Open Questions to see exactly what we asked.
We shortened the image bytes so the rest is readable.
Download exact request JSON No API key is included.
The recorded request · OpenRouter request contract
Click Questions to show the exact instructions and criteria, then Full request. Download contains all image bytes. The instructions mention orange barriers and a cream car, but do not supply obstacle coordinates. This request uses the OpenRouter adapter, so do not paste this body unchanged into OpenAI's native endpoint.
16 / The real response
The model chose left.
choice / lane left
noul / middle blocked 1
score / proximity 0
Choice Noul Score Full response
API round trip Reported input tokens Reported cost Evidence This is one example call. The timing summary uses several calls.
Compare the lane answer to the input image. Show that probabilities add to one. Open the full response to reveal the model, request ID, provider and usage. The probability of yes and confidence are separate concepts; avoid treating confidence as the probability that the whole game will succeed.
17 / Use the answer
Before we move the car, check the answer.
Does the answer have the right shape? Check that the fields, labels, numbers and probabilities are valid. Is it still about this barrier? Skip an old answer if the barrier has passed or the run has changed. Move to the chosen lane. Let the turn finish. Ask again at the next capture point. Keep the whole call in the log. Save what we sent, what came back, how long it took, and what the car did. Classroom mode The road waits for the answer. Game clock Paused
API wait timer Running
An earlier call took 19.1 seconds. If the road keeps moving for that long, the answer arrives too late.
Show the two clocks. In Classroom mode, game time stops while the API timer keeps running. Real time lets the road continue, so a correct answer can still arrive too late. We send one request at a time. The local correctness check records mistakes but never repairs the model's lane choice.
18 / Read the small fields
What do null, zero and false mean?
What you see What it means Where it comes from noul: 1The model estimates a 100% chance of yes Model answer provider_processing_ms: nullWe were not given the provider's processing time Local metadata No middle_blocked.confidence Noul does not have a separate confidence field Response schema road_pixels_moved: 0The road did not move during this request Local game trace model_matches_scene: falseOur code found that the model chose a blocked lane Example of a failed local check
Who produced this number? Some fields come from the model. Others come from our timer or our game code. Keep those sources clear.
The false row is an example; our recorded response chose the correct lane. Ask students to explain the difference between a missing field, null, false and zero. Also point out the spelling: noul is a probability type, while null is a missing value. A network round trip does not tell us how much time the model itself spent computing.
19 / Beyond the game
What could we try in the lab? Proposed demos for our work. These need their own labelled examples and evaluation.
FIELD PHOTO TRIAGE Which images can we use? Input: a field photo. Choice: usable, blurred, obstructed, review.
Demo: sort a photo stream and open uncertain items for an annotator.
SMOKE / KILN MONITORING Is a plume visible? Input: camera frames. Noul: probability that a visible plume is present.
Demo: flag candidate clips. Fog, dust and steam need review; a photo does not measure PM2.5.
SOLAR INSPECTION What needs a closer look? Input: panel photos. Choice: apparently clear, soiling, shading, review.
Demo: build an inspection queue. Confirm performance with electrical measurements.
WASTE AUDIT Which category fits? Input: item or bin photos. Choice: paper, plastic, metal, mixed, review.
Demo: assist campus audits. Include unfamiliar items rather than forcing a label.
These are proposed applications, not capabilities validated by the driving benchmark. Start with image usability because the labels are visible and easy for students to check. A smoke-presence classifier is an event-triage tool, not an emissions inventory or an exposure model. Visible appearance alone cannot establish pollutant concentration or solar output loss. Keep lighting, viewpoint and camera differences in the held-out set. For site imagery, describe land or equipment rather than identifying individual people.
20 / When an image is unnecessary
Some useful decisions start with data. Text or JSON lets us test Jev as well as the other models.
AIR-QUALITY SENSOR QA What should we check? Send recent readings, missing-data flags and a technician's note.
Choice: check timestamp, compare neighbours, inspect device, review.
Action: queue a check; retain the original measurements.
BUILDING ENERGY Which event needs review? Send load summaries, occupancy schedules and equipment status.
Choice: expected operation, possible idle load, review.
Action: show an operator the supporting trace.
RESEARCH ASSISTANT ROUTING Which tool should answer? Send a question about a place, pollutant or time period.
Choice: observation lookup, map, validated model output, clarification.
Action: call that tool before explaining the result.
Compare against simple rules. A missing timestamp needs a rule. Mixed notes and context may benefit from a model. Test both on the same cases.
These are application proposals. For VayuChat-like research assistants, use the decision step to select an existing tool or validated dataset, then let a conventional LLM explain the returned evidence. The decision model should not invent pollution observations or replace a physical simulation. For energy or air-quality quality control, deterministic checks are strong baselines. A model can combine contextual notes but must be evaluated against those baselines. Suggested actions here create review queues, not autonomous equipment changes.
21 / One possible lab exercise
Should this sensor reading be reviewed? Illustrative input and answer, not a measured API result.
INPUT · JSON { "pm25": 0,
"unchanged_minutes": 50,
"nearby_pm25_range": [58, 74],
"relative_humidity": 87,
"note": "Inlet cleaned this morning" } QUESTION · CHOICE Which next step is appropriate? Continue monitoring, check the timestamp, inspect the device, or ask for review.
{ "choice": "review",
"probabilities": {
"continue": 0.05, "time_check": 0.15,
"inspect": 0.25, "review": 0.55 } }
The operator sees the evidence. Flag the reading and show the recent trace. Verify the cause before correcting or excluding data.
All numbers on this slide are invented for teaching and the answer excerpt is shortened. The example illustrates the output contract, not demonstrated diagnostic skill. Nearby sensors can differ for real physical reasons, humidity may affect a particular sensor, and maintenance notes do not establish a fault. Ask students to propose a deterministic baseline, such as a stuck-value detector, and compare it against the model. The full response would also contain type and confidence fields; the excerpt is explicitly illustrative.
22 / A useful next experiment
Start with a task we can check ourselves. My first choice: field photo triage. Students can inspect the images, label quality problems, and compare the model's choices with their own. Then try sensor QA. Use recorded readings and technician notes. Compare a rule-based baseline, an LLM and a Decisions model. Keep a review option. Let the model admit that a case does not fit the supplied labels. MEASURE MORE THAN SPEED Hold out examples before tuning. Quality errors by category
Operations false alarms / misses
Runtime median + slow calls
Resources tokens + cost
Choose review thresholds on labelled validation data. A confidence of 0.9 is not automatically 90% accuracy.
The game is a fast introduction because every frame has a known open lane. Lab data will be more ambiguous. Split data by device, site or time when that reflects deployment, rather than putting near-duplicate images in both training and test sets. Report false positives and false negatives separately, compare a simple baseline, inspect failure cases and calibrate thresholds for the actual task. Treat the three-scene game benchmark as a classroom demonstration, not evidence that these sustainability tasks will work.
23 / Now run it live
Now let's try it.
Take one decision. Choose one question to start. Predict the open lane, then inspect the answer. Start live with sound on. Hear the engine on straights and a whoosh on each swerve. Try another speed or model. Try 1× through 8×, then switch between Decisions and a chat model. Keep the input the same when comparing. Rewind a decision. Open its JSON and timing. Was the lane wrong, or did the answer arrive too late? Ready for the demonstration Your turn to drive. Keep this deck open. In the game, use Compare to load the recordings or run the same input through three models.
Play Pocket Pilot ↗ These slides use recordings. Live play uses your connected API key.
Start in Classroom mode. Let students predict each answer before revealing the JSON. If a collision occurs, inspect the trace instead of resetting immediately. Sound is synthesized locally and requires a click; use the game's mute and volume controls during discussion.