Documentation menu
Paste the reference into any assistant and it can write the integration for you.

JevModel API

The whole reference in one place — authentication, the request and response contract, question types, credits, and error codes.

Overview

Typed decisions over HTTP — one endpoint, three question types, and credits you can meter.

JevModel turns a piece of text into a typed decision: a label, a score, or an explicit no-answer. You describe what you want to know with questions, the model answers them under the same keys you used, and you get back a JSON contract your application can route on.

Everything runs through a single endpoint:

curl https://jevmodel.io/api/v1/decisions \
  -H "Authorization: Bearer $JEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": "support_triage",
    "input": "My card was charged twice this month.",
    "questions": [
      {
        "key": "urgency",
        "type": "choice",
        "prompt": "How urgent is this issue?",
        "criteria": {
          "low": "A cosmetic question with no deadline",
          "high": "The customer is blocked or losing money"
        }
      }
    ]
  }'

One credit per decision

Every accepted call costs one credit, no matter how many questions you ask. The response carries the remaining balance, so you can meter the feature without a second request.

Start here

The idea in one paragraph

You send an input — the text you want a decision about — plus a list of questions. Each question has a key you choose, a type (choice, score, or noul), a prompt describing the judgement, and, for choice and score questions, the criteria the model must pick from. The response comes back as an answers map keyed by your own keys, plus a top-level decision, confidence, and reason so you can act on the primary answer without parsing prose.

Quickstart

Create an API key and get your first typed decision back in about two minutes.

1. Create an API key

Sign in with Google, then open Settings → API Keys and create a key. The full key is shown once, right after you create it, and only the masked form is listed afterwards. Copy it at that moment — it is the only time it is displayed.

A new account is credited with 1,000 Jev API credits, valid for 365 days. While you are still on that gifted allowance the public API allows 100 decisions a day. Buying a credit pack lifts the daily cap; after that you are limited only by your balance.

2. Send your first decision

curl https://jevmodel.io/api/v1/decisions \
  -H "Authorization: Bearer sk-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "task": "support_triage",
    "input": "My card was charged twice this month and I need it fixed today.",
    "questions": [
      {
        "key": "urgency",
        "type": "choice",
        "prompt": "How urgent is this issue?",
        "criteria": {
          "low": "Cosmetic question with no deadline",
          "medium": "Needs an answer this week",
          "high": "The customer is blocked or losing money"
        }
      },
      {
        "key": "needs_human",
        "type": "noul",
        "prompt": "Does this request need a human agent?"
      }
    ]
  }'

3. Read the response

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": "jev_1761234567890",
    "object": "jev.decision",
    "created": 1761234567,
    "model": "jev-1.14",
    "provider": "TypeSafe",
    "upstream_model": "typesafe/jev-1.14-20261014",
    "result": {
      "decision": "high",
      "confidence": 0.91,
      "reason": "Probabilities: {\"low\":0.01,\"medium\":0.08,\"high\":0.91}",
      "latency_ms": 1840,
      "no_answer_probability": 0.98,
      "answers": {
        "urgency": {
          "type": "choice",
          "choice": "high",
          "confidence": 0.91,
          "probabilities": { "low": 0.01, "medium": 0.08, "high": 0.91 }
        },
        "needs_human": { "type": "noul", "noul": 0.98 }
      },
      "source": "live"
    },
    "usage": {
      "credits": 1,
      "remaining_credits": 999,
      "daily_remaining": 99,
      "input_tokens": 812,
      "output_tokens": 96
    }
  }
}

The answers map is keyed by the key you gave each question, so you can read result.answers.urgency.choice directly. The top-level decision, confidence, and reason summarise the primary answer — a labelled choice or score, if there is one, otherwise the noul answer.

Use it from your app

const response = await fetch('https://jevmodel.io/api/v1/decisions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.JEV_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    task: 'support_triage',
    input: ticket.body,
    questions: [
      {
        key: 'urgency',
        type: 'choice',
        prompt: 'How urgent is this issue?',
        criteria: { low: 'No deadline', high: 'Blocked or losing money' },
      },
    ],
  }),
});

const payload = await response.json();

if (!response.ok) {
  throw new Error(payload.message);
}

const urgency = payload.data.result.answers.urgency.choice;
const remaining = payload.data.usage.remaining_credits;

Credits are only spent on success

