/v1/labelClassify text content based on your custom 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. Exactly one of criteria_text or labeler_id is required. |
labeler_id |
string | Conditional | The ID of the labeler to use. Exactly one of criteria_text or labeler_id is required. |
labeler_version_id |
string | No | The ID of which deployed version to use. Only used with labeler_id. Default: "latest" |
model |
string | No | Model to use for evaluation:
cope-latest will default to cope-b-a4b for text and cope-b-a4b-mm for multimodal labeling. cope-b-12b will be deprecated at that time. |
| 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 | Time taken to process the request in seconds |
{
"label": "1",
"confidence": 0.87,
"compute_time": 0.324
}
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