Implementation

How to Use TypeSafe Jev: First-Call Quickstart and Examples

Make your first TypeSafe Jev call in under five minutes. Step-by-step installation, environment setup, Python and TypeScript examples, and output parsing.

To make your first TypeSafe Jev call, you need an API key from console.typesafe.ai and the official client library (pip install typesafe-sdk or npm install @typesafe-ai/sdk). Set your credential as an environment variable (TYPESAFE_API_KEY), provide unstructured input into the state field, and define typed questions using Choice, Score, or Noul. Jev evaluates all questions in parallel, returning structured answers with calibrated probabilities in 70ms to 500ms.

Step 1: Obtain Your API Key

TypeSafe currently operates Jev under controlled early access:

  1. Sign up on the access waitlist at typesafe.ai.
  2. Once your invitation arrives, navigate to console.typesafe.ai.
  3. Under the API Keys tab, generate a key starting with ts_live_.
  4. Export the key in your terminal or add it to your local .env file:
export TYPESAFE_API_KEY="ts_live_your_actual_key_here"

Note: If you have an OpenRouter account and do not yet have TypeSafe console access, you can evaluate Jev immediately via model ID typesafe/jev-1.13.

Step 2: Minimal Python Quickstart

Install the official Python package:

pip install typesafe-sdk

Save and run triage.py:

import os
from typesafe_sdk import TypeSafeClient, Choice, Noul

# Initializes from TYPESAFE_API_KEY environment variable
client = TypeSafeClient(api_key=os.environ["TYPESAFE_API_KEY"])

# 1. Provide unstructured state
state = {
    "user_id": "usr_9921",
    "ticket_text": "I was double charged on invoice #4812 after my card failed once.",
    "account_tier": "pro"
}

# 2. Declare typed decision questions with instructions and criteria
response = client.system_one(
    model="jev-latest",
    state=state,
    questions={
        "department": Choice(
            instructions="Route this ticket to the appropriate operational team.",
            criteria={
                "billing": "Invoice, charge, refund, or payment processing issues",
                "technical_support": "System bugs, crashes, or API errors",
                "account_security": "Password resets, compromised accounts, or MFA"
            }
        ),
        "is_urgent": Noul(
            instructions="Does this issue require urgent financial escalation?"
        )
    }
)

# 3. Access typed results directly via collections
dept = response.choices["department"]
urgency = response.nouls["is_urgent"]

print(f"Routing to: {dept.choice} (Confidence: {dept.confidence:.1%})")
print(f"Urgent probability: {urgency.noul:.1%}")

TypeSafe reports typical execution latencies of 70ms to 500ms. An illustrative console output format appears below:

Routing to: billing (Confidence: 96.8%)
Urgent probability: 88.4%

Step 3: Minimal TypeScript Quickstart

Install the official TypeScript client:

npm install @typesafe-ai/sdk

Save and run triage.ts:

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

const client = new TypeSafeClient({
  apiKey: process.env.TYPESAFE_API_KEY!,
});

async function main() {
  const result = await client.systemOne({
    model: "jev-latest",
    state: {
      log: "Worker process pod-392 terminated with code 137 (OOMKilled) during index rebuild.",
    },
    questions: {
      action: choice("Determine immediate remediation strategy.", {
        increase_memory: "Pod killed due to memory limits; allocate more RAM",
        split_batch: "Index batch size too large; reduce chunk size",
        ignore_retry: "Transient worker failure; restart without config change",
      }),
      page_oncall: noul("Should an infrastructure engineer be paged immediately?"),
    },
  });

  const action = result.answers.action;
  const shouldPage = result.answers.page_oncall;

  console.log(`Action: ${action.choice} (Confidence: ${action.confidence})`);
  console.log(`Page On-Call Probability: ${shouldPage.noul}`);
}

main().catch(console.error);

Step 4: Branching on Calibrated Probabilities

Unlike traditional LLMs that output text descriptions of confidence (e.g. "I am fairly sure"), Jev provides calibrated statistical confidence metrics. Production applications typically use confidence thresholds to automate high-confidence cases and route low-confidence edge cases to humans.

Threshold selection (such as 0.85 below) is illustrative; developers should calibrate thresholds according to their specific application's cost of false positives versus false negatives:

dept = response.choices["department"]

# Automated threshold gate (illustrative 0.85 confidence cutoff)
if dept.confidence >= 0.85:
    assign_ticket(ticket_id, target=dept.choice)
else:
    # Route borderline decisions to triage queue
    flag_for_human_review(ticket_id, suggested=dept.choice, scores=dept.probabilities)

Top 3 First-Call Traps

Next Steps

reference cost caveat workflow workflow comparison