Technology
One call. Two places.
The code decides.
Gemini Nano in Chrome reads your sketch while you draw, free and on this computer. Gemini in the cloud reads photos and checks the finished drawing. Plain code, never a model, decides whether the circuit is safe and where every part goes.
- Firebase AI Logic, hybrid
- Firebase App Check
- Firebase Remote Config
- Firebase Hosting
- Gemini Nano in Chrome
- Apple Foundation Models
- Gemini 3.8 Flash
- Gemini 3.5 Flash-Lite
How a drawing becomes a board
1Your drawing
2Firebase AI Logic firebase/ai
PREFER_ON_DEVICEONLY_IN_CLOUDPREFER_ON_DEVICEApp Check guards every cloud call. No key in the page.
3Plain code decides
- Parse the JSON against the schema
- Solve every current by nodal analysis
- Check current, polarity, shorts, ratings, chips and boards
- Place each part on the breadboard
- Write the steps and the parts list
TypeScript, 155 tests. The same drawing always gives the same board.
4On the page
Offline. A service worker keeps the page, so the device read, the check and the board work with no connection.
On the iPhone, the same four steps: Apple's on-device model, Firebase AI Logic for iOS, App Attest, and the engine in Swift.
One call, two places
getGenerativeModel(ai, {
mode: InferenceMode.PREFER_ON_DEVICE,
inCloudParams: {
model: 'gemini-3.5-flash-lite' },
})
Gemini Nano answers when Chrome has it; otherwise the same call goes to the cloud. Each reading is labelled from inferenceSource.
The whole circuit in the cloud
mode: InferenceMode.ONLY_IN_CLOUD,
model: 'gemini-3.8-flash',
thinkingLevel: ThinkingLevel.LOW,
responseSchema: netSchema
For photos, finished sketches and chips, boards or branches. Both model names come from Remote Config, so a retired model can be swapped without a deploy.
The model reads, the code decides
const v = check(circuit);
v.level // 'go' | 'warn' | 'stop'
Models only turn a picture into JSON against a schema. The solver, the rules, the board and the steps are TypeScript with tests.
Live reads stay free
A class of thirty drawing makes thousands of reads an hour, free on the device. The cloud checks once you stop, at most every 15 s.
No key in the page
App Check is enforced: reCAPTCHA Enterprise on the web, App Attest on the iPhone. A call without a valid pass gets a 401.
Works offline
After one visit the page opens with no connection. The device reads, and the check and the board still work.
Each job, and where it runs
| Job | Mode | Why |
|---|---|---|
| Reading the sketch after every pause | PREFER_ON_DEVICE | Free, a few seconds, no connection needed. |
| Reading a photo of paper | ONLY_IN_CLOUD; the device when offline | The cloud read 21 of 21 test photos right; the phone's model 5 of 12, so a device read of a photo says to check it. |
| Checking the finished sketch | ONLY_IN_CLOUD, 3 s after the pen rests | A stronger second read, at most every 15 s. Where it differs, its reading is shown. |
| "Read it in the cloud" | ONLY_IN_CLOUD | A second opinion when you ask. |
| Explaining the circuit | PREFER_ON_DEVICE, per language | The device writes the languages it knows; the cloud the rest. |
| No connection | Device only | The read, the check and the board all work; the cloud button waits. |
On the iPhone too
The same app on iOS 27. Apple's model on the phone reads your finger drawing after every pause; photos and anything beyond one loop go to Gemini 3.8 Flash. iOS has no PREFER_ON_DEVICE switch, so the app applies the same rules itself.
- Apple Foundation Models on the phone
- Firebase AI Logic for iOS for the cloud
- App Check with App Attest
- The same engine in Swift, 76 tests
Needs iOS 27 or later. A phone without Apple's model reads through the cloud.
Test the on-device model
Your on-device model is ready. Read the four example drawings on this computer and see how it does. The real test is drawing on the paper on the main page.
This browser has no on-device model, so the test is not available here. It runs in Chrome with the built-in model; on any other browser the main page reads through the cloud instead.