A call that fails validation, or that the upstream rejects, never reaches your balance. The credit is consumed after the decision is produced, so a provider outage does not burn your allowance.

Authentication

How API keys work, where to create them, and how to keep them safe.

Every call to the public API is authenticated with a bearer token:

-H "Authorization: Bearer sk-your-key-here"

The token is the API key itself. There is no OAuth flow, no refresh token, and no session cookie — a key either works or it does not.

Keys are prefixed

Keys are issued with the sk- prefix. If a key ever reaches your logs, you can recognise it by that prefix.

Creating a key

  1. Sign in at jevmodel.io.
  2. Open Settings → API Keys.
  3. Press Create API key, give it a name that says where it will be used, and create it.

The full key is displayed exactly once, immediately after creation. The list only ever shows the masked form — four leading characters, eight dots, four trailing characters — so a screenshot of the settings page is safe to share.

Revoking a key

Open the key and delete it. Revocation is immediate: the next call with that key returns 401 Invalid API key.

Using keys safely

  • Keep the key in an environment variable, never in source control.
  • Use a different key per service or per environment, so you can revoke one without breaking the others.
  • Rotate on a schedule, and whenever a key may have been exposed.
  • Never send a key to the model provider, a log aggregator, or an error tracker.

A key is a credential, not an identifier

Anyone holding your key spends your credits and reads your request history. Treat it like a password, not like a user ID.

What a rejected key looks like

SituationStatusMessage
No Authorization header401Missing API key. Pass it as "Authorization: Bearer sk-..."
Unknown, deleted, or disabled key401Invalid API key

The API answers both cases the same way on purpose: a caller cannot use the error to discover which key ids exist.

Decisions

The full request and response contract for POST /api/v1/decisions.

Endpoint

POST https://jevmodel.io/api/v1/decisions
Content-Type: application/json
Authorization: Bearer sk-your-key-here

The endpoint accepts one task at a time and returns one decision.

Request body

FieldTypeRequiredDescription
inputstringyesThe text the decision is about. state is accepted as an alias for the same field.
questionsarray or objectyesAt least one question. See question types.
taskstringnoA label for this call, used in your request history and in the credit ledger. Defaults to support_triage.
schemaanynoAccepted for forward compatibility. It is not applied to the decision today.
{
  "task": "lead_scoring",
  "input": "We run a 40-person agency looking for a CRM with a REST API.",
  "questions": [
    {
      "key": "fit",
      "type": "score",
      "prompt": "How strong is the account fit?",
      "criteria": ["1", "2", "3", "4", "5"]
    },
    {
      "key": "route",
      "type": "choice",
      "prompt": "Should this lead go to sales or nurture?",
      "criteria": {
        "sales": "Ready to talk to a salesperson",
        "nurture": "Interested, but not ready yet"
      }
    }
  ]
}

questions accepts two shapes, and both produce the same result:

{ "questions": [ { "key": "fit", "type": "score", "prompt": "..." } ] }
{ "questions": { "fit": { "type": "score", "prompt": "..." } } }

In the object form the property name is used as the question key.

Question types

Every question has a key (yours, echoed back in the response), a prompt that describes the judgement to make, and a type.

choice

The model picks exactly one of your labels. criteria is required and must be an object that maps each label to a short description of what it means.

{
  "key": "route",
  "type": "choice",
  "prompt": "Should this lead go to sales or nurture?",
  "criteria": {
    "sales": "Ready to talk to a salesperson",
    "nurture": "Interested, but not ready yet"
  }
}

The answer carries the chosen label in choice, the per-label probabilities, and a confidence.

score

The model returns a value from the range you define. criteria is required and must be an array — the values it may answer with.

{
  "key": "fit",
  "type": "score",
  "prompt": "How strong is the account fit?",
  "criteria": ["1", "2", "3", "4", "5"]
}

The answer carries the numeric score, the legend that maps the numbers back to your values, the probabilities, and a confidence.

noul

A noul question is a yes/no question: the model returns the probability that the statement in your prompt is true. 1 means it is certain the statement holds, 0 means it is certain it does not. noul questions take no criteria — any that you send are ignored.

{
  "key": "needs_human",
  "type": "noul",
  "prompt": "Does this request need a human agent?"
}

The answer is a single number between 0 and 1 — the probability that the statement is true. It is also surfaced at the top level of the result as no_answer_probability.

