---
title: "Hugging Face API: Search models | Perceptlayer"
description: "Models on the Hugging Face Hub matching a query, with downloads, likes, task and library."
url: https://perceptlayer.com/apis/huggingface/models-search
---

[APIs](https://perceptlayer.com/apis) / [Hugging Face](https://perceptlayer.com/apis/huggingface) / 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.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `query` | string | Optional | Up to 200 characters Words to match in the model id. |
| `author` | string | Optional | Up to 100 characters Only models from this user or organisation, for example meta-llama. |
| `task` | string | Optional | Up to 60 characters Pipeline task, for example text-generation or image-classification. |
| `library` | string | Optional | Up to 60 characters Library, for example transformers, diffusers or gguf. |
| `sort` | string | Optional | downloads, likes, trending, last\_modified, created Sort order, highest first. Default downloads. |
| `limit` | integer | Optional | Any 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 OK JSON X-Credits-Used: 1

Recorded from our API and shortened.

[Run this endpoint in the playground](https://perceptlayer.com/apis/huggingface?try=models-search#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.

| Field | Type |
| --- | --- |
| `id` | string |
| `author` | string |
| `task` | string |
| `library` | string |
| `downloads` | integer |
| `likes` | integer |
| `tags` | string\[\] |
| `created_at` | string |
| `url` | url |
