Jev AI Hub
Start Learning

Routing · Choice

Route Requests to the Right AI Model with Jev

Jev as a model router: Choice over snap_judgment, write_text, and deep_reason, then your gateway picks the backend.

Published
Sep 20, 2026
Updated
Sep 20, 2026
Last verified
Sep 20, 2026

Quick answer

Decide whether a request stays on a cheap path, goes to a writer LLM, or needs a slower reasoner.

Problem

A single product endpoint receives 'tag this ticket', 'draft a reply', and 'compare these three contracts'. Sending everything to a frontier reasoning model is slow and expensive.

Why Jev fits this task

The backends are a closed set you already pay for. Official System One framing: Jev makes the snap decision; a generative model writes when writing is required. Intent-routing docs describe sending work to deterministic logic, a specialist LLM, or a human.

Input state

Send only the fields the questions name. Official docs warn that extra unrelated state costs accuracy.

{
  "user_request": "Draft a two-paragraph apology to the customer about the failed payout, in our brand voice."
}

Question

Which kind of backend should handle this user request?

Question type: Choice.

Jev schema

{
  "model": "jev-latest",
  "state": {
    "user_request": "Draft a two-paragraph apology to the customer about the failed payout, in our brand voice."
  },
  "questions": {
    "backend": {
      "type": "choice",
      "instructions": "Which backend should handle `user_request`?",
      "criteria": {
        "snap_judgment": "Classification, routing, scoring, or a yes/no gate. No new prose is required.",
        "write_text": "The user wants generated prose, code, or a rewrite.",
        "deep_reason": "Multi-hop analysis, comparison across long documents, or a plan with several unknown steps.",
        "human": "A person should see this: legal, medical, or unclear destructive action."
      }
    }
  }
}

Python example

from typesafe_sdk import Choice, TypeSafeClient

state = {
    "user_request": "Draft a two-paragraph apology to the customer about the failed payout, in our brand voice.",
}

with TypeSafeClient() as client:
    response = client.system_one(
        state=state,
        questions={
        "backend": Choice(
            instructions="Which backend should handle `user_request`?",
            criteria={
                            "snap_judgment": "Classification, routing, scoring, or a yes/no gate. No new prose is required.",
                            "write_text": "The user wants generated prose, code, or a rewrite.",
                            "deep_reason": "Multi-hop analysis, comparison across long documents, or a plan with several unknown steps.",
                            "human": "A person should see this: legal, medical, or unclear destructive action.",
                        },
        ),
        },
    )

print(response.answers["backend"].choice)
print(response.model)

TypeScript example

import { choice, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();

const response = await client.systemOne({
  state: {
    "user_request": "Draft a two-paragraph apology to the customer about the failed payout, in our brand voice."
  },
  questions: {
    backend: choice("Which backend should handle `user_request`?", {
      snap_judgment: "Classification, routing, scoring, or a yes/no gate. No new prose is required.",
      write_text: "The user wants generated prose, code, or a rewrite.",
      deep_reason: "Multi-hop analysis, comparison across long documents, or a plan with several unknown steps.",
      human: "A person should see this: legal, medical, or unclear destructive action.",
    }),
  },
});

console.log(response.answers.backend.choice);
console.log(response.model);

JavaScript example

import { choice, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();

const response = await client.systemOne({
  state: {
    "user_request": "Draft a two-paragraph apology to the customer about the failed payout, in our brand voice."
  },
  questions: {
    backend: choice("Which backend should handle `user_request`?", {
      snap_judgment: "Classification, routing, scoring, or a yes/no gate. No new prose is required.",
      write_text: "The user wants generated prose, code, or a rewrite.",
      deep_reason: "Multi-hop analysis, comparison across long documents, or a plan with several unknown steps.",
      human: "A person should see this: legal, medical, or unclear destructive action.",
    }),
  },
});

console.log(response.answers.backend.choice);
console.log(response.model);

cURL example

curl -s https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<'EOF'
{
  "model": "jev-latest",
  "state": {
    "user_request": "Draft a two-paragraph apology to the customer about the failed payout, in our brand voice."
  },
  "questions": {
    "backend": {
      "type": "choice",
      "instructions": "Which backend should handle `user_request`?",
      "criteria": {
        "snap_judgment": "Classification, routing, scoring, or a yes/no gate. No new prose is required.",
        "write_text": "The user wants generated prose, code, or a rewrite.",
        "deep_reason": "Multi-hop analysis, comparison across long documents, or a plan with several unknown steps.",
        "human": "A person should see this: legal, medical, or unclear destructive action."
      }
    }
  }
}
EOF

Expected output

{
  "model": "jev-1.13.0",
  "answers": {
    "backend": {
      "type": "choice",
      "choice": "write_text",
      "probabilities": {
        "snap_judgment": 0.06,
        "write_text": 0.84,
        "deep_reason": 0.07,
        "human": 0.03
      },
      "confidence": 0.79
    }
  },
  "usage": {
    "input_tokens": 200,
    "output_tokens": 30
  }
}

Confidence handling

If confidence is low, default to the safer expensive path or a human — not the cheapest path. Official risk-scaled thresholds apply here.

Production considerations

Implement the switch in your gateway. Log both the Jev version and the downstream model. Do not put API keys for TypeSafe in the browser.

AI gateways, agent entrypoints, and cost-control layers in front of several providers.

When to use Jev

You operate at least two backends and the routing rule is a judgment over the request text.

When not to use Jev

You only have one model, or the route is a deterministic header / plan-id you already know.

Jev will not run the writer or the reasoner. Official docs: it is not trained to generate text. Deep legal comparison still needs the slow model you routed to.

Common mistakes

  • Asking Jev to draft the apology after it selected write_text.
  • Confusing this with ticket-queue routing. Queues are people/teams; this page is model backends.

FAQ

Can Jev be one of the backends?

Yes. snap_judgment should call Jev again with the real business questions. That second call is a different request with a different state.

Sources

  1. Intent routingTypeSafe · accessed 2026-09-20 · documentation
  2. Primitives (Questions)TypeSafe · accessed 2026-09-20 · documentation
  3. API referenceTypeSafe · accessed 2026-09-20 · documentation

All Jev examples