ClassifierHub
Pricing

Jev + TypeScript

Using Jev with TypeScript

Jev's typed answers pair naturally with TypeScript. Define the answers you expect with Zod, validate the response once, and the rest of your code works with real types instead of strings.

Get Early Access to ClassifierHub: 2× credits in your first paid month.

A complete, typed example

This function routes a ticket and flags urgency. The response is validated with Zod, a timeout prevents hung requests, and thresholds stay in code.

triage.ts
ts
import { z } from "zod";

const Answer = z.object({
  answers: z.object({
    team: z.object({ choice: z.enum(["billing", "technical", "other"]), confidence: z.number() }),
    urgent: z.object({ noul: z.number() }),
  }),
});

export async function triage(ticket: string) {
  const res = await fetch("https://openrouter.ai/api/alpha/decisions", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "typesafe/jev-1.13",
      state: { ticket },
      questions: {
        team: {
          type: "choice",
          instructions: "Which team should handle `ticket`?",
          criteria: { billing: "Payments and refunds", technical: "Bugs and outages", other: "Anything else" },
        },
        urgent: {
          type: "noul",
          instructions: "Does `ticket` describe something blocking the customer right now?",
          criteria: { true: "Blocked, outage or deadline today", false: "Can wait" },
        },
      },
    }),
    signal: AbortSignal.timeout(8000),
  });
  if (!res.ok) throw new Error(`Jev request failed: ${res.status}`);
  const { answers } = Answer.parse(await res.json());
  // Keep thresholds in code, not in the prompt.
  return {
    team: answers.team.confidence >= 0.6 ? answers.team.choice : "other",
    urgent: answers.urgent.noul >= 0.5,
  };
}

Tips for production

A few habits make Jev integrations robust:

  • Validate every response: the Decisions API is alpha and shapes may change.
  • Pin the model id and upgrade deliberately.
  • Run it server-side only; never ship your API key to the browser.
  • Log the probabilities, not the raw input, so you can tune thresholds without storing customer data.

Or use the ClassifierHub API

ClassifierHub returns normalized outputs (value, confidence, probabilities) with consistent error codes, credits on every response and scoped API keys, so you can call it from any TypeScript backend or edge function.

classify.sh
bash
curl https://classifierhub.com/v1/classify \
  -H "Authorization: Bearer $CLASSIFIERHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Hi, I was charged twice for my subscription this month.",
    "instructions": "Which team should handle this ticket?",
    "options": ["billing", "technical", "other"]
  }'

Frequently asked questions

Related guides

Last updated 2026-09-25. ClassifierHub is an independent product built on top of the Jev decision model, accessed through OpenRouter. It is not affiliated with or endorsed by TypeSafe or OpenRouter.

Reserve your Early Access.

Join the waitlist today and get 2× credits during your first paid month when we open your spot.

API + MCP Built for AI agents Free plan included