Hugging Face Models API

Operations for managing and querying models on the Hub

Documentation

Specifications

SDKs

Other Resources

OpenAPI Specification

hugging-face-models-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Hugging Face Dataset Viewer Audio Models API
  description: Query and visualize datasets stored on the Hugging Face Hub through a lightweight REST API. Get dataset splits, preview rows, search and filter data, access Parquet files, retrieve size statistics, and obtain Croissant metadata - all without downloading the entire dataset.
  version: 1.0.0
  termsOfService: https://huggingface.co/terms-of-service
  contact:
    name: Hugging Face Support
    url: https://huggingface.co/support
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://datasets-server.huggingface.co
  description: Hugging Face Dataset Viewer production server
security:
- {}
- bearerAuth: []
tags:
- name: Models
  description: Operations for managing and querying models on the Hub
paths:
  /models:
    get:
      summary: List Models on the Hub
      description: List and search models hosted on the Hugging Face Hub. Supports filtering by author, task, library, tags, and full-text search.
      operationId: listModels
      tags:
      - Models
      security: []
      parameters:
      - name: search
        in: query
        description: Full-text search query to filter models
        schema:
          type: string
        example: example_value
      - name: author
        in: query
        description: Filter by model author or organization
        schema:
          type: string
        example: example_value
      - name: filter
        in: query
        description: Filter by tags (comma-separated)
        schema:
          type: string
        example: example_value
      - name: sort
        in: query
        description: Property to sort results by
        schema:
          type: string
          enum:
          - lastModified
          - downloads
          - likes
          - createdAt
        example: lastModified
      - name: direction
        in: query
        description: Sort direction
        schema:
          type: string
          enum:
          - '-1'
          - '1'
        example: '-1'
      - name: limit
        in: query
        description: Number of results to return (max 1000)
        schema:
          type: integer
          default: 30
          maximum: 1000
        example: 10
      - name: full
        in: query
        description: Whether to return full model information including card data
        schema:
          type: boolean
          default: false
        example: true
      - name: config
        in: query
        description: Whether to return the model config
        schema:
          type: boolean
          default: false
        example: true
      - name: pipeline_tag
        in: query
        description: Filter by pipeline task type
        schema:
          type: string
          enum:
          - text-generation
          - text-classification
          - token-classification
          - question-answering
          - summarization
          - translation
          - fill-mask
          - image-classification
          - object-detection
          - automatic-speech-recognition
          - text-to-image
          - feature-extraction
        example: text-generation
      - name: library
        in: query
        description: Filter by ML library
        schema:
          type: string
          enum:
          - transformers
          - pytorch
          - tensorflow
          - jax
          - diffusers
          - onnx
          - safetensors
        example: transformers
      responses:
        '200':
          description: List of models matching the query
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ModelSummary'
              examples:
                Listmodels200Example:
                  summary: Default listModels 200 response
                  x-microcks-default: true
                  value:
                  - _id: '500123'
                    id: abc123
                    modelId: '500123'
                    author: example_value
                    sha: example_value
                    lastModified: '2026-01-15T10:30:00Z'
                    private: true
                    disabled: true
                    gated: true
                    pipeline_tag: example_value
                    tags:
                    - example_value
                    downloads: 10
                    likes: 10
                    library_name: example_value
                    createdAt: '2026-01-15T10:30:00Z'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /models/{repo_id}:
    get:
      summary: Get Model Information
      description: Get detailed information about a specific model by its repository ID.
      operationId: getModel
      tags:
      - Models
      security: []
      parameters:
      - name: repo_id
        in: path
        required: true
        description: The model repository ID (e.g., bert-base-uncased or organization/model-name)
        schema:
          type: string
        example: bert-base-uncased
      responses:
        '200':
          description: Detailed model information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelInfo'
              examples:
                Getmodel200Example:
                  summary: Default getModel 200 response
                  x-microcks-default: true
                  value: {}
        '401':
          description: Unauthorized - token required for private models
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Getmodel401Example:
                  summary: Default getModel 401 response
                  x-microcks-default: true
                  value:
                    error: example_value
                    statusCode: 10
        '404':
          description: Model not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Getmodel404Example:
                  summary: Default getModel 404 response
                  x-microcks-default: true
                  value:
                    error: example_value
                    statusCode: 10
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /models/{repo_id}/revision/{revision}:
    get:
      summary: Get Model Information at a Specific Revision
      description: Get detailed information about a model at a specific Git revision (branch, tag, or commit SHA).
      operationId: getModelRevision
      tags:
      - Models
      parameters:
      - name: repo_id
        in: path
        required: true
        schema:
          type: string
        example: '500123'
      - name: revision
        in: path
        required: true
        description: Git revision (branch name, tag, or commit SHA)
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Model information at the specified revision
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelInfo'
              examples:
                Getmodelrevision200Example:
                  summary: Default getModelRevision 200 response
                  x-microcks-default: true
                  value: {}
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /metrics:
    get:
      summary: List Available Metrics
      description: Get the list of available evaluation metrics on the Hub.
      operationId: listMetrics
      tags:
      - Models
      security: []
      responses:
        '200':
          description: List of available metrics
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    description:
                      type: string
              examples:
                Listmetrics200Example:
                  summary: Default listMetrics 200 response
                  x-microcks-default: true
                  value:
                  - id: abc123
                    description: A sample description.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /models-tags-by-type:
    get:
      summary: List Model Tags Grouped by Type
      description: Get all available model tags organized by type (pipeline_tag, library, language, license, etc.).
      operationId: listModelTags
      tags:
      - Models
      security: []
      responses:
        '200':
          description: Tags grouped by type
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      label:
                        type: string
                      subType:
                        type: string
              examples:
                Listmodeltags200Example:
                  summary: Default listModelTags 200 response
                  x-microcks-default: true
                  value: {}
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/models:
    get:
      summary: List Available Models
      description: List models available through inference providers. Returns model IDs and basic metadata.
      operationId: listModels
      tags:
      - Models
      responses:
        '200':
          description: List of available models
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    const: list
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Model ID
                        object:
                          type: string
                          const: model
                        created:
                          type: integer
                          description: Unix timestamp of creation
                        owned_by:
                          type: string
                          description: Model owner
              examples:
                Listmodels200Example:
                  summary: Default listModels 200 response
                  x-microcks-default: true
                  value:
                    object: example_value
                    data:
                    - id: abc123
                      object: example_value
                      created: 10
                      owned_by: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/models/{model_id}:
    get:
      summary: Get Model Information
      description: Get information about a specific model available through inference providers.
      operationId: getModel
      tags:
      - Models
      parameters:
      - name: model_id
        in: path
        required: true
        description: The model ID
        schema:
          type: string
        example: meta-llama/Llama-3-70b-chat-hf
      responses:
        '200':
          description: Model information
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                    const: model
                  created:
                    type: integer
                  owned_by:
                    type: string
              examples:
                Getmodel200Example:
                  summary: Default getModel 200 response
                  x-microcks-default: true
                  value:
                    id: abc123
                    object: example_value
                    created: 10
                    owned_by: example_value
        '404':
          description: Model not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error_2'
              examples:
                Getmodel404Example:
                  summary: Default getModel 404 response
                  x-microcks-default: true
                  value:
                    error:
                      message: example_value
                      type: example_value
                      code: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    ModelSummary:
      type: object
      properties:
        _id:
          type: string
          description: Unique model identifier
          example: '500123'
        id:
          type: string
          description: Model repository ID (e.g., bert-base-uncased)
          example: abc123
        modelId:
          type: string
          description: Alias for id
          example: '500123'
        author:
          type: string
          description: Model author or organization
          example: example_value
        sha:
          type: string
          description: Latest commit SHA
          example: example_value
        lastModified:
          type: string
          format: date-time
          description: Last modification timestamp
          example: '2026-01-15T10:30:00Z'
        private:
          type: boolean
          description: Whether the model is private
          example: true
        disabled:
          type: boolean
          example: true
        gated:
          type: boolean
          description: Whether access is gated
          example: true
        pipeline_tag:
          type: string
          description: Pipeline task tag
          example: example_value
        tags:
          type: array
          items:
            type: string
          example: []
        downloads:
          type: integer
          description: Total download count
          example: 10
        likes:
          type: integer
          description: Total like count
          example: 10
        library_name:
          type: string
          description: Primary ML library
          example: example_value
        createdAt:
          type: string
          format: date-time
          example: '2026-01-15T10:30:00Z'
    Error_2:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message
            type:
              type: string
              description: Error type
            code:
              type: string
              description: Error code
          example: example_value
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: example_value
        statusCode:
          type: integer
          description: HTTP status code
          example: 10
    ModelInfo:
      allOf:
      - $ref: '#/components/schemas/ModelSummary'
      - type: object
        properties:
          siblings:
            type: array
            items:
              type: object
              properties:
                rfilename:
                  type: string
                size:
                  type: integer
                lfs:
                  type: object
                  properties:
                    sha256:
                      type: string
                    size:
                      type: integer
                    pointerSize:
                      type: integer
            description: Files in the repository
          spaces:
            type: array
            items:
              type: string
            description: Spaces using this model
          safetensors:
            type: object
            properties:
              parameters:
                type: object
                additionalProperties:
                  type: integer
              total:
                type: integer
            description: Safetensors parameter information
          config:
            type: object
            description: Model configuration
          cardData:
            type: object
            description: Parsed model card metadata
          transformersInfo:
            type: object
            properties:
              auto_model:
                type: string
              pipeline_tag:
                type: string
              processor:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: HF Token
      description: Optional Hugging Face API token. Required for private and gated datasets.