Clarifai API
Computer vision and NLP models — image recognition, moderation and more.
What it does
Clarifai is a computer-vision-first AI platform: pre-built models for image and video recognition, object detection, OCR, face and demographic analysis, moderation and embeddings, plus custom model training and workflows. It also proxies popular third-party LLMs through the same API.
Base URL
Authentication
Create a free account, then generate a Personal Access Token (PAT). Send it as Authorization: Key YOUR_PAT. Requests are scoped to a user_id and app_id. The community tier includes a monthly free operations allowance.
Code examples
curl -X POST "https://api.clarifai.com/v2/models/general-image-recognition/outputs" \
-H "Authorization: Key $CLARIFAI_PAT" \
-H "Content-Type: application/json" \
-d '{"inputs":[{"data":{"image":{"url":"https://samples.clarifai.com/metro-north.jpg"}}}]}'import requests
r = requests.post(
"https://api.clarifai.com/v2/models/general-image-recognition/outputs",
headers={"Authorization": f"Key {PAT}"},
json={"inputs": [{"data": {"image": {"url": IMG_URL}}}]},
timeout=30)
for c in r.json()["outputs"][0]["data"]["concepts"][:5]:
print(c["name"], round(c["value"], 3))Rate limits & quotas
The free community tier is metered in monthly operations (roughly 1,000) with a modest per-minute request rate. Paid plans raise both and add SLAs. Predictions accept a batch of inputs per call, which is the efficient way to stay under the rate limit.
Key response fields
| outputs[0].data.concepts[] | Predicted labels with a 0–1 value |
| outputs[0].data.regions[] | Bounding boxes for detection/OCR models |
| outputs[0].status.code | 10000 means success |
| outputs[0].model.id | Which model produced the output |
Common errors
| 401 | Bad PAT or wrong scheme (Key, not Bearer). |
| 11xxx status codes | Clarifai-specific errors in status.code even on HTTP 200 — always check it. |
| 429 | Monthly operations or per-minute rate exceeded. |
| 400 | Malformed inputs array or unreachable image URL. |
When to use it (and alternatives)
Best when your core need is vision — tagging, moderation, detection, OCR — with the option to train custom models. For open vision models you host-adjacent, compare Hugging Face; for generative image work see Stability AI.
FAQ
Why is my HTTP 200 response actually an error?
Clarifai puts a per-item status inside the JSON. Always check outputs[0].status.code == 10000; anything else (e.g. 11102 for a bad image) is a failure even though the HTTP status is 200.
Is Clarifai free?
The community plan includes about 1,000 free operations per month, enough to prototype. Production volume needs a paid plan.
Can I train my own model?
Yes — upload and label inputs into an app, then train a custom classifier or detector and call it at the same /v2/models/{id}/outputs endpoint.
New to APIs?
Short guides for working with this API — and any other.
🛠️ Handy LarzOS tools
Free tools to help you work with this API.
Prompt ImproverLearn Prompt Engineering