`no_answer_probability` is a historical name

The field name predates the measured behaviour. The value it carries is the probability that the noul statement holds — not a probability of failing to answer. Read it as "how likely is yes".

A noul question never becomes the headline decision

The top-level decision prefers a labelled answer. If your request contains only a noul question, decision is the literal string noul and no confidence is returned, because the model produced none.

Response

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": "jev_1761234567890",
    "object": "jev.decision",
    "created": 1761234567,
    "model": "jev-1.14",
    "provider": "TypeSafe",
    "upstream_id": "gen-1761234567-abc",
    "upstream_model": "typesafe/jev-1.14-20261014",
    "result": {
      "decision": "sales",
      "confidence": 0.88,
      "reason": "Probabilities: {\"sales\":0.88,\"nurture\":0.12}",
      "latency_ms": 1740,
      "answers": {
        "fit": {
          "type": "score",
          "score": 4,
          "legend": { "1": "1", "2": "2", "3": "3", "4": "4", "5": "5" },
          "probabilities": { "1": 0.01, "2": 0.03, "3": 0.08, "4": 0.88, "5": 0 },
          "confidence": 0.88
        },
        "route": {
          "type": "choice",
          "choice": "sales",
          "probabilities": { "sales": 0.88, "nurture": 0.12 },
          "confidence": 0.88
        }
      },
      "source": "live",
      "upstream_usage": {
        "cost": 0.0004,
        "input_tokens": 812,
        "output_tokens": 96
      }
    },
    "usage": {
      "credits": 1,
      "remaining_credits": 999,
      "daily_remaining": 99,
      "cost": 0.0004,
      "input_tokens": 812,
      "output_tokens": 96
    }
  }
}

Top level

FieldDescription
idIdentifier for this decision, in the form jev_<timestamp>.
objectAlways jev.decision.
createdUnix timestamp in seconds.
modelThe Jev model that produced the decision, e.g. jev-1.14.
providerThe upstream provider, e.g. TypeSafe.
upstream_idThe upstream request id, for support and traceability.
upstream_modelThe exact upstream model build.

result

FieldDescription
decisionThe primary decision: the chosen label, the score, or noul.
confidenceConfidence reported by the model. Omitted when the model reports none.
reasonA short human-readable explanation of the decision.
latency_msHow long the decision took, in milliseconds.
no_answer_probabilityThe probability that the noul statement holds, when the request contained a noul question. Absent when it did not. The field name is historical — read the value as "how likely is yes".
answersThe full answer set, keyed by your question keys.
sourceAlways live for calls served by the API.
upstream_usageCost and token accounting reported by the upstream.

usage

FieldDescription
creditsCredits this call consumed. Always 1.
remaining_creditsCredits left on the account after the call.
daily_remainingDecisions left in today's allowance. Only present while you are on the gifted credits.
costUpstream cost in USD, when the provider reports it.
input_tokens / output_tokensUpstream token accounting.

Validation rules

The API validates the request before it spends anything, and the messages are meant to be read literally:

  • questions must contain at least one question.
  • Every question needs a prompt (or instructions).
  • A choice question needs a non-empty criteria object.
  • A score question needs a non-empty criteria array.
  • A noul question ignores criteria — anything you send there is dropped before the call is made.
  • type must be one of choice, score, noul.

A request that breaks one of these rules returns 400 and is not billed.

Limits & credits

Daily allowances, how credits are metered and expire, and what happens when you run out.

The allowance ladder

SurfaceDaily limitCredits
Playground, anonymous10 decisionsnone
Playground, signed in10 decisionsnone
Public API, gifted allowance100 decisions1,000 gift credits
Public API, after buying creditsno daily limitwhatever balance you paid for

The playground is a trial surface. The real allowance lives on the API, and the API is where credits are spent.

How the daily limit behaves

The API daily limit applies while you are still on the gifted credits. Buy a credit pack and the cap lifts entirely — from then on you are limited only by your balance, and the API will not throttle you at all.

The counter is a fixed daily window that starts with your first call. It is enforced before the request reaches the model, so a rejected call does not consume a credit.

When the limit is hit, the response is 429 and carries the moment the allowance resets:

