APIs / Apps and media / Hugging Face

1 credit per call5 endpoints9 datapointsChecked working 6 Dec 2026

Hugging Face API

Hugging Face API for model, dataset and Space search, and model and dataset details with downloads and licences as JSON. 1 credit per successful call.

Hugging Face
GET/v1/huggingface/models-search?query=llama&sort=downloads&limit=10
{
  "success": true,
  "data": {
    "count": 10,
    "items": [
      {
        "id": "meta-llama/Llama-3.1-8B-Instruct",
        "author": "meta-llama",
        "task": "text-generation",
        "library": "transformers",
        "downloads": 3761846,
        "likes": 9241,
        "tags": [
          "transformers",
          "safetensors",
          "llama"
        ],
        "created_at": "2024-07-18T08:56:00.000Z",
        "url": "https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct"
      },
      {
        "id": "meta-llama/Llama-3.2-1B-Instruct",
        "author": "meta-llama",
        "task": "text-generation",
        "library": "transformers",
        "downloads": 1375502,
        "likes": 2060,
        "tags": [
          "transformers",
          "safetensors",
          "llama"
        ],
        "created_at": "2024-09-18T15:12:47.000Z",
        "url": "https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct"
      },
      {
        "id": "meta-llama/Llama-3.2-1B",
        "author": "meta-llama",
        "task": "text-generation",
        "library": "transformers",
        "downloads": 784116,
        "likes": 2835,
        "tags": [
          "transformers",
          "safetensors",
          "llama"
        ],
        "created_at": "2024-09-18T15:03:14.000Z",
        "url": "https://huggingface.co/meta-llama/Llama-3.2-1B"
      }
    ]
  },
  "meta": {
    "request_id": "req_5705d2131b524107ae8a3a3398ddab8d",
    "credits_charged": 1,
    "credits_remaining": 1999
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Sample data

What one call returns

A recorded run of models-search: the fields and shapes you will get, shortened to 3 items.

#idstringauthorstringtaskstringlibrarystringdownloadsintegerlikesintegertagsstring[]created_atstringurlurl
1meta-llama/Llama-3.1-8B-Instructmeta-llamatext-generationtransformers37618469241[3 items]2024-07-18T08:56:00.000Zhttps://huggingface.co/meta-llama/Llama-3.1-8B-Instruct
2meta-llama/Llama-3.2-1B-Instructmeta-llamatext-generationtransformers13755022060[3 items]2024-09-18T15:12:47.000Zhttps://huggingface.co/meta-llama/Llama-3.2-1B-Instruct
3meta-llama/Llama-3.2-1Bmeta-llamatext-generationtransformers7841162835[3 items]2024-09-18T15:03:14.000Zhttps://huggingface.co/meta-llama/Llama-3.2-1B

Recorded from our API · 3 items shown · 9 datapoints per itemGET /v1/huggingface/models-search?query=llama&sort=downloads&limit=10

9 datapoints

Identity

  • idstring

Contact

  • urlurl

Other

  • authorstring
  • taskstring
  • librarystring
  • downloadsinteger
  • likesinteger
  • tagsstring[]
  • created_atstring

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/huggingface/models-search?query=llama&sort=downloads&limit=10" \
  -H "X-API-Key: $API_KEY"

Hugging Face · 5 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

EndpointRequired parametersReturnsCost
GET/v1/huggingface/dataset
id
idauthordescriptiondownloadslikesgated+13 more
1 credit
GET/v1/huggingface/datasets-search
none+4 optional
idauthordescriptiondownloadslikesgated+4 more
1 credit
GET/v1/huggingface/model
id
idauthortasklibrarydownloadslikes+18 more
1 credit
GET/v1/huggingface/models-search
none+6 optional
idauthortasklibrarydownloadslikes+3 more
1 credit
GET/v1/huggingface/spaces-search
none+4 optional
idauthorsdklikestagscreated_at+1 more
1 credit

Overview

About the Hugging Face API

What you can get

The Hugging Face API returns Hugging Face Hub data on models, datasets and Spaces as JSON through 5 endpoints. Ids take the form owner/name.

  • Models: models-search takes an optional query, with author, task (for example text-generation), library (for example transformers, diffusers or gguf), sort (downloads, likes, trending, last_modified or created) and limit (1 to 100). model takes an id.
  • Datasets: datasets-search takes an optional query, with author, sort and limit. dataset takes an id.
  • Spaces: spaces-search takes an optional query, with author, sort (likes, trending, last_modified or created) and limit.

The recorded models-search for "llama" sorted by downloads returns items, each with id, author, task, library, downloads, likes, tags, created_at and url. The first result, meta-llama/Llama-3.1-8B-Instruct, had 3,761,846 downloads and 9,241 likes. model adds license, gated, languages, base_models, parameters (8,030,261,248 for that model), parameters_by_dtype, architectures, model_type, storage_bytes, file_count, files and the Spaces that use it (spaces_count and spaces).

How a call works

Search, then look up: GET /v1/huggingface/models-search?query=llama&sort=downloads&limit=10 with your key in the X-API-Key header returns each model's id; model takes that id, for example GET /v1/huggingface/model?id=meta-llama/Llama-3.1-8B-Instruct. Dataset ids from datasets-search go to dataset the same way. Searches have no page parameter: raise limit to 100 and narrow with author, task or library. Answers come from a cache for up to an hour, so downloads and likes can be up to an hour old. Every successful call costs 1 credit; failed calls cost nothing.

Apps and mediaJSONRESTMCP

More apps and media APIs

Use cases

Shortlist open models for a task and library, ranked by downloads or likes

Use the Hugging Face API to shortlist open models for a task and library, ranked by downloads or likes

Compare parameter counts, licences and architectures before picking a model

Use the Hugging Face API to compare parameter counts, licences and architectures before picking a model

Trace a fine-tune to its base model with `base_models`

Use the Hugging Face API to trace a fine-tune to its base model with `base_models`

Find training and evaluation datasets by name, with licence, languages and size category

Use the Hugging Face API to find training and evaluation datasets by name, with licence, languages and size category

FAQ

Questions

How much does the Hugging Face API cost?

Each successful call costs one credit, and each search is one call. New accounts get free credits to start, and credit packs bring the price down as you scale.

Do gated models return their details?

Yes. Gated models still return their metadata, with `gated` showing the access mode: `manual` for `meta-llama/Llama-3.1-8B-Instruct` in the recording. You get the model's details and file list, not the model weights.

What does `dataset` return?

The dataset card's opening text as `description`, plus `pretty_name`, `license`, `task_categories`, `languages`, `size_categories`, `downloads`, `likes`, `storage_bytes` and `files`. In the recording, `rajpurkar/squad` had 169,573 downloads, licence `cc-by-sa-4.0` and size category `10K<n<100K`.

Do I need a Hugging Face account?

No. You call this Hugging Face API with your Perceptlayer key in the `X-API-Key` header, with no Hugging Face login or token.

Is this the official Hugging Face API?

No. Perceptlayer is an independent service and is not affiliated with Hugging Face. It returns Hugging Face data as JSON with a Perceptlayer key, so there is no Hugging Face developer account, app review or partner approval to get first. It only reads data: if Hugging Face has an official API and you need to act on your own Hugging Face account, such as posting, managing orders or reading private data, use that one.

Should I build a Hugging Face scraper instead?

You can, but a Hugging Face scraper is code you maintain: page changes break it, requests get blocked, and Hugging Face's terms govern how you collect data. The Hugging Face API gives you 5 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

Try the Hugging Face API with 100 free credits

No credit card. Failed calls are never billed.