/v1/labelClassify content based on a single label criteria.
https://api.zentropi.ai
Authorization: Bearer your_api_key_here
| Field | Type | Required | Description |
|---|---|---|---|
content_text |
string | Conditional | The text content to be labeled. At least one of content_text or content_image or content_video is required. Text can be provided together with image or video for multimodal labeling. |
content_image |
string | Conditional | Base64-encoded image data (data URL format). At least one of content_text, content_image, or content_video is required. Both can be provided together. 5MB max size. Subscriber Only |
content_video |
string | Conditional | Base64-encoded video data (data URL format). At least one of content_text, content_image, or content_video is required. Can be combined with content_text. 25MB max size, 60s max duration. Subscriber Only |
criteria_text |
string | Conditional | The labeling criteria to use directly. Required unless labeler_id or labeler_version_id is provided. Cannot be combined with either field. |
labeler_id |
string | Conditional | The ID of the labeler to use. Uses its latest deployed version unless labeler_version_id is specified. Optional when a specific labeler_version_id is provided. Cannot be combined with criteria_text. |
labeler_version_id |
string | No | The ID of a deployed labeler version to use. Use "latest" or omit this field to use the latest deployed version of a specified labeler_id. Cannot be combined with criteria_text. |
model |
string | No | Model to use for evaluation:
|
| Field | Type | Description |
|---|---|---|
label |
string | The classification result ("0" or "1") |
confidence |
float | Confidence score for the classification (0.5 to 1.0) |
compute_time |
float | Processing time in seconds, including inference, network, and API overhead. |
{
"label": "1",
"confidence": 0.87,
"compute_time": 0.324
}
/v1/multilabelEvaluate up to 26 binary labeling policies against the same text in one request. Returns an ordered array containing one result per policy. This endpoint currently supports text only.
https://api.zentropi.ai
Authorization: Bearer your_api_key_here
| Field | Type | Required | Description |
|---|---|---|---|
content_text | string | Yes | The shared text to evaluate against every policy. Must not be blank. This endpoint currently supports text only. |
model | string | Yes* | A model supporting multi-label evaluation: cope-b-s1. |
labelers | array of objects | Yes | Between 1 and 26 labelers to evaluate. Each entry supplies inline criteria or references a saved labeler. See the fields below. |
* Explicitly select a supported model. Omitting model selects cope-latest, which currently does not support multi-label requests.
| Field | Type | Required | Description |
|---|---|---|---|
key | string | No | An optional caller-defined result identifier, distinct from labeler_id, echoed in the corresponding result. Must not be blank and must be unique within the request. |
criteria_text | string | Conditional | The policy to evaluate directly. Required unless labeler_id or labeler_version_id is provided. Cannot be combined with either field. |
labeler_id | string | Conditional | The deployed labeler to use. Uses its latest deployed version unless labeler_version_id is specified. Optional when a specific version ID is provided. |
labeler_version_id | string | No | A specific deployed version ID. Use "latest" or omit this field to select the latest deployed version of a supplied labeler_id. |
{
"model": "cope-b-s1",
"content_text": "The vase arrived cracked. Please refund my payment.",
"labelers": [
{
"key": "refund",
"criteria_text": "The customer requests a refund."
},
{
"key": "damage",
"criteria_text": "The customer reports a damaged product."
}
]
}
Returns a JSON array in the same order as labelers, including when only one labeler is requested.
| Field | Type | Description |
|---|---|---|
key | string | The caller-supplied result key. Omitted if no key was supplied. |
label | string | The binary classification: "0" or "1". |
confidence | float | Confidence in the returned classification (0.5 to 1.0). |
compute_time | float | Processing time in seconds, including inference, network, and API overhead. The same value appears in each result; do not add these values together. |
Illustrative response showing the documented fields:
[
{
"key": "refund",
"label": "1",
"confidence": 0.97,
"compute_time": 0.324
},
{
"key": "damage",
"label": "1",
"confidence": 0.95,
"compute_time": 0.324
}
]
These status codes and retry guidelines apply to both endpoints.
For HTTP 429 and 5xx responses, retry with exponential backoff and jitter. Honor the Retry-After header when present, and limit the number of retries. Other 4xx responses generally require correcting the request or resolving an authentication or access issue before retrying.
import requests
ZAPI_KEY = "your_api_key_here"
ZAPI_URL = "https://api.zentropi.ai/v1/label"
content_text = "This is a funny joke"
criteria_text = "Label jokes"
response = requests.post(
ZAPI_URL,
headers={"Authorization": f"Bearer {ZAPI_KEY}"},
json={
"content_text": content_text,
"criteria_text": criteria_text,
}
)
result = response.json()
print(f"Label: {result['label']}")
print(f"Confidence: {result['confidence']}")
# Example output:
# Label: 1
# Confidence: 0.85
# For multimodal examples, see this notebook:
# https://colab.research.google.com/drive/1jfMkpaoX5lAKoGpqVUeyv_4haGn1BUX6
const ZAPI_KEY = "your_api_key_here";
const ZAPI_URL = "https://api.zentropi.ai/v1/label";
// Label content using Z-API
const labelContent = async () => {
const response = await fetch(ZAPI_URL, {
method: "POST",
headers: {
"Authorization": `Bearer ${ZAPI_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
content_text: "This is a funny joke",
criteria_text: "Label jokes"
})
});
const result = await response.json();
console.log(`Label: ${result.label}`);
console.log(`Confidence: ${result.confidence}`);
};
labelContent();
// Example output:
// Label: 1
// Confidence: 0.85
import requests
ZAPI_KEY = "your_api_key_here"
ZAPI_URL = "https://api.zentropi.ai/v1/multilabel"
response = requests.post(
ZAPI_URL,
headers={"Authorization": f"Bearer {ZAPI_KEY}"},
json={
"model": "cope-b-s1",
"content_text": "The vase arrived cracked. Please refund my payment.",
"labelers": [
{
"key": "refund",
"criteria_text": "The customer requests a refund.",
},
{
"key": "damage",
"criteria_text": "The customer reports a damaged product.",
},
],
},
timeout=120,
)
response.raise_for_status()
# Results are in the same order as the requested labelers.
results = response.json()
for result in results:
print(f"{result['key']}: {result['label']} (confidence: {result['confidence']})")
# Shared compute time; do not sum across results.
print(f"Compute time: {results[0]['compute_time']} seconds")
const ZAPI_KEY = "your_api_key_here";
const ZAPI_URL = "https://api.zentropi.ai/v1/multilabel";
const labelContent = async () => {
const response = await fetch(ZAPI_URL, {
method: "POST",
headers: {
"Authorization": `Bearer ${ZAPI_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "cope-b-s1",
content_text: "The vase arrived cracked. Please refund my payment.",
labelers: [
{
key: "refund",
criteria_text: "The customer requests a refund."
},
{
key: "damage",
criteria_text: "The customer reports a damaged product."
}
]
})
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
// Results are in the same order as the requested labelers.
const results = await response.json();
for (const result of results) {
console.log(`${result.key}: ${result.label} (confidence: ${result.confidence})`);
}
// Shared compute time; do not sum across results.
console.log(`Compute time: ${results[0].compute_time} seconds`);
};
labelContent().catch(console.error);