# Hugging Face API
> The Hugging Face Hub as an API — the central, open registry of machine-learning models and datasets that powers much of the modern AI ecosystem. This API wraps the public huggingface.co Hub into clean JSON. /v1/models searches the Hub's models and lets you filter by task (pipeline_tag — e.g. text-generation, text-to-image, image-classification, automatic-speech-recognition, sentence-similarity) and by library (transformers, diffusers, sentence-transformers, …), sorted by downloads, likes, last-modified, created or trending score — each model returned with its id, author, task, library, download and like counts, license, tags and timestamps. /v1/model?id=google-bert/bert-base-uncased returns a single model's full metadata. /v1/datasets searches ML datasets the same way, and /v1/dataset?id=ILSVRC/imagenet-1k returns a single dataset's metadata. Ids are in org/name form (take them from the search endpoints). Ideal for ML and MLOps tooling, model-discovery and comparison sites, AI leaderboards and dashboards, and AI assistants that recommend models. Data comes from the public Hugging Face Hub (free to use). This is the AI/ML model and dataset hub — distinct from software-package registries (npm, PyPI, Maven, NuGet) and academic paper indexes (arXiv).

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/huggingface-api/..."
```

## Pricing
- **Free** (Free) — 2,800 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 55,000 calls/Mo, 5 req/s
- **Pro** ($23/Mo) — 240,000 calls/Mo, 12 req/s
- **Mega** ($63/Mo) — 880,000 calls/Mo, 35 req/s

## Endpoints

### Models

#### `GET /v1/model` — A model metadata

**Parameters:**
- `id` (query, required, string) — Model id (org/name), e.g. google-bert/bert-base-uncased Example: `google-bert/bert-base-uncased`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/huggingface-api/v1/model?id=google-bert%2Fbert-base-uncased"
```

**Response:**
```json
{
    "data": {
        "model": {
            "id": "google-bert/bert-base-uncased",
            "url": "https://huggingface.co/google-bert/bert-base-uncased",
            "tags": [
                "transformers",
                "pytorch",
                "tf",
                "jax",
                "rust",
                "coreml",
                "onnx",
                "safetensors",
                "bert",
                "fill-mask",
                "exbert",
                "en"
            ],
            "gated": false,
            "likes": 2670,
            "author": "google-bert",
            "created": "2022-03-02T23:29:04.000Z",
            "library": "transformers",
            "license": "apache-2.0",
            "private": false,
            "downloads": 68246210,
            "pipeline_tag": "fill-mask",
            "last_modified": "2024-02-19T11:06:12.000Z"
        }
    },
    "meta": {
        "timestamp": "2026-06-01T16:23:34.249Z",
        "request_id": "faa324f1-f936-4105-87e1-8f6e1c58ea0f"
    },
    "status": "ok",
    "message": "Model retrieved",
    "success": true
}
```

#### `GET /v1/models` — Search ML models

