Decisions API
Send context and a question. Get a structured decision.
Create an API key in your account settings and buy credits. Send Authorization: Bearer YOUR_API_KEY and a unique Idempotency-Key for each decision. The key owner pays for usage; never expose keys in browser code.
A Jev API example for your next integration
Call the iajev REST API with cURL. Receive a choice, probabilities, and confidence as JSON.
curl https://iajev.com/api/v1/decisions/run \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
-H 'Content-Type: application/json' \
--data '{
"state": {
"message": "I was charged twice for my subscription last month and still haven'\''t received a refund.",
"plan": "pro",
"country": "US"
},
"decision": {
"type": "choice",
"question": "Which team should handle this request?",
"choices": [
"Billing",
"Technical",
"Sales",
"Fraud"
]
}
}'Choose a decision model
Existing requests keep using Jev. The endpoint, API key, decision types and Jev response shape are unchanged. Add model: "clef" only when you want Clef; omit model or use "jev" for Jev.
Jev: 1 credit per started 1,000 input tokens. Clef: 1 credit per started 100 input tokens. Minimum charge: 1 credit. Actual input usage includes the question and criteria, not just your context.
Jev reserves up to 32 available credits and requires at least 1. Clef dynamically reserves credits estimated from the complete text and image dimensions; the full estimate must be available. Actual input usage determines the charge, capped at the reservation. Unused credits return; iajev covers underestimates. Failed requests are not charged.
Estimate text from the JSON encoding of state and the mapped upstream questions, including all choice labels and descriptions: max(Unicode characters × 2, UTF-8 bytes) + 200 tokens. Add image tokens estimated from 32-pixel grids after a minimum 65,536-pixel upscale, plus a 25% margin and 16 tokens per image. Cap at 65,536 tokens and round up to credits per 100. This is a heuristic, not a tokenizer. GET /api/v1/models exposes the estimation version, parameters and maximum hold; Clef billing now uses reservationMode, maxReservationCredits, estimation and chargeCappedAtReservation instead of fixed reservationCredits/minimumAvailableCredits.
Jev keeps its 8,000-character / 16,000-byte limits. Clef accepts up to 1 MiB of JSON-encoded text and a 65,536-token model window shared by text, images and the question; overlong state may be truncated upstream. Both accept one question and up to 8 choices or score levels. Clef requests may be up to 13 MiB; video is not supported.
Clef images: optional images array of data:image/png;base64,... data URLs (JPEG/WebP also supported), or {content_type, base64} objects. Up to 4 images; each up to 4 MiB and 16 MP, 8 MiB decoded total. Remote URLs are rejected. Images affect idempotency, are not retained in history or saved presets, and must be resubmitted on retries. Clef timeout: 90 seconds; Jev: 15 seconds. The playground loads three fixed iajev CDN examples through an internal helper and resizes them to 512px before submission. API/MCP clients still send embedded images; remote URLs remain unsupported.
GET /api/v1/models uses your existing API key and costs no credits. Read available before calling. MCP clients can use the free list_models tool, then pass model to run_decision. Authentication and scopes stay unchanged.
Use the same idempotency key after an uncertain result. Changing model under the same key returns IDEMPOTENCY_CONFLICT. Completed calls replay their original result and charge even if Clef is later disabled. No automatic model fallback occurs.
Only Clef responses add meta.model and billing.pricingVersion, estimationVersion, estimatedInputTokens, reservedCredits and waivedCredits. waivedCredits is the difference iajev covers if usage exceeds the hold; billing.credits is the actual debit. Jev responses stay unchanged. MODEL_UNAVAILABLE (503) means Clef is disabled.
curl https://iajev.com/api/v1/models -H 'Authorization: Bearer YOUR_API_KEY'curl https://iajev.com/api/v1/decisions/run \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: clef-example-001' \
-H 'Content-Type: application/json' \
--data '{
"model": "clef",
"state": {
"message": "My payouts have failed for three days. Please help today."
},
"images": [
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jRZkAAAAASUVORK5CYII="
],
"decision": {
"type": "noul",
"question": "Does this request need urgent attention?"
}
}'{
"model": "clef",
"state": {
"message": "My payouts have failed for three days. Please help today."
},
"images": [
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jRZkAAAAASUVORK5CYII="
],
"decision": {
"type": "noul",
"question": "Does this request need urgent attention?"
},
"idempotency_key": "clef-example-001"
}Request fields
- model
- Existing requests keep using Jev. The endpoint, API key, decision types and Jev response shape are unchanged. Add model: "clef" only when you want Clef; omit model or use "jev" for Jev.
- images
- Clef images: optional images array of data:image/png;base64,... data URLs (JPEG/WebP also supported), or {content_type, base64} objects. Up to 4 images; each up to 4 MiB and 16 MP, 8 MiB decoded total. Remote URLs are rejected. Images affect idempotency, are not retained in history or saved presets, and must be resubmitted on retries. Clef timeout: 90 seconds; Jev: 15 seconds. The playground loads three fixed iajev CDN examples through an internal helper and resizes them to 512px before submission. API/MCP clients still send embedded images; remote URLs remain unsupported.
- state.message
- Jev keeps its 8,000-character / 16,000-byte limits. Clef accepts up to 1 MiB of JSON-encoded text and a 65,536-token model window shared by text, images and the question; overlong state may be truncated upstream. Both accept one question and up to 8 choices or score levels. Clef requests may be up to 13 MiB; video is not supported.
- state.<field>
- Up to 5 optional extra fields alongside message. Names: 1–40 characters. Values: text up to 300 characters, a finite number, or a boolean. Nested objects are not supported.
- decision.type
- Use "choice", "noul", or "score". Each request evaluates one question for one state.
- decision.question
- Required text; 1–300 characters.
- decision.choices
- Required for choice only: 2–8 unique, non-empty strings, up to 80 characters each.
- decision.criteria
- noul: optional object with both true and false descriptions (1–300 characters each). score: required ordered array of 2–8 unique labels (1–80 characters each), from lowest to highest. Do not send choices for these types.
Response fields
- decision
- choice: selected string. noul: probability of true (0–1), not a boolean. score: numeric score from 0 to criteria.length − 1; may be fractional.
- confidence
- Separate confidence estimate (0–1) for choice and score. null for noul because the upstream model does not provide it.
- results
- choice: labels and probabilities, highest first. noul: true then false, with probabilities p and 1 − p. score: labels and probabilities in the original criteria order; the array index is the score level.
- meta
- Latency in milliseconds and a request ID for troubleshooting.
- billing
- Credits charged, inputTokens, and outputTokens for this request.
Errors and limits
- 400
- Invalid input or missing Idempotency-Key.
- 401
- Missing, invalid, expired, or revoked API key.
- 402
- Insufficient available credits.
- 409
- Request pending, previously failed, or idempotency key reused with different input.
- 403
- Account is unverified or disabled.
- 413
- Request exceeds 16,000 UTF-8 bytes, including all fields.
- 415
- Content-Type must be application/json.
- 429
- API key rate limit reached. Respect the Retry-After header.
- 502 / 503 / 504
- Decision unavailable or timed out. Avoid immediate repeated retries.
{
"decision": "Billing",
"confidence": 0.8,
"results": [
{ "value": "Billing", "probability": 0.87 },
{ "value": "Technical", "probability": 0.10 },
{ "value": "Sales", "probability": 0.02 },
{ "value": "Fraud", "probability": 0.01 }
],
"meta": { "latencyMs": 218, "requestId": "…" },
"billing": { "credits": 1, "inputTokens": 380, "outputTokens": 0 }
}Boolean probability and scoring examples
noul
{
"state": {
"message": "My payouts have failed for three days. Please help today."
},
"decision": {
"type": "noul",
"question": "Does this request need urgent attention?"
}
}{
"decision": 0.95,
"confidence": null,
"results": [
{
"value": "true",
"probability": 0.95
},
{
"value": "false",
"probability": 0.05
}
],
"meta": {
"latencyMs": 218,
"requestId": "…"
},
"billing": {
"credits": 1,
"inputTokens": 380,
"outputTokens": 45
}
}score
{
"state": {
"message": "My payouts have failed for three days. Please help today."
},
"decision": {
"type": "score",
"question": "How urgent is this request?",
"criteria": [
"Low urgency",
"Moderate urgency",
"High urgency"
]
}
}{
"decision": 1.8,
"confidence": 0.9,
"results": [
{
"value": "Low urgency",
"probability": 0.05
},
{
"value": "Moderate urgency",
"probability": 0.1
},
{
"value": "High urgency",
"probability": 0.85
}
],
"meta": {
"latencyMs": 218,
"requestId": "…"
},
"billing": {
"credits": 1,
"inputTokens": 380,
"outputTokens": 45
}
}API changelog
2026-10-04: Added dynamic Clef reservations and capped charges, images and 64K context, optional model selection, Clef billing, GET /api/v1/models and MCP list_models. Jev remains the default, with its existing charges, response shape and historical idempotency preserved.
Added noul and score to POST /api/v1/decisions/run. The state + decision envelope, existing choice requests and responses, authentication, billing, and idempotency remain compatible.
curl https://iajev.com/api/v1/credits -H 'Authorization: Bearer YOUR_API_KEY'Jev: Each paid request temporarily reserves up to 32 available credits (at least 1 required), then charges 1 credit per started 1,000 input tokens (minimum 1). Unused credits are released; failed requests are not charged. Keep the same Idempotency-Key when retrying after a connection error. HTTP 409 REQUEST_PENDING means wait and retry with the same key; REQUEST_FAILED requires a new key. Reusing a key with different input returns 409.
Do not include secrets or unnecessary personal data. Context is sent for inference. Signed-in and API requests store inputs, results, and billing records in your private history. Saved decisions also retain their input context. Anonymous previews store rate-limit counters without decision history.