Answer a cancellation request
Run the homepage refund example with matching facts, then read a customer message with Jev.
Get a $20 refund and an October 28 deadline. Use the same model as the homepage demo. The example prorates a $60 subscription over 30 days, with 10 days unused, and gives seven calendar days to process a request accepted October 21.
You need an aityx account (sign up in the console with your email), credits, curl and jq. New accounts start without credits; follow the first-credit instructions before running this example.
Get an API key
Sign in to the console, open API keys and create a key. Keep it in your server environment. Console and API calls share your credit balance.
export AITYX_API_KEY="aityx_sk_…"
export AITYX="https://api.aityx.ai"Download the model and matching facts
These files contain the native model and state from the recorded homepage example. The model is the definition itself, with no nested wrapper or repeated questions.
curl --fail -sS https://aityx.ai/docs/examples/cancellation-model.json > cancellation-model.json
curl --fail -sS https://aityx.ai/docs/examples/cancellation-matching-state.json > cancellation-matching-state.json{
"customer_intent": "cancel_refund",
"plan_amount": 60,
"period_days": 30,
"unused_days": 10,
"accepted_on": "2026-10-21",
"refundable": true
}Execute the Decision alone
The facts already match the model. POST /v1/systemone runs it directly, without calling any provider.
jq -n --slurpfile model cancellation-model.json --slurpfile state cancellation-matching-state.json \
'{decision: $model[0], state: $state[0]}' > matching-request.json
curl --fail-with-body -sS "$AITYX/v1/systemone" \
-H "Authorization: Bearer $AITYX_API_KEY" \
-H "Content-Type: application/json" \
-d @matching-request.json > matching-response.json
jq '.answers | {
request_type: .request_type.choice,
refund_eligible: .refund_eligible.noul,
refund_amount: .refund_amount.number,
processing_deadline: .processing_deadline.date
}' matching-response.json{
"request_type": "cancel_refund",
"refund_eligible": 1,
"refund_amount": 20,
"processing_deadline": "2026-10-28"
}These are selected answers; the response also includes the deadline_days helper decision. Native boolean results use noul, so 1 means eligible here.
The recorded public call used 652 input tokens and 273 output tokens. At the published rate, its charge calculates to $0.000027384; output is free. This native execution called no provider. Public JSON reports token counts; timing and settled charges are console details.
Read a customer message with Jev, then decide
If your application has a message instead of customer_intent, add Jev questions to the same endpoint. Jev establishes that one fact from the message, preserves the supplied account facts, and the Decision returns the consolidated result in one call.
curl --fail -sS https://aityx.ai/docs/examples/cancellation-state.json > cancellation-state.json
curl --fail -sS https://aityx.ai/docs/examples/cancellation-jev-questions.json > cancellation-jev-questions.json
jq -n --slurpfile model cancellation-model.json --slurpfile state cancellation-state.json \
--slurpfile questions cancellation-jev-questions.json \
'{decision: $model[0], questions: $questions[0], state: $state[0]}' > combined-request.json
curl --fail-with-body -sS "$AITYX/v1/systemone" \
-H "Authorization: Bearer $AITYX_API_KEY" \
-H "Content-Type: application/json" \
-d @combined-request.json > combined-response.json
jq '{answers, receipt, usage, decision_error}' combined-response.jsonCheck decision_error in that output before going on. --fail-with-body only catches HTTP failures: if Jev completes but the Decision fails, the API returns HTTP 200 with Jev’s answers and a decision_error, not a completed Decision result. See Errors.
The message in that state is “Please cancel my subscription and refund the days I have not used.” The recorded public call returned the same selected answers with 1,057 input tokens and 331 output tokens, giving a calculated charge of $0.000044394 — output is free, and the combined Jev + Decision call settles as one charge at the same rate.
These recordings come from local API and console runs in October 2026. Console server work excludes the network; client round-trip time includes it. Token counts depend on the submitted request, including formatting. These examples are not production latency guarantees. The response does not echo the model or state; keep your request with the result.
Use the amount and date
After confirming decision_error is null or absent, read .answers.refund_amount.number and .answers.processing_deadline.date. If decision_error contains an object, do not act on any refund fields: the response holds Jev’s answers, but the Decision did not complete. Your application performs the cancellation or refund. Keep the returned receipt with the model and original state when you need the evidence.
With the same model, 15 unused days returns $30. Moving acceptance to October 22 returns an October 29 deadline. Try those input edits with the Decision alone.
The later homepage step changes the model itself: set decisions.deadline_days.expr to "3" and update the deadline description to match. With the same October 22 facts, the Decision returns October 25 and the same $30 refund. You edit the definition directly; there is no model-generation call.
Build your own decision
Write the native JSON and send it with each case. There is no model-authoring endpoint.
- Call it from code: JavaScript and Python.
- Use cases: the seven current console examples.
- Using Jev with aityx: run questions alone, or questions and calculations together.

