# HuggingFace Models Scraper (`resounding_diplomacy/huggingface-models-scraper`) Actor

Scrapes HuggingFace Hub for AI/ML models — trending, most downloaded, by task type, by author. Extracts model name, author, downloads, likes, task category, tags, pipeline tag, last modified, model card URL. Uses the HuggingFace JSON API for reliable structured data extraction.

- **URL**: https://apify.com/resounding\_diplomacy/huggingface-models-scraper.md
- **Developed by:** [alars num](https://apify.com/resounding_diplomacy) (community)
- **Categories:** AI, Developer tools, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## HuggingFace Models Scraper

Scrape the **HuggingFace Hub** for AI/ML models and get structured data about trending, most downloaded, and most liked models. Filter by task type (text-generation, image-classification, etc.) or by specific authors/organizations.

### Why this Actor?

- **Reliable data** — Uses the [HuggingFace JSON API](https://huggingface.co/docs/api-inference/index) (`/api/models`) instead of HTML scraping, so it won't break when the website UI changes
- **Rich metadata** — Extracts downloads, likes, pipeline tags, languages, licenses, library info, model card availability, and more
- **Flexible filtering** — Filter by sorting mode, task type, and author in a single run
- **Optional model cards** — Fetch full README/model card text for each model when you need descriptions

### Use Cases

- 📊 **Market research** — Track trending models and their download counts
- 🏢 **Competitive analysis** — Monitor models from specific organizations (OpenAI, Meta, Mistral, etc.)
- 🔍 **Model discovery** — Find models for specific tasks (text-generation, image-classification, etc.)
- 📈 **Trend tracking** — Schedule regular runs to track model popularity over time

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| **mode** | string | `trending` | Sort mode: `trending`, `downloads`, or `likes` |
| **task** | string | *(all)* | Filter by pipeline/task type (e.g. `text-generation`, `image-classification`) |
| **author** | string | *(all)* | Filter by author/org (e.g. `meta-llama`, `openai`, `mistralai`) |
| **maxItems** | integer | `100` | Max models to scrape (1–1000) |
| **includeModelCard** | boolean | `false` | Fetch full model card README text for each model |

### Output

Each dataset item contains:

| Field | Type | Description |
|-------|------|-------------|
| `modelId` | string | Full model identifier (e.g. `meta-llama/Llama-3.1-8B`) |
| `modelName` | string | Model name (last part of ID) |
| `author` | string | Author/organization |
| `url` | string | Link to model page on HuggingFace |
| `downloads` | integer | Total downloads |
| `likes` | integer | Number of likes |
| `pipelineTag` | string | Pipeline/task type |
| `tags` | array | All HuggingFace tags |
| `datasetTags` | array | Associated datasets |
| `languageTags` | array | Supported languages |
| `license` | string | License identifier |
| `libraryName` | string | ML library (transformers, diffusers, etc.) |
| `lastModified` | string | Last modification date |
| `createdAt` | string | Creation date |
| `hasModelCard` | boolean | Whether a README/model card exists |
| `private` | boolean | Whether the model is private |
| `gated` | boolean | Whether access requires approval |
| `modelCard` | string | *(optional)* Full README text |

### Example Output

```json
{
  "modelId": "meta-llama/Meta-Llama-3.1-8B",
  "modelName": "Meta-Llama-3.1-8B",
  "author": "meta-llama",
  "url": "https://huggingface.co/meta-llama/Meta-Llama-3.1-8B",
  "downloads": 8234567,
  "likes": 4521,
  "pipelineTag": "text-generation",
  "tags": ["safetensors", "llama3", "text-generation", "en"],
  "languageTags": ["en"],
  "license": "llama3.1",
  "libraryName": "transformers",
  "lastModified": "2024-07-15T10:30:00.000Z",
  "createdAt": "2024-07-04T00:00:00.000Z",
  "hasModelCard": true,
  "private": false,
  "gated": true
}
```

### Tips

- Combine **mode + task** to find trending models in a specific category
- Use **author** to scrape all models from a specific organization
- Set **includeModelCard** to `true` when you need model descriptions, but expect slower runs
- Use Apify Scheduler for regular tracking runs to build time-series data

### Cost

- **~1 API call** per run (no pagination needed for up to 1000 models)
- Minimal compute — just HTTP + JSON parsing
- Optional model card fetches add 1 request per model when enabled

# Actor input Schema

## `mode` (type: `string`):

How to sort/filter models

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

Filter models by pipeline/task type. Leave empty to get all tasks.

## `author` (type: `string`):

Filter models by a specific author or organization (e.g. 'openai', 'meta-llama', 'mistralai'). Leave empty for all authors.

## `maxItems` (type: `integer`):

Maximum number of models to scrape (1–1000)

## `includeModelCard` (type: `boolean`):

Fetch and include the full model card README text for each model. Slower but provides detailed descriptions.

## Actor input object example

```json
{
  "mode": "trending",
  "task": "",
  "author": "",
  "maxItems": 100,
  "includeModelCard": false
}
```

# Actor output Schema

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

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("resounding_diplomacy/huggingface-models-scraper").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("resounding_diplomacy/huggingface-models-scraper").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 '{}' |
apify call resounding_diplomacy/huggingface-models-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,resounding_diplomacy/huggingface-models-scraper"
        }
    }
}

```

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/xu5Y0FotPYtwL0ALO/builds/C89Cc9e9gilTf1L36/openapi.json
