# Tendances Hugging Face Hub (models, datasets, spaces) (`rosmax/hf-hub-trends`) Actor

Collecte les modèles, datasets et spaces en tendance depuis Hugging Face Hub. Détecte les deltas de téléchargements, likes, changements de rang. Respect des rate limits (500 req/5 min). Alertes pour les nouveaux repos d'orgs suivies.

- **URL**: https://apify.com/rosmax/hf-hub-trends.md
- **Developed by:** [Maxime Rosito](https://apify.com/rosmax) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 enregistrements

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

## Tendances Hugging Face Hub

### Description

Collecte les modèles, datasets et spaces en tendance depuis Hugging Face Hub. Détecte les deltas de téléchargements, likes, changements de score de tendance. Supporte les alertes pour les nouveaux repos d'organisations surveillées.

**Source** : API HuggingFace `https://huggingface.co/api/{models|datasets|spaces}`

### Respect des rate limits

HuggingFace impose une limite de **500 requêtes par 5 minutes** par IP.

L'acteur respecte automatiquement ces limites en:

- Lisant les en-têtes `ratelimit` de chaque réponse
- Ralentissant quand il reste < 10 requêtes
- Implémentant un backoff exponentiel sur les 429
- Limitant à 1 requête par 100ms minimum

### Différenciation : historique et détection des changements

- **Deltas calculés** : `downloads_delta`, `likes_delta`, `downloads_velocity_per_day`
- **Détection de changements** : nouveaux repos, sorties du trending, augmentations de downloads/likes
- **Alertes watchedOrgs** : notification quand une org suivie publie un nouveau repo ou entre dans le top

### Exemples

#### Input (mode snapshot)

```json
{
  "mode": "snapshot",
  "repoTypes": ["models", "datasets"],
  "limit": 30,
  "watchedOrgs": ["meta-llama", "mistralai"],
  "maxItems": 100,
  "historyStoreName": "hf-hub-trends-history"
}
```

#### Output (snapshot)

```json
{
  "record_type": "snapshot",
  "source": "huggingface",
  "observed_at": "2026-09-25T06:00:00.000Z",
  "repo_key": "models:meta-llama/Llama-3.3-70B-Instruct",
  "repo_type": "models",
  "repo_id": "meta-llama/Llama-3.3-70B-Instruct",
  "author": "meta-llama",
  "name": "Llama-3.3-70B-Instruct",
  "downloads": 1250000,
  "likes": 4532,
  "trendingScore": 245.8,
  "pipeline_tag": "text-generation",
  "library_name": "transformers",
  "source_url": "https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct"
}
```

#### Output (change détecté)

```json
{
  "record_type": "change",
  "source": "huggingface",
  "observed_at": "2026-09-25T12:00:00.000Z",
  "previous_observed_at": "2026-09-25T06:00:00.000Z",
  "change_type": "downloads_increase,likes_increase",
  "diff_type": "changed",
  "repo_id": "meta-llama/Llama-3.3-70B-Instruct",
  "downloads": 1275000,
  "likes": 4590,
  "downloads_delta": 25000,
  "likes_delta": 58,
  "downloads_velocity_per_day": 100000,
  "hours_since_last": 6,
  "changes": [
    {
      "field": "downloads",
      "old": 1250000,
      "new": 1275000,
      "delta_abs": 25000
    },
    {
      "field": "likes",
      "old": 4532,
      "new": 4590,
      "delta_abs": 58
    }
  ]
}
```

### Planification quotidienne

Pour suivre les tendances quotidiennement :

```
Schedules → Add schedule
- Time: 10:00 UTC
- Run input: {"mode":"changes","repoTypes":["models"],"limit":30,"maxItems":100}
```

Le mode `changes` détecte les nouveaux repos dans le top et les variations de métriques (downloads, likes, trending score).

### Sources et licences

- **Hugging Face Hub API** : https://huggingface.co/docs/hub/api
- **Rate limits** : 500 req / 5 min par IP (respecté automatiquement avec backoff)
- **Accès** : sans clé API

### Tarification pay-per-event suggérée

- **Événement `record`** : 0,0001 $ par enregistrement
- **Événement `change-detected`** : 0,001 $ par changement détecté

### Limites

- **Rate limits** : L'acteur respecte la limite de 500 req/5 min. Pour collecter beaucoup de repos (ex: 100 de chaque type), il peut prendre quelques minutes.
- **Trending uniquement** : Ne collecte que les repos en tendance, pas tous les repos HF.
- **Pas de pagination** : Limite max de 100 repos par type (limite API HF).

# Actor input Schema

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

snapshot = tous les repos en tendance ; changes = uniquement les deltas

## `repoTypes` (type: `array`):

Types à collecter

## `limit` (type: `integer`):

Limite de repos à récupérer par type (max recommandé: 100)

## `watchedOrgs` (type: `array`):

Liste d'organisations pour alertes (nouveaux repos, entrée dans le top)

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

Filtrer uniquement les repos d'un auteur spécifique (vide = tous)

## `pipelineTag` (type: `string`):

Filtrer les modèles par pipeline\_tag (ex: text-generation, image-classification)

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

Filtrer les modèles par library (ex: transformers, diffusers, sentence-transformers)

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

Limite stricte du nombre d'enregistrements à produire

## `historyStoreName` (type: `string`):

Nom du store pour conserver l'historique entre runs

## `emitBaselineOnFirstRun` (type: `boolean`):

Au premier run en mode changes, émettre tous les items marqués is\_baseline=true

## `snapshotRetention` (type: `integer`):

Nombre de relevés datés à garder dans l'historique (0 = désactivé)

## `webhookUrl` (type: `string`):

URL optionnelle pour recevoir un POST JSON avec le résumé des changements

## Actor input object example

```json
{
  "mode": "snapshot",
  "repoTypes": [
    "models"
  ],
  "limit": 30,
  "watchedOrgs": [],
  "author": "",
  "pipelineTag": "",
  "library": "",
  "maxItems": 1000,
  "historyStoreName": "hf-hub-trends-history",
  "emitBaselineOnFirstRun": true,
  "snapshotRetention": 7,
  "webhookUrl": ""
}
```

# Actor output Schema

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

Lien vers les items du dataset (repos tendance et leurs changements)

# 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("rosmax/hf-hub-trends").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("rosmax/hf-hub-trends").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 rosmax/hf-hub-trends --silent --output-dataset

```

## MCP server setup

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

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/MJEab15xcQ8vqJa2K/builds/WmCZbiz0lCUKt7qgL/openapi.json
