Skip to content
rajkharvarPublic

About

Browser-only playground for TypeSafe's Jev decision model. Build typed questions, run them against your own key, inspect the probabilities.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Hunch

A browser-only playground for Jev, TypeSafe's decision model on OpenRouter.


Jev doesn't generate text. You hand it a state — free text or a JSON object — plus typed questions, and it hands back typed answers with probabilities attached.

Type Answers with Reach for it when
choice one of 2+ labelled options, each with a probability routing, triage, classifying
score a weighted position on an ordered scale (≤10 levels) severity, urgency, priority
noul a single probability that a proposition holds yes/no gates, tool-call approval

Hunch lets you build that query visually, run it against your own OpenRouter key, and read the result — probability bars, confidence bands, latency and cost per call.

There is no backend. Everything runs in the browser and calls OpenRouter directly, so it deploys as a plain static site.

Quick start

pnpm install
pnpm dev          # http://localhost:5173

You'll need an OpenRouter key — create one at openrouter.ai/settings/keys and paste it into the app. Set a low spend limit on it. Jev calls cost small fractions of a cent, so $1–5 is plenty, and it caps the damage if the key ever leaks.

Command What it does
pnpm dev dev server
pnpm build type-check and build to dist/
pnpm preview serve the production build
pnpm test Vitest suite
pnpm lint Oxlint

Your key

  • Sent only to openrouter.ai, in the decision request's Authorization header. There is no server in this project to send it anywhere else.
  • Held in memory by default, and gone when you close the tab.
  • Remember on this device opts into localStorage — any script on this origin can then read it, so skip it on shared machines. Forget key clears it.
  • Never logged. Copied snippets read $OPENROUTER_API_KEY rather than embedding the real value.

Deploying

pnpm build emits a fully static dist/ — no environment variables, no server runtime. Point Cloudflare Pages, Netlify, Vercel or GitHub Pages at it. For a GitHub Pages subpath, set base: '/<repo>/' in vite.config.ts first.

The browser calls https://openrouter.ai/api/alpha/decisions directly, and that endpoint returns Access-Control-Allow-Origin: * — so no proxy is needed from any origin.

Layout

src/
  lib/jev/           client · schema (Zod) · errors · export (curl/TS/Python)
  lib/storage/       key.ts
  features/key/      API key dialog
  features/builder/  model picker, state editor, question list, request preview
  features/results/  answer cards, meta strip, raw JSON
  components/ui/     shadcn/ui

Built with Vite, React, TypeScript, Tailwind and shadcn/ui. /api/alpha/decisions is an alpha endpoint, so every request and response shape is pinned inside src/lib/jev/ — a schema change lands in one directory.

Notes on Jev

  • Question ids are never sent to the model. All meaning has to live in instructions and criteria.
  • With a JSON state, instructions reference top-level keys in backticks: How urgent is `ticket`? The builder warns when a reference matches no key.
  • Context limit is roughly 32k tokens across state and questions; the builder shows a running estimate.
  • Probabilities shift slightly between identical calls, and key order inside probabilities isn't stable — always index by key, never by position.

About

Browser-only playground for TypeSafe's Jev decision model. Build typed questions, run them against your own key, inspect the probabilities.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages