{"slug": "is-odd-jev-check-if-a-number-is-odd-with-a-calibrated-probability", "title": "Is-odd-jev – check if a number is odd, with a calibrated probability", "summary": "Developer alxcrt published is-odd-jev, an npm package that determines whether a number is odd using the TypeSafe \"jev-latest\" model and returns a calibrated probability rather than a boolean, e.g. { odd: true, p: 0.999, ms: 71, output_tokens: 3 } for 5 and { odd: false, p: 0.002 } for 4. The package requires Node 18+, has zero dependencies, and can be called either with a waitlisted direct TYPESAFE_API_KEY or through the Vercel AI Gateway as typesafe-ai/jev, where probabilities come back rounded to about 2 decimal places and the free tier is rate-limited. Releases publish automatically from GitHub Actions via npm trusted publishing, requiring npm >= 11.5.1 for OIDC.", "body_md": "Check whether a number is odd, using a System One model, with a calibrated probability.\n\n```\nnpm i is-odd-jev\njs\nconst isOdd = require('is-odd-jev');\n\nawait isOdd(5);\n// { odd: true, p: 0.999, ms: 71, output_tokens: 3 }\n\nawait isOdd(4);\n// { odd: false, p: 0.002, ms: 88, output_tokens: 3 }\nnpx is-odd-jev 5\n```\n\n`is-odd` (2014) returns a boolean. It cannot tell you how sure it is.\n\n`is-odd-ai` (2023) asks an LLM, which returns a string you then parse, and which will\nhappily invent a confidence score if you ask it for one.\n\n`is-odd-jev` returns `p` — the model's actual probability that `n` is odd, computed\nfrom the distribution rather than narrated. Jev's `Noul` primitive has no `confidence`\nfield, because the probability *is* the answer. If you need a symmetric certainty:\n\n``` js\nconst { odd, p } = await isOdd(n);\nconst confidence = Math.abs(p - 0.5) * 2;\n```\n\nWhich lets you do the thing you could never do with an LLM:\n\n```\nif (confidence >= 0.95) ship(odd);\nelse escalateToHuman(n);\n```\n\nPick that threshold by measuring it on a held-out set, not by intuition.\n\nNode 18+. Zero dependencies.\n\n| env | default | \n|---|---|\n| `TYPESAFE_API_KEY` | — | \n| `AI_GATEWAY_API_KEY` | — (fallback, see below) | \n| `TYPESAFE_BASE_URL` | `https://api.typesafe.ai` | \n| `TYPESAFE_DEFAULT_MODEL` | `jev-latest` | \n\nDirect TypeSafe keys are waitlisted. [Vercel AI Gateway](https://vercel.com/docs/ai-gateway)\nserves the same model as `typesafe-ai/jev` with no waitlist, so this works instead:\n\n```\nexport AI_GATEWAY_API_KEY=...\nnpx is-odd-jev 5\n```\n\n`TYPESAFE_API_KEY` wins if both are set. Two things genuinely differ through the gateway:\n\n- **Probabilities come back rounded** , usually to 2dp — you get`0.99` , not`0.999` .\n- **The free tier is rate-limited hard** on this model. Fine for one number, not for a loop.\n\nUnder the hood the gateway calls a `Noul` a `boolean` and its answer `probability`,\nand takes the model in a header rather than the body. This package handles that; if\nyou are calling it yourself, `experimental_evaluate` from `ai@7` speaks it natively:\n\n``` js\nimport { experimental_evaluate as evaluate } from 'ai';\n\nconst { answers } = await evaluate({\n  model: 'typesafe-ai/jev',\n  state: { n: 5 },\n  questions: { odd: { type: 'boolean', instructions: 'Is n odd?' } },\n});\n{\n  \"model\": \"jev-latest\",\n  \"state\": { \"n\": 5 },\n  \"questions\": { \"odd\": { \"type\": \"noul\", \"instructions\": \"Is n odd?\" } }\n}\n```\n\nIt cannot chat. It cannot explain itself. It cannot hallucinate. It can only tell you, with a calibrated probability, that five is odd.\n\nReleases publish themselves from GitHub Actions via npm\n[trusted publishing](https://docs.npmjs.com/trusted-publishers): the workflow swaps its\nOIDC token for publish rights, so there is no npm token in the repo, no secret to\nrotate, and no OTP prompt.\n\n```\nnpm version patch && git push --follow-tags\ngh release create v1.1.1 --generate-notes\n```\n\nPublishing the release fires [`.github/workflows/publish.yml`](https://github.com/alxcrt/is-odd-jev/blob/main/.github/workflows/publish.yml),\nwhich runs the tests and then `npm publish`. The workflow upgrades npm first — OIDC\nneeds `npm >= 11.5.1` and the runner image ships something older, which is the kind of\nthing that fails once and confuses you for an hour.\n\nOne-time setup, on npmjs.com: the package → Settings → Trusted Publisher → GitHub\nActions, repo `alxcrt/is-odd-jev`, workflow `publish.yml`.\n\n- `is-odd` — depends on`is-number` .`is-even` depends on`is-odd` .\n- `is-odd-ai` — asks GPT, parses the reply.\n- `n % 2 === 1` — still correct, still 0 ms, still free.\n\nMIT", "url": "https://wpnews.pro/news/is-odd-jev-check-if-a-number-is-odd-with-a-calibrated-probability", "canonical_source": "https://github.com/alxcrt/is-odd-jev", "published_at": "2026-09-17 23:06:50+00:00", "updated_at": "2026-09-17 23:25:13.574710+00:00", "lang": "en", "topics": ["ai-products", "ai-tools", "developer-tools", "large-language-models"], "entities": ["is-odd-jev", "alxcrt", "TypeSafe", "jev-latest", "Vercel AI Gateway", "npm", "GitHub Actions", "Noul"], "alternates": {"html": "https://wpnews.pro/news/is-odd-jev-check-if-a-number-is-odd-with-a-calibrated-probability", "markdown": "https://wpnews.pro/news/is-odd-jev-check-if-a-number-is-odd-with-a-calibrated-probability.md", "text": "https://wpnews.pro/news/is-odd-jev-check-if-a-number-is-odd-with-a-calibrated-probability.txt", "jsonld": "https://wpnews.pro/news/is-odd-jev-check-if-a-number-is-odd-with-a-calibrated-probability.jsonld"}}