# AI Hub Change Events (`immense_insulator/ai-hub-change-events`) Actor

Monitor Hugging Face models and datasets for structured license, access, revision, metadata, and adoption-trend change events.

- **URL**: https://apify.com/immense\_insulator/ai-hub-change-events.md
- **Developed by:** [xinyao a](https://apify.com/immense_insulator) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 ai hub change events

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

## AI Hub Change Events

Stateful Hugging Face monitoring that emits **changes, not copied catalog rows**. Schedule it hourly or daily to turn public model and dataset metadata into a compact event feed for MLOps, AI governance, scouting, and automation.

### Why pay for this instead of calling the Hub API?

The public API returns snapshots. This Actor keeps the baseline, compares runs, suppresses duplicates, classifies governance changes, calculates metric deltas and per-day velocity, and produces webhook-ready events with stable IDs and severity. No GPU and no LLM calls are used, so behavior and cost are deterministic.

### Events

- `REPOSITORY_DISCOVERED` — a rolling query starts matching a new model or dataset.
- `LICENSE_CHANGED` — license added, removed, or changed; restrictive/unknown targets are critical.
- `ACCESS_CHANGED` — gated or private status changed.
- `REVISION_CHANGED` — repository SHA changed.
- `METADATA_CHANGED` — pipeline task or library changed.
- `DOWNLOAD_TREND` — thresholded download movement, including delta, percent, and per-day velocity.
- `LIKE_TREND` — thresholded like movement.

The first default run creates a silent baseline. Later runs emit only transitions. Set `bootstrapMode` to `emit-discovered` when initial discovery events are desired.

### Example input

```json
{
  "resources": [
    {"type": "model", "id": "Qwen/Qwen2.5-0.5B-Instruct"},
    {"type": "dataset", "id": "HuggingFaceH4/ultrachat_200k"}
  ],
  "discoveryQueries": [
    {"type": "model", "search": "function calling", "sort": "lastModified", "limit": 25}
  ],
  "minDownloadDelta": 1000,
  "minDownloadGrowthPercent": 10,
  "minLikeDelta": 10,
  "maxItems": 100
}
````

### Example event

```json
{
  "eventId": "f6df8f9b06d736049752",
  "eventType": "LICENSE_CHANGED",
  "severity": "critical",
  "source": "huggingface_hub",
  "resourceType": "model",
  "resourceId": "org/model",
  "summary": "License changed from apache-2.0 to other",
  "changes": {"license": {"from": "apache-2.0", "to": "other"}},
  "current": {"license": "other", "gated": false, "sha": "..."}
}
```

### Scheduling and state

Use an Apify schedule with the same default key-value store. State lives under `AI_HUB_CHANGE_STATE`; choose a separate `stateKey` for each logically independent monitor. Dataset output contains events only. The `OUTPUT` key contains the run summary.

State is updated only after event delivery succeeds. A stable `eventId` hashes the transition itself, making downstream deduplication straightforward.

### Limits and responsible use

- Public Hugging Face Hub data only; no model weights, private repositories, or personal-data enrichment.
- Optional token only raises Hub API limits; it does not enable private-repository monitoring.
- Download counts are Hub-provided rolling metrics, not lifetime counters. Decreases are emitted as trend changes rather than treated as errors.
- License classification is a monitoring signal, not legal advice.
- Maximum 500 unique repositories per run.

### Local development

```bash
python -m venv .venv
. .venv/bin/activate
pip install -r requirements-dev.txt
pytest -q
```

Run locally with Apify storage:

```bash
mkdir -p storage/key_value_stores/default
printf '%s' '{"resources":[{"type":"model","id":"Qwen/Qwen2.5-0.5B-Instruct"}],"bootstrapMode":"emit-discovered"}' > storage/key_value_stores/default/INPUT.json
APIFY_LOCAL_STORAGE_DIR=./storage python -m src.main
```

### Suggested Store pricing

Pay per emitted event: **$3 / 1,000 events** plus **$0.005 per Actor start**, platform usage included. Baseline rows and unchanged checks should not be billable. This aligns payment with the product's value: actionable changes, not API rows fetched.

# Actor input Schema

## `resources` (type: `array`):

Exact public Hub repositories to monitor.

## `discoveryQueries` (type: `array`):

Optional rolling searches. New matching repositories become REPOSITORY\_DISCOVERED events after the baseline run.

## `bootstrapMode` (type: `string`):

Choose whether the first run silently stores a baseline or emits discovery events.

## `eventTypes` (type: `array`):

Empty means all event types.

## `minDownloadDelta` (type: `integer`):

Emit a download trend event only when the absolute download increase reaches this threshold.

## `minDownloadGrowthPercent` (type: `number`):

Emit a download trend event only when percentage growth reaches this threshold.

## `minLikeDelta` (type: `integer`):

Emit a like trend event only when the like increase reaches this threshold.

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

Maximum number of model and dataset repositories checked in one run.

## `stateKey` (type: `string`):

Use a distinct key for each independent monitor.

## `huggingFaceToken` (type: `string`):

Optional for higher API limits. Stored as a secret input.

## Actor input object example

```json
{
  "resources": [
    {
      "type": "model",
      "id": "Qwen/Qwen2.5-0.5B-Instruct"
    }
  ],
  "discoveryQueries": [],
  "bootstrapMode": "snapshot",
  "eventTypes": [],
  "minDownloadDelta": 1000,
  "minDownloadGrowthPercent": 10,
  "minLikeDelta": 10,
  "maxItems": 100,
  "stateKey": "AI_HUB_CHANGE_STATE"
}
```

# 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("immense_insulator/ai-hub-change-events").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("immense_insulator/ai-hub-change-events").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 immense_insulator/ai-hub-change-events --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=immense_insulator/ai-hub-change-events",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Hub Change Events",
        "description": "Monitor Hugging Face models and datasets for structured license, access, revision, metadata, and adoption-trend change events.",
        "version": "0.1",
        "x-build-id": "PjtvBe6nejGWZmLwG"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/immense_insulator~ai-hub-change-events/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-immense_insulator-ai-hub-change-events",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/immense_insulator~ai-hub-change-events/runs": {
            "post": {
                "operationId": "runs-sync-immense_insulator-ai-hub-change-events",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/immense_insulator~ai-hub-change-events/run-sync": {
            "post": {
                "operationId": "run-sync-immense_insulator-ai-hub-change-events",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "resources": {
                        "title": "Model and dataset watchlist",
                        "type": "array",
                        "description": "Exact public Hub repositories to monitor.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "title": "Resource type",
                                    "description": "Choose a Hugging Face model or dataset repository.",
                                    "type": "string",
                                    "enum": [
                                        "model",
                                        "dataset"
                                    ]
                                },
                                "id": {
                                    "title": "Repository ID",
                                    "description": "Exact repository ID, for example Qwen/Qwen2.5-0.5B-Instruct.",
                                    "type": "string"
                                }
                            },
                            "required": [
                                "type",
                                "id"
                            ]
                        },
                        "default": [
                            {
                                "type": "model",
                                "id": "Qwen/Qwen2.5-0.5B-Instruct"
                            }
                        ]
                    },
                    "discoveryQueries": {
                        "title": "Discovery queries",
                        "type": "array",
                        "description": "Optional rolling searches. New matching repositories become REPOSITORY_DISCOVERED events after the baseline run.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "title": "Resource type",
                                    "description": "Search models or datasets.",
                                    "type": "string",
                                    "enum": [
                                        "model",
                                        "dataset"
                                    ]
                                },
                                "search": {
                                    "title": "Search text",
                                    "description": "Optional Hugging Face Hub search text.",
                                    "type": "string"
                                },
                                "author": {
                                    "title": "Author",
                                    "description": "Optional exact author or organization filter.",
                                    "type": "string"
                                },
                                "filter": {
                                    "title": "Hub filter",
                                    "description": "Optional Hugging Face task, library, or tag filter.",
                                    "type": "string"
                                },
                                "sort": {
                                    "title": "Sort order",
                                    "description": "Choose how discovery results are ordered.",
                                    "type": "string",
                                    "enum": [
                                        "lastModified",
                                        "downloads",
                                        "likes",
                                        "trendingScore"
                                    ]
                                },
                                "limit": {
                                    "title": "Result limit",
                                    "description": "Maximum repositories discovered by this query.",
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                }
                            },
                            "required": [
                                "type"
                            ]
                        },
                        "default": []
                    },
                    "bootstrapMode": {
                        "title": "First-run behavior",
                        "enum": [
                            "snapshot",
                            "emit-discovered"
                        ],
                        "type": "string",
                        "description": "Choose whether the first run silently stores a baseline or emits discovery events.",
                        "default": "snapshot"
                    },
                    "eventTypes": {
                        "title": "Event type filter",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Empty means all event types.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "REPOSITORY_DISCOVERED",
                                "LICENSE_CHANGED",
                                "ACCESS_CHANGED",
                                "REVISION_CHANGED",
                                "METADATA_CHANGED",
                                "DOWNLOAD_TREND",
                                "LIKE_TREND"
                            ]
                        },
                        "default": []
                    },
                    "minDownloadDelta": {
                        "title": "Minimum download delta",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Emit a download trend event only when the absolute download increase reaches this threshold.",
                        "default": 1000
                    },
                    "minDownloadGrowthPercent": {
                        "title": "Minimum download growth (%)",
                        "minimum": 0,
                        "type": "number",
                        "description": "Emit a download trend event only when percentage growth reaches this threshold.",
                        "default": 10
                    },
                    "minLikeDelta": {
                        "title": "Minimum like delta",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Emit a like trend event only when the like increase reaches this threshold.",
                        "default": 10
                    },
                    "maxItems": {
                        "title": "Maximum resources per run",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of model and dataset repositories checked in one run.",
                        "default": 100
                    },
                    "stateKey": {
                        "title": "State key",
                        "type": "string",
                        "description": "Use a distinct key for each independent monitor.",
                        "default": "AI_HUB_CHANGE_STATE"
                    },
                    "huggingFaceToken": {
                        "title": "Optional Hugging Face token",
                        "type": "string",
                        "description": "Optional for higher API limits. Stored as a secret input."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
