Inspiration

My family sends money home to Haiti every month, and the scam texts sound like family business:

  • "URGENT: Your remittance of $480 to Haiti is ON HOLD. Confirm the 6-digit code within 30 minutes."
  • "Grandma, it's me, I'm in jail. Don't tell Mom, pay with gift cards."
  • "FELISITASYON! Ou genyen 250,000 goud nan gwo lo Digicel la. Peye 1500 goud pou debloke l."

They target people who send money home, older parents, and people who have just started banking on a phone. The best second opinion is an AI that reads the whole message and explains it calmly. But the messages people worry about are their most private ones: bank pages, one-time codes, family chats. Uploading all of that to a server is part of the problem.

On-device AI changes that. A scam checker can read what you read without ever uploading it. That's Veye, Haitian Kreyòl for watch out.

What it does

Veye checks a message, a web page or a screenshot and answers in plain words:

  • a verdict: safe, suspicious or scam, with a risk score and the type of scam;
  • the red flags in this message, and what to do next;
  • where the AI ran: "On this device · 0 bytes sent" or "Cloud · 1 item redacted", plus a step-by-step "How Veye decided where to run".

Every check goes through three layers:

  1. Local rules: instant, offline red-flag patterns in English, Kreyòl, French and Spanish, with negation handling (so "we will never ask for your code" isn't flagged) and look-alike domain detection (westernunion-release.help is not Western Union).
  2. Gemini Nano on the device through Firebase AI Logic: reads the whole message, or a screenshot, and returns structured JSON. Nothing is uploaded.
  3. Gemini in the cloud through the same Firebase AI Logic call, only when needed. Before anything leaves the device, Veye removes emails, phone numbers (including the sender's), card numbers, IDs and codes.

The user chooses how private each check is:

Mode Firebase AI Logic What can leave the device
Private ONLY_ON_DEVICE Nothing, ever
Smart (default) PREFER_ON_DEVICE Redacted text only, if the device can't answer
Deep check PREFER_IN_CLOUD Redacted text; a screenshot only after you say yes

A Chrome extension brings the same engine into a side panel: a warning badge on every page from the local rules alone (no AI call, no network), plus "Check this page" and right-click "Check with Veye", read by Gemini Nano on your computer.

How we built it

One prompt and one output schema run on both sides of the hybrid SDK:

getGenerativeModel(ai, {
  mode: InferenceMode.PREFER_ON_DEVICE, // or ONLY_ON_DEVICE / PREFER_IN_CLOUD
  inCloudParams: { model: 'gemini-3.5-flash-lite',
    generationConfig: { responseMimeType: 'application/json', responseSchema } },
  onDeviceParams: {
    createOptions: { expectedInputs: [{ type: 'text', languages: ['en', lang] }, { type: 'image' }],
                     expectedOutputs: [{ type: 'text', languages: [lang] }] },
    promptOptions: { responseConstraint: jsonSchema },
  },
});

Veye's router picks the mode for every check and shows its reasoning:

  • Language-aware. Gemini Nano doesn't answer in Kreyòl yet. A Kreyòl answer goes to the cloud through the same call, after redaction. English and Spanish stay on the device.
  • Length-aware. Pages over about 6,000 characters go to the cloud, redacted, to stay well within Nano's context window.
  • Offline-aware. With no network, ONLY_ON_DEVICE; with no network and no model, the rules alone answer.
  • Consent for images. A screenshot can't be redacted, so it never goes to the cloud without a yes.
  • response.inferenceSource drives the "where it ran" badge.

The AI decides, but the rules can only add warnings, never hide one. With an AI risk $r_{\text{AI}}$ and a rule score $s_{\text{rules}}$ (both from 0 to 100):

$$ \text{risk} = \max\big(r_{\text{AI}},\ \operatorname{round}(0.85\, s_{\text{rules}})\big) $$

and if the AI says safe while $s_{\text{rules}} \ge 55$, Veye shows suspicious and explains why.

Other Firebase products:

  • App Check with a custom provider. reCAPTCHA can't run on chrome-extension:// pages, so signed-in clients get short-lived App Check tokens from Veye's server, signed with the project's service account (stored encrypted). The same provider covers the website and the extension.
  • Remote Config changes the cloud model, the on-device languages and extra scam patterns without a new build.

Stack: vanilla JS bundled with esbuild (Firebase JS SDK), a Chrome MV3 extension (side panel, context menu, content script), and PHP 8 + MySQL for accounts, App Check tokens, rate limits and community warnings. Veye stores no message text and no screenshots, only the verdict and where the AI ran.

Challenges we ran into

  • App Check inside a Chrome extension. Without reCAPTCHA, we built a server-signed custom provider, issued only to signed-in users and rate-limited.
  • Keeping the cloud fallback private. With PREFER_ON_DEVICE the SDK decides when to fall back, so Veye redacts before every call that could reach the cloud, including the sender field.
  • A strict CSP blocked on-device images. Firebase AI Logic converts a screenshot with fetch("data:...") before handing it to Gemini Nano; our Content-Security-Policy blocked that ("Failed to fetch"). Allowing data: in connect-src fixed it.
  • Small-model echoes. Nano sometimes returned a redaction tag like [PHONE] as a red flag. Tags are now filtered out.
  • False alarms. A real bank notice says "we will never ask for your code". The rules handle negation so honest messages aren't flagged.
  • One schema, two engines. Chrome's Prompt API takes a JSON Schema responseConstraint, while the cloud takes a Firebase Schema. Both are kept in step and parsed the same way.

Accomplishments that we're proud of

  • Verified on-device, nothing sent: in Chrome on a laptop with no graphics card, Gemini Nano judged the remittance text Scam, 90%, with its red flags and next steps, in about a minute. It also read a phishing screenshot on-device in about 39 s. Both showed "On this device · 0 bytes sent".
  • A full scam check in Haitian Kreyòl, a language most AI products ignore, answered in Kreyòl with the sender's phone number removed first.
  • One engine shared by the web app and the Chrome extension, and nothing stored.

What we learned

Hybrid inference is more than a fallback switch: it changes what an app is allowed to do. A page-reading extension is only acceptable when the reading happens locally. The cloud then becomes a deliberate, visible choice: for a language, for a long page, or when the user asks. And a small on-device model works best with deterministic guardrails around it, so the rules catch what the model misses, and the model explains what the rules can't.

What's next for Veye

  • Android: a "Share → Veye" target for SMS and WhatsApp screenshots, with Gemini Nano through the same Firebase AI Logic hybrid SDK.
  • Kreyòl answers on the device as soon as Nano supports them: one Remote Config change.
  • Working with remittance agents and churches in Haitian communities to share warnings about the newest scams.

Built With

Share this project:

Updates

Submission history