An HTTP API to classify Replicate models into Hugging Face tasks using a language model.
Powered by:
- Cloudflare Workers for hosting the HTTP API
- Hono for authoring the HTTP API
- Anthropic Claude 3.7 Sonnet for model classification
- Replicate API for model metadata
- Hugging Face Tasks for model task metadata
- Cloudflare D1 for caching classifications
Repository: https://github.com/zeke/replicate-model-classifier
Base URL: https://replicate-model-classifier.ziki.workers.dev/
GET /api/models/:owner/:model
Returns a JSON object with the model classification. Responses are cached for 10 years.
{
"model": "salesforce/blip",
"classification": {
"summary": "Generate image captions and answer questions about images",
"inputTypes": ["image", "text"],
"outputTypes": ["text"],
"task": "visual-question-answering",
"taskSummary": "Visual Question Answering is the task of answering open-ended questions based on an image. They output natural language responses to natural language questions.",
"useCases": [
"Generate image captions for social media",
"Answer questions about medical images",
"Create alt text for accessibility",
"Analyze security camera footage",
"Describe artwork for museums",
"Generate product descriptions",
"Answer questions about diagrams",
"Create image-based quizzes",
"Analyze satellite imagery",
"Describe scenes in videos"
]
}
}
The response includes cache headers:
X-Cache
: Either "HIT" or "MISS" to indicate if the response came from cacheCache-Control
: "public, max-age=315360000" (10 years)
Examples
- /api/models/bytedance/sdxl-lightning-4step
- /api/models/meta/meta-llama-3-8b-instruct
- /api/models/black-forest-labs/flux-schnell
- /api/models/salesforce/blip
- /api/models/meta/meta-llama-3-70b-instruct
- /api/models/stability-ai/stable-diffusion
- /api/models/abiruyt/text-extract-ocr
- /api/models/tencentarc/gfpgan
- /api/models/andreasjansson/clip-features
- /api/models/stability-ai/sdxl
To get a pretty-printed view of the prompt that was used to classify the model, add the prompt
query parameter:
GET /api/models/:owner/:model?prompt=1
Examples
- /api/models/wavespeedai/wan-2.1-i2v-480p?prompt=1
- /api/models/meta/meta-llama-3-8b-instruct?prompt=1
- /api/models/black-forest-labs/flux-schnell?prompt=1
It can be helpful to see all the data that goes into the model classification. You can see all the data by adding the debug
query parameter:
GET /api/models/:owner/:model?debug=1
Examples:
- /api/models/wavespeedai/wan-2.1-i2v-480p?debug=1
- /api/models/meta/meta-llama-3-8b-instruct?debug=1
- /api/models/black-forest-labs/flux-schnell?debug=1
Get all cached model classifications:
GET /api/classifications
Returns a JSON object with all cached classifications:
{
"classifications": [
{
"model": "salesforce/blip",
"classification": {
"summary": "Generate image captions and answer questions about images",
"inputTypes": ["image", "text"],
"outputTypes": ["text"],
"task": "visual-question-answering",
"taskSummary": "Visual Question Answering is the task of answering open-ended questions based on an image. They output natural language responses to natural language questions.",
"useCases": [
"Generate image captions for social media",
"Answer questions about medical images",
"Create alt text for accessibility",
"Analyze security camera footage",
"Describe artwork for museums",
"Generate product descriptions",
"Answer questions about diagrams",
"Create image-based quizzes",
"Analyze satellite imagery",
"Describe scenes in videos"
]
},
"createdAt": "2024-04-29T04:00:00.000Z",
"updatedAt": "2024-04-29T04:00:00.000Z"
}
]
}
Get statistics about the classification cache:
GET /api/cache/stats
Returns a JSON object with cache statistics:
{
"total": 100,
"oldest": {
"model": "salesforce/blip",
"createdAt": "2024-04-29T04:00:00.000Z"
},
"newest": {
"model": "meta/meta-llama-3-8b-instruct",
"createdAt": "2024-04-29T05:00:00.000Z"
}
}
GET /api/tasks
See /api/tasks
GET /api/taskNames
See /api/taskNames
Each model classification includes a useCases
array that provides 10 specific use cases for the model. These use cases are generated by the language model based on the model's capabilities, input/output types, and task classification. Each use case is a concise, single-sentence description of a practical application of the model.
The use cases are designed to be:
- Specific and actionable
- Diverse in their applications
- Relevant to the model's capabilities
- Concise (8 words or less)
- Practical and real-world focused
This feature helps users quickly understand the potential applications of each model and find models that match their specific needs.