# Hugging Face Model Explorer — Metadata & Card Parser (`lovely_radiologist/hf-model-explorer`) Actor

Structured export of HF models with task, library, license, download count, and parsed model-card metadata. Built for AI teams doing model selection at scale.

- **URL**: https://apify.com/lovely_radiologist/hf-model-explorer.md
- **Developed by:** [Vivek Gaur](https://apify.com/lovely_radiologist) (community)
- **Categories:** AI, Other
- **Stats:** 2 total users, 1 monthly users, 76.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 model extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Hugging Face Model Explorer — Metadata, Task & Card Parser

Discover and extract structured metadata from the Hugging Face Model Hub — model IDs, authors, total downloads, likes, primary task pipeline tags, libraries, licenses, and **parsed model card YAML frontmatter & summaries**.

Built for AI engineers, machine learning researchers, procurement/compliance officers, and automated model registry builders.

***

### What this Actor does

This Actor queries the official Hugging Face Hub API and parses model card documentation to produce clean, normalized JSON:

- **Search & Filter**: Search by keyword or filter directly by task (e.g. `text-generation`, `image-to-image`, `feature-extraction`) and library (e.g. `transformers`, `diffusers`, `vllm`, `sentence-transformers`).
- **Popularity & Growth Metrics**: Extract historical total downloads and like counts.
- **Parsed Model Card Metadata**: Parses YAML frontmatter from `README.md` to extract explicit license definitions, base models, and quantization attributes without returning megabytes of raw markdown.
- **Card Summary**: Extracts the clean, plain-text summary of the model's purpose and usage instructions.

***

### Why use this Actor

- **Automated License & Compliance Audits**: Screen thousands of models for commercial friendliness (e.g. `apache-2.0`, `mit`) versus restrictive licenses (`cc-by-nc-4.0`, custom community licenses).
- **Parsed Metadata vs. Raw Blobs**: Other scrapers dump the entire raw README. This Actor structures the critical attributes into queryable keys.
- **No Heavy Browser Required**: Runs via direct asynchronous HTTP calls to the Hugging Face API, resulting in blazing fast speed and near-zero compute overhead.
- **Pay-Per-Event Economy**: Only pay for the models you actually extract ($0.0005 per model).

***

### Features

- **Flexible Sorting**: Sort by `downloads`, `likes`, `trending`, `created`, or `lastModified`.
- **Private/Gated Access Support**: Accepts an optional `hfToken` to access gated models (like Llama or Gemma) tied to your Hugging Face account.
- **Pagination & Volume**: Extract from 1 up to 500 models per single execution.

***

### Use cases

- **Model Selection & Benchmarking**: Survey available open-source models matching your exact task before training or fine-tuning.
- **Corporate AI Registries**: Automatically synchronize an internal enterprise catalog of permitted open-source weights.
- **Trend Spotting & Newsletter Automation**: Monitor the fastest-growing models across categories like speech, vision, and reasoning.
- **AI Agent Tool Calling**: Equip autonomous agents with a live tool to recommend the best available model for a user's task.

***

### Input

| Field | Type | Description | Default | Example |
|---|---|---|---|---|
| `query` | String | Search term to filter models by name or keyword. | `"llama"` | `"deepseek"` |
| `task` | String | Pipeline tag filter (e.g. `text-generation`, `image-classification`). | `""` | `"text-generation"` |
| `library` | String | Library filter (e.g. `transformers`, `diffusers`, `sentence-transformers`). | `""` | `"transformers"` |
| `sort` | String (Select) | Sort criteria: `downloads`, `likes`, `trending`, `created`, or `lastModified`. | `"downloads"` | `"downloads"` |
| `maxResults` | Integer | Maximum number of models to return (1 to 500). | `50` | `100` |
| `hfToken` | String | Optional Hugging Face User Access Token (for gated models). | `""` | `"hf_..."` |

#### Example input

```json
{
  "query": "llama-3",
  "task": "text-generation",
  "library": "transformers",
  "sort": "downloads",
  "maxResults": 50
}
```

***

### Output

Every discovered model outputs a structured JSON item into your dataset.

#### Field Definitions

- `modelId` *(String)*: Unique repository identifier (`author/model-name`).
- `author` *(String)*: Model creator or organization handle.
- `downloads` *(Integer)*: Total download count.
- `likes` *(Integer)*: Heart/like count on Hugging Face.
- `task` *(String | null)*: Primary pipeline task (e.g. `text-generation`).
- `library` *(String | null)*: Compatible library framework.
- `license` *(String | null)*: Extracted SPDX license identifier.
- `lastModified` *(ISO Date)*: Last commit or update timestamp.
- `tags` *(Array of Strings)*: Hub tags including language, framework, and dataset associations.
- `cardSummary` *(String | null)*: Cleaned 500-character plain text summary of the model card.

#### Example output

```json
{
  "modelId": "meta-llama/Meta-Llama-3.1-8B-Instruct",
  "author": "meta-llama",
  "downloads": 14200000,
  "likes": 18450,
  "task": "text-generation",
  "library": "transformers",
  "license": "llama3.1",
  "lastModified": "2024-08-20T14:15:32.000Z",
  "tags": [
    "transformers",
    "safetensors",
    "llama",
    "text-generation",
    "en",
    "license:llama3.1"
  ],
  "cardSummary": "The Meta Llama 3.1 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction tuned generative models in 8B, 70B and 405B sizes..."
}
```

***

### Pricing (Pay-Per-Event)

| Event Name | Price (USD) | Charged When |
|---|---|---|
| `actor-start` | **$0.01** | Charged once when run initializes |
| `model-item` | **$0.0005** | Charged per model record successfully exported |

*Example cost*: Extracting 100 structured model profiles costs $0.01 + (100 × $0.0005 = $0.05) = **$0.06 total**.

***

### API usage

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run = client.actor("lovely_radiologist/hf-model-explorer").call(run_input={
    "task": "text-generation",
    "sort": "trending",
    "maxResults": 20
})

for model in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{model['modelId']} — Downloads: {model['downloads']:,} | License: {model['license']}")
```

#### Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_API_TOKEN' });

const run = await client.actor('lovely_radiologist/hf-model-explorer').call({
    query: 'qwen',
    sort: 'downloads',
    maxResults: 25
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

***

### Limitations

- **Model Card Availability**: If a model creator has not populated a `README.md` or YAML frontmatter on the Hub, `cardSummary` and `license` may fall back to tag-derived heuristics.
- **Maximum Results**: Single runs support up to 500 records to ensure fast execution and avoid platform API timeouts.

***

### FAQ

##### Do I need a Hugging Face API key?

No! Public models are queried directly without any token. You only need to pass `hfToken` if querying gated models (e.g. official Meta or Mistral weights) that require accepted terms on your personal account.

##### Can I export results to CSV or Excel?

Yes! In the Apify Console dataset tab, export your results in JSON, CSV, Excel, XML, or JSONL formats with one click.

***

### Support & Related Actors

- [Hugging Face Dataset Scraper](https://apify.com/lovely_radiologist/hf-dataset-scraper) — Extract and inspect datasets, training splits, and column schemas.
- [Hugging Face Daily Trends & Leaderboards](https://apify.com/lovely_radiologist/hf-trends-leaderboard) — Track trending models and Open LLM Leaderboard shifts.
- [arXiv Paper Extractor](https://apify.com/lovely_radiologist/arxiv-paper-extractor) — Extract academic papers introducing these models.

# Actor input Schema

## `query` (type: `string`):

Search term to filter models by name or keyword.

## `task` (type: `string`):

Pipeline tag filter, e.g. text-generation, image-classification

## `library` (type: `string`):

e.g. transformers, diffusers, sentence-transformers

## `sort` (type: `string`):

Sorting order for the model results.

## `maxResults` (type: `integer`):

Maximum number of models to return.

## Actor input object example

```json
{
  "query": "llama",
  "sort": "downloads",
  "maxResults": 50
}
```

# Actor output Schema

## `results` (type: `string`):

All discovered models stored in the default dataset.

## `overviewView` (type: `string`):

Model ID, downloads, likes, task, library, and license overview.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "llama",
    "task": "",
    "library": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("lovely_radiologist/hf-model-explorer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "llama",
    "task": "",
    "library": "",
}

# Run the Actor and wait for it to finish
run = client.actor("lovely_radiologist/hf-model-explorer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "llama",
  "task": "",
  "library": ""
}' |
apify call lovely_radiologist/hf-model-explorer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lovely_radiologist/hf-model-explorer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/e7eahoq42bC4gigiN/builds/lHw0RCohrlVY60udX/openapi.json
