THE SHORT ANSWER

A direct HTTP example shows authentication, the request body, cancellation, response validation, and the boundary between an AI answer and application policy.

A minimal Jev integration can use native JavaScript fetch. TypeSafe documents a JSON POST to https://api.typesafe.ai/v1/systemone, authenticated with a bearer API key. The example below uses the same question as is-jodd while leaving the HTTP response visible for inspection. This independent guide is not published by TypeSafe. Official quickstart

Prepare the environment

Use a server-side script and supply TYPESAFE_API_KEY through its environment. Do not paste a real credential into this example, a public repository, or browser code. This article does not provide an API key, account entitlement, or a promise about current API pricing.

The following example is instructional; no response value is assumed. Running it makes a real remote request.

const key = process.env.TYPESAFE_API_KEY;
if (!key?.trim()) throw new Error('Missing API key');

const response = await fetch(
  'https://api.typesafe.ai/v1/systemone',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${key}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'jev-latest',
      state: '37',
      questions: {
        odd: {
          type: 'noul',
          instructions: 'Is this integer odd?',
        },
      },
    }),
    signal: AbortSignal.timeout(5000),
  },
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
const answer = data?.answers?.odd;
const p = answer?.noul;
if (answer?.type !== 'noul' || typeof p !== 'number'
    || !(p >= 0 && p <= 1)) {
  throw new Error('Invalid oddness answer');
}
console.log({ odd: p > 0.5 });

Keep request design separate from decision policy

The question asks for a judgment. The final comparison chooses how the application interprets it. Changing the cutoff would change that policy, not the definition of an odd integer. The cutoff here follows is-jodd’s implementation; it is not an accuracy guarantee.

Validate both the answer type and the numeric range. Checking only whether a property exists would allow the wrong kind of payload to reach your application. In the example, missing properties, numeric strings, out-of-range values, and NaN all fail the guard. An unsuccessful request remains an error rather than silently becoming an even number.

Decide what to retain

Before a live run, print the serialized body without the authorization header and inspect it against your intended question. Start with one known input instead of an uncontrolled loop. To test malformed responses, use invented local fixtures rather than deliberately spending requests on failures. This separates request debugging from answer decoding and makes each real call serve a clear purpose.

For an experiment, keep the input, question, elapsed time, and expected mathematical answer together. Store credentials separately from those records. Avoid logging entire request headers when debugging a failed call. If you need details that a convenience wrapper discards, inspect the direct response instead of guessing what happened inside the service.

For ordinary parity, the calculator or validated local arithmetic avoids the remote dependency. For package-specific setup, see getting started with is-jodd, including its restrictive $1 trillion license requirement. For failures, continue with errors and timeouts.

Sources & further reading

Want to check a number?Try the calculator ↗