Jev JavaScript
Same contract as TypeScript — useful for quick scripts and workers. Prefer server-side calls; browser demos should use the site playground session, not your secret key.
async function callJev(state) {
const res = await fetch("https://jevtypesafe.org/api/v1/decide", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.JEV_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
state,
questions: {
allow: {
type: "choice",
instructions: "Moderation action",
criteria: { allow: "safe", review: "unsure", block: "harmful" },
},
},
}),
});
if (!res.ok) throw new Error("Jev request failed: " + res.status);
return res.json();
}
callJev("User post: free $$$ crypto airdrop click here")
.then(console.log)
.catch(console.error);Prefer types? See Jev TypeScript.