Jev API quickstart
Use the Jev API from your server: install the official JavaScript SDK, set a TypeSafe API key, send state plus typed questions, and read the returned decision in your code.
1. Before you start
The Jev API is accessed through the official TypeSafe JavaScript SDK. You need Node.js 20 or newer and a TypeSafe API key, and you should make requests from your server rather than from browser code. This quickstart sends a first request and shows how the typed answer fits into an application workflow.
2. Install the official SDK
npm install @typesafe-ai/sdkSet TYPESAFE_API_KEY in your server environment. Keep the key on the server. The official client refuses browser use by default because shipping the key to a web page would expose it.
3. Send a first decision
import { choice, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const response = await client.systemOne({
state: {
document: "I was charged twice. Please fix this ASAP.",
},
questions: {
category: choice("What is this ticket about?", {
billing: null,
technical: null,
other: null,
}),
},
});
console.log(response.answers.category.choice);This follows the shape of the official JavaScript SDK quickstart: a short support message becomes a bounded ticket-category decision.
4. Understand state
state is the information the model should judge. It can be text or JSON-compatible structured data. Prefer explicit fields when your application already knows facts such as payment status, user role, tool events, or allowed routes.
5. Understand questions
Each named question becomes a typed answer. Choice selects among named alternatives. Noul returns the probability of yes. Score uses an ordered list of rubric descriptions and returns an expected score plus probabilities.
import { choice, noul, score, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const response = await client.systemOne({
state: {
message: "Our checkout failed twice and launch is tomorrow.",
},
questions: {
route: choice("Which queue should own this?", {
billing: "Payment and charge issues",
technical: "Product or integration failures",
other: "Everything else",
}),
urgent: noul("Is this time-sensitive?"),
severity: score("How severe is the impact?", [
"Low",
"Moderate",
"High",
"Critical",
]),
},
});Common mistakes
- Asking Jev to generate prose when the task does not have a bounded decision shape.
- Using vague Choice labels without criteria that separate them.
- Treating a model's route or recommendation as authorization to execute a high-impact action.
- Calling from the browser with a secret API key instead of a server environment.
Primary source
This page was checked against the official JavaScript SDK v0.6.0 source and README on 2026-09-21.
Official TypeSafe JavaScript SDK ↗
Next
Try a decision in the Jev Playground, copy a concrete pattern from Templates, calculate projected usage in the Cost Calculator, or review the conceptual boundary in Jev vs ChatGPT.