Skip to content
aityx
Esc
↑↓navigate↵open⌘Jpreview
On this page

Using Jev with aityx

Run Jev questions and native calculations in one System One request.

Keep your Jev questions. Add amounts, dates and conditions when your application needs them. System One runs Jev alone or combines its answers with a native aityx model in one call. It does not generate a model at execution time.

Run a Jev request

POST /v1/systemone accepts top-level questions and state, with an optional Jev model name. For example:

{
  "questions": {
    "damage_probability": {
      "type": "noul",
      "instructions": "Does customer_email explicitly report damage to the delivered item?",
      "criteria": {
        "true": "Damage or a defect is explicitly reported.",
        "false": "The customer reports no damage."
      }
    }
  },
  "state": { "customer_email": "The item arrived broken." }
}

This calls Jev and returns its answers as the result, at the single execution rate. No aityx model is created or run. Jev question types are noul, choice and score.

The request is Jev-compatible; the response uses the aityx contract: answers, receipt and usage. Jev-only calls put Jev’s answers in answers. Combined calls include both Jev and native answers; native answers take precedence if names overlap. The response does not echo the model, questions or state, or include a separate upstream response. Check your response handling when changing the API base URL.

Add a native model

Add decision alongside the same questions and state. The API runs Jev first, merges its named answers with the state, validates the native inputs, then executes your definition.

This compact purchase example is illustrative:

{
  "state": { "amount": 120, "message": "Yes, I approve this purchase." },
  "questions": {
    "approval_probability": {
      "type": "noul",
      "instructions": "Does state.message explicitly approve this purchase?"
    }
  },
  "decision": {
    "name": "Purchase approval",
    "inputs": {
      "amount": { "type": "number", "desc": "Purchase amount" },
      "approval_probability": { "type": "number", "desc": "Jev approval probability" }
    },
    "decisions": {
      "allow": { "type": "boolean", "expr": "approval_probability >= 0.8 and amount <= 500" }
    }
  }
}

You supply state once. Answers and types come from native decisions; there is no duplicated native question contract.

  • Noul becomes a numeric probability in [0,1].
  • Choice becomes its selected string.
  • Score becomes a number.

These values are not thresholded or rounded by the API. The model above explicitly requires approval_probability >= 0.8. Jev answers override state fields with matching names; use distinct names for evidence and trusted business facts. The receipt labels fact provenance as state or jev.

To select a Jev model, add top-level model: "jev-latest". The native definition remains in decision. Supply questions and one top-level state; there is no nested jev request wrapper. Omitting the Jev model uses the server default.

Run a complete example

Download the current console’s original refund example:

curl --fail -sS https://aityx.ai/docs/examples/refund-request.json > refund-request.json

curl --fail-with-body -sS https://api.aityx.ai/v1/systemone \
  -H "Authorization: Bearer $AITYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d @refund-request.json > refund-response.json

jq '{answers, receipt, usage, decision_error}' refund-response.json

In the local recording, Jev assessed the damaged-item email; the native model applied the seven-day damage window to a $129 order and returned a $129 refund. Jev evidence can vary between calls. The use-case guide also includes travel and discount examples.

Cost, timing and failures

Jev-only and Jev + Decision calls each settle one charge: $0.042 per 1M API input tokens, output free. Jev-only usage uses Jev’s exact reported counts. Combined usage adds local tokens for the native definition and native result/trace, counting shared state and questions once. Separate provider counts and charges are available in the console; they are not a second bill. Jev inference/network time is additional to local evaluation; a native model’s millisecond timing is not a chained-call timing guarantee.

If Jev fails, aityx does not execute. If Jev completes and the native model then fails, the API returns HTTP 200 with Jev’s answers, its trace and decision_error. That completed Jev execution is still charged. Check decision_error before reading native answers; see Errors.

Questions only ever mean Jev

There is no other AI route to choose. questions never author a model and never trigger general input interpretation: to run unstructured input through a Decision, name each missing fact as a Jev question, as above. To create or change a Decision, edit its JSON.

One endpoint, three shapes and Pricing explain the shapes and the single rate.

Was this page helpful?