APIs / Hugging Face / Search models

Hugging Face: Search models

Models on the Hugging Face Hub matching a query, with downloads, likes, task and library.

GET /v1/huggingface/models-search

Parameters

Send parameters in the query string.

ParameterTypeRequiredAllowed values
querystringOptionalUp to 200 characters
Words to match in the model id.
authorstringOptionalUp to 100 characters
Only models from this user or organisation, for example meta-llama.
taskstringOptionalUp to 60 characters
Pipeline task, for example text-generation or image-classification.
librarystringOptionalUp to 60 characters
Library, for example transformers, diffusers or gguf.
sortstringOptionaldownloads, likes, trending, last_modified, created
Sort order, highest first. Default downloads.
limitintegerOptionalAny
Results to return, 1 to 100. Default 20.

Example request

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.

Run this endpoint in the playground with your own parameters. 1 credit per successful call; failed calls are free.

Response fields

Each item in data.items has these 9 fields, read from a recorded call. The recording leaves out fields that were empty, so a live call can return more.

FieldType
idstring
authorstring
taskstring
librarystring
downloadsinteger
likesinteger
tagsstring[]
created_atstring
urlurl