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.
{
"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
}
}Sample data
What one call returns
A recorded run of models-search: the fields and shapes you will get, shortened to 3 items.
| # | idstring | authorstring | taskstring | librarystring | downloadsinteger | likesinteger | tagsstring[] | created_atstring | urlurl |
|---|---|---|---|---|---|---|---|---|---|
| 1 | meta-llama/Llama-3.1-8B-Instruct | meta-llama | text-generation | transformers | 3761846 | 9241 | [3 items] | 2024-07-18T08:56:00.000Z | https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct |
| 2 | meta-llama/Llama-3.2-1B-Instruct | meta-llama | text-generation | transformers | 1375502 | 2060 | [3 items] | 2024-09-18T15:12:47.000Z | https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct |
| 3 | meta-llama/Llama-3.2-1B | meta-llama | text-generation | transformers | 784116 | 2835 | [3 items] | 2024-09-18T15:03:14.000Z | https://huggingface.co/meta-llama/Llama-3.2-1B |
[
{
"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"
}
]id,author,task,library,downloads,likes,tags,created_at,url meta-llama/Llama-3.1-8B-Instruct,meta-llama,text-generation,transformers,3761846,9241,"[""transformers"",""safetensors"",""llama""]",2024-07-18T08:56:00.000Z,https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct meta-llama/Llama-3.2-1B-Instruct,meta-llama,text-generation,transformers,1375502,2060,"[""transformers"",""safetensors"",""llama""]",2024-09-18T15:12:47.000Z,https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct meta-llama/Llama-3.2-1B,meta-llama,text-generation,transformers,784116,2835,"[""transformers"",""safetensors"",""llama""]",2024-09-18T15:03:14.000Z,https://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
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.
| Endpoint | Required parameters | Returns | Cost |
|---|---|---|---|
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-searchtakes an optionalquery, withauthor,task(for example text-generation),library(for example transformers, diffusers or gguf),sort(downloads, likes, trending, last_modified or created) andlimit(1 to 100).modeltakes anid. - Datasets:
datasets-searchtakes an optionalquery, withauthor,sortandlimit.datasettakes anid. - Spaces:
spaces-searchtakes an optionalquery, withauthor,sort(likes, trending, last_modified or created) andlimit.
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.
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 likesCompare parameter counts, licences and architectures before picking a model
Use the Hugging Face API to compare parameter counts, licences and architectures before picking a modelTrace 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 categoryFAQ
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.