const response = await fetch("https://api.seeapi.com/v1/inferences", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "jev-parcel-image-001",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "jev-1-14",
"endpoint": "decisions",
"provider": "seeapi",
"input": {
"state": {
"message": "Is the parcel visibly damaged?",
"evidence": [
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,<BASE64_IMAGE_BYTES>"
}
}
]
},
"questions": {
"needs_support": {
"type": "noul",
"instructions": "Does the customer need help with an existing order?"
},
"routing": {
"type": "choice",
"instructions": "Which queue should handle this request?",
"criteria": {
"billing": "Questions about charges, invoices, or refunds.",
"delivery": "Questions about delivery, tracking, or address changes."
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is the request?",
"criteria": [
"Can wait",
"Needs attention soon",
"Requires immediate attention"
]
},
"damaged_region": {
"type": "box",
"instructions": "Locate the most visibly damaged region in the supplied image."
}
}
}
})
});
const result = await response.json();
{
"id": "task_xxx",
"object": "inference",
"model": "jev-1-14",
"endpoint": "decisions",
"provider": "seeapi",
"status": "succeeded",
"consumed_credits": 0.022,
"input_tokens": 1300,
"output_tokens": 129,
"result": {
"type": "json",
"data": {
"answers": {
"needs_support": {
"type": "noul",
"noul": 0.91
},
"routing": {
"type": "choice",
"choice": "delivery",
"confidence": 0.88,
"probabilities": {
"billing": 0.08,
"delivery": 0.92
}
},
"urgency": {
"type": "score",
"score": 1,
"confidence": 0.76,
"probabilities": {
"0": 0.08,
"1": 0.76,
"2": 0.16
},
"legend": {
"0": "Can wait",
"1": "Needs attention soon",
"2": "Requires immediate attention"
}
},
"damaged_region": {
"type": "box",
"box": {
"top": 0.12,
"bottom": 0.58,
"left": 0.2,
"right": 0.74
},
"confidence": 0.86
}
}
}
},
"error": null
}