{
  "code": -1,
  "message": "You have reached the daily free limit of 100 decisions. Buy credits to lift it.",
  "error": "You have reached the daily free limit of 100 decisions. Buy credits to lift it.",
  "daily_limit": 100,
  "reset_at": "2026-11-01T09:14:22.000Z",
  "remaining_credits": 812,
  "upgrade_path": "/settings/credits"
}

Credits

  • One decision costs one credit, no matter how many questions you send.
  • A failed call costs nothing. Validation errors, upstream rejections and provider outages are never billed.
  • Credits expire 365 days after they are granted — whether they were a gift or a purchase.
  • Credits are drawn down oldest-expiry first, so the ones about to expire are used before the ones that are not.
  • The response tells you the balance. usage.remaining_credits is the balance after the call.

The credit ledger is visible in your dashboard under Settings → API Requests, which records the time, the task, the decision, the confidence and the key used for every call.

When the balance runs out

{
  "code": -1,
  "message": "Insufficient credits",
  "error": "Insufficient credits",
  "remaining_credits": 0
}

A 402 means the account has no usable credits left. Buy a pack from the pricing page — the balance is credited as soon as the payment is confirmed, and the daily cap is lifted at the same time.

Expired credits do not count

A credit past its expiry date is no longer part of the balance, and it does not count towards lifting the daily cap either.

Errors

Every status code the API returns, what it means, and how to react to it.

The error envelope

Errors share one shape. code is -1, message is human-readable, and error repeats the message so the body reads like a normal REST error. Some errors add extra fields that tell you what to do next.

{
  "code": -1,
  "message": "\"input\" is required",
  "error": "\"input\" is required"
}

Status codes

400 Bad Request

The request never reached the model. Nothing was billed.

MessageCause
Request body must be JSONThe body could not be parsed.
Request body must be a JSON objectThe body was valid JSON but not an object.
"input" is requiredinput (or state) was missing or empty.
At least one question is requiredquestions was missing or empty.
Question "<key>" requires a "prompt" (or "instructions") stringA question had no prompt.
Question "<key>" of type "choice" requires a "criteria" object, ...A choice question had no criteria.
Question "<key>" of type "score" requires a "criteria" array, ...A score question had no criteria.
Question "<key>" has an unsupported type. Use one of: choice, score, noulThe type was not recognised.

401 Unauthorized

MessageCause
Missing API key. Pass it as "Authorization: Bearer sk-..."No bearer token on the request.
Invalid API keyThe key does not exist, was deleted, or is disabled.

402 Payment Required

The account has no usable credits.

{
  "code": -1,
  "message": "Insufficient credits",
  "error": "Insufficient credits",
  "remaining_credits": 0
}

Buy a credit pack to continue. See Limits & credits.

429 Too Many Requests

The daily allowance is used up. See Limits & credits for the full rules.

{
  "code": -1,
  "message": "You have reached the daily free limit of 100 decisions. Buy credits to lift it.",
  "error": "You have reached the daily free limit of 100 decisions. Buy credits to lift it.",
  "daily_limit": 100,
  "reset_at": "2026-11-01T09:14:22.000Z",
  "remaining_credits": 812,
  "upgrade_path": "/settings/credits"
}

500 Internal Server Error

The service could not complete the call — for example Jev decision failed unexpectedly, or Jev upstream is not configured. Nothing was billed. Retry after a short delay; if it persists, contact support with the request id.

502 Bad Gateway

The upstream model rejected the request, or answered in a way the API could not turn into a decision. The message carries the upstream status and body so you can see what the provider said. Nothing was billed.

Handling errors in code

const response = await fetch('https://jevmodel.io/api/v1/decisions', options);
const payload = await response.json();

if (!response.ok) {
  switch (response.status) {
    case 400:
      throw new Error(`Bad request: ${payload.message}`);
    case 401:
      throw new Error('The API key is missing or invalid.');
    case 402:
      throw new Error('Out of credits.');
    case 429:
      throw new Error(`Rate limited until ${payload.reset_at}.`);
    default:
      throw new Error(`Jev API error ${response.status}: ${payload.message}`);
  }
}

Retrying

  • 400, 401, and 402 will not succeed on a retry. Fix the request, the key, or the balance first.
  • 429 succeeds after reset_at.
  • 500 and 502 are worth retrying with exponential backoff. Since a failed call is not billed, a retry costs you nothing beyond the upstream call.