**Parameters:**
- `search` (query, optional, string) — Search text, e.g. bert Example: `bert`
- `pipeline_tag` (query, optional, string) — Task, e.g. text-generation
- `library` (query, optional, string) — Library, e.g. transformers
- `sort` (query, optional, string) — downloads, likes, lastModified, trendingScore
- `limit` (query, optional, string) — Max results (1-100)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/huggingface-api/v1/models?search=bert"
```

**Response:**
```json
{
    "data": {
        "count": 20,
        "models": [
            {
                "id": "google-bert/bert-base-uncased",
                "url": "https://huggingface.co/google-bert/bert-base-uncased",
                "tags": [
                    "transformers",
                    "pytorch",
                    "tf",
                    "jax",
                    "rust",
                    "coreml",
                    "onnx",
                    "safetensors",
                    "bert",
                    "fill-mask",
                    "exbert",
                    "en"
                ],
                "likes": 2670,
                "author": "google-bert",
                "created": "2022-03-02T23:29:04.000Z",
                "library": "transformers",
                "license": "apache-2.0",
                "downloads": 68246210,
                "pipeline_tag": "fill-mask",
                "last_modified": null
            },
            {
                "id": "google-bert/bert-large-uncased",
                "url": "https://huggingface.co/google-bert/bert-large-uncased",
                "tags": [
                    "transformers",
                    "pytorch",
                    "tf",
                    "jax",
                    "rust",
                    "safetensors",
                    "bert",
                    "fill-mask",
                    "en",
                    "endpoints_compatible"
                ],
                "likes": 146,
       
…(truncated, see openapi.json for full schema)
```

### Datasets

#### `GET /v1/dataset` — A dataset metadata

**Parameters:**
- `id` (query, required, string) — Dataset id (org/name), e.g. ILSVRC/imagenet-1k Example: `ILSVRC/imagenet-1k`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/huggingface-api/v1/dataset?id=ILSVRC%2Fimagenet-1k"
```

**Response:**
```json
{
    "data": {
        "dataset": {
            "id": "ILSVRC/imagenet-1k",
            "url": "https://huggingface.co/datasets/ILSVRC/imagenet-1k",
            "tags": [],
            "gated": "auto",
            "likes": 819,
            "author": "ILSVRC",
            "license": "other",
            "downloads": 76389,
            "last_modified": "2025-09-17T04:58:55.000Z"
        }
    },
    "meta": {
        "timestamp": "2026-06-01T16:23:34.676Z",
        "request_id": "1609cd19-aea4-4e4a-8564-178a1d662e95"
    },
    "status": "ok",
    "message": "Dataset retrieved",
    "success": true
}
```

#### `GET /v1/datasets` — Search datasets

**Parameters:**
- `search` (query, optional, string) — Search text, e.g. imagenet Example: `imagenet`
- `sort` (query, optional, string) — downloads, likes, lastModified
- `limit` (query, optional, string) — Max results (1-100)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/huggingface-api/v1/datasets?search=imagenet"
```

**Response:**
```json
{
    "data": {
        "count": 20,
        "search": "imagenet",
        "datasets": [
            {
                "id": "ILSVRC/imagenet-1k",
                "url": "https://huggingface.co/datasets/ILSVRC/imagenet-1k",
                "tags": [],
                "likes": 819,
                "author": "ILSVRC",
                "license": "other",
                "downloads": 76389,
                "last_modified": "2025-09-17T04:58:55.000Z"
            },
            {
                "id": "ShaomuTan/imagenette",
                "url": "https://huggingface.co/datasets/ShaomuTan/imagenette",
                "tags": [],
                "likes": 0,
                "author": "ShaomuTan",
                "license": "apache-2.0",
                "downloads": 25867,
                "last_modified": "2026-04-03T12:56:42.000Z"
            },
            {
                "id": "zh-plus/tiny-imagenet",
                "url": "https://huggingface.co/datasets/zh-plus/tiny-imagenet",
                "tags": [],
                "likes": 98,
                "author": "zh-plus",
                "license": null,
                "downloads": 25097,
                "last_modified": "2022-07-12T09:04:30.000Z"
            },
            {
                "id": "ilee0022/ImageNet100",
                "url": "https://huggingface.co/datasets/ilee0022/ImageNet100",
                "tags": [],
                "likes": 6,
                "author": "ilee0022",
                "license": null,
    
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Usage notes

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/huggingface-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "The Hugging Face Hub is the central registry of open AI/ML models and datasets. /v1/models = search models, filter by pipeline_tag (the task, e.g. text-generation, image-classification, text-to-image, automatic-speech-recognition) and by library (transformers, diffusers, …), sorted by downloads, likes, lastModified or trendingScore — each result with its id, author, task, library, download and like counts, license, tags and timestamps; /v1/model?id=google-bert/bert-base-uncased = a single model's metadata; /v1/datasets = search datasets the same way; /v1/dataset?id=ILSVRC/imagenet-1k = a single dataset's metadata. Ids are org/name (use them from /v1/models or /v1/datasets). Data from the public Hugging Face Hub (free). Distinct from software-package registries (npm, PyPI, Maven, …) and academic paper indexes (arXiv) — this is the AI/ML model & dataset hub. Ideal for ML tooling, model-discovery and leaderboard sites, MLOps dashboards and AI assistants.",
        "source": "Hugging Face Hub API (huggingface.co/api)",
        "endpoints": [
            "/v1/models",
            "/v1/model",
            "/v1/datasets",
            "/v1/dataset",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-01T16:23:34.971Z",
        "request_id": "0de45785-3b98-45f1-a099-4f91822c2231"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/huggingface-api
OpenAPI spec: https://www.oanor.com/api/huggingface-api/openapi.json
