KosmoKrator

ai

Hugging Face CLI for AI Agents

Use the Hugging Face CLI from KosmoKrator to call Hugging Face tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 7 read 0 write Bearer token auth

Hugging Face CLI Setup

Hugging Face can be configured headlessly with `kosmokrator integrations:configure huggingface`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure huggingface --set access_token="$HUGGINGFACE_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor huggingface --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token HUGGINGFACE_ACCESS_TOKEN Secret secret yes Access Token
url HUGGINGFACE_URL URL url no API Base URL

Call Hugging Face Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call huggingface.huggingface_list_models '{
  "search": "example_search",
  "author": "example_author",
  "task": "example_task",
  "tags": "example_tags",
  "sort": "example_sort",
  "direction": "example_direction",
  "limit": 1,
  "offset": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:huggingface huggingface_list_models '{
  "search": "example_search",
  "author": "example_author",
  "task": "example_task",
  "tags": "example_tags",
  "sort": "example_sort",
  "direction": "example_direction",
  "limit": 1,
  "offset": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs huggingface --json
kosmo integrations:docs huggingface.huggingface_list_models --json
kosmo integrations:schema huggingface.huggingface_list_models --json
kosmo integrations:search "Hugging Face" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Hugging Face.

huggingface.huggingface_list_models

Read read

Search and list AI models on the Hugging Face Hub. Filter by text search, author, task (e.g. "text-generation", "image-classification"), tags, and sort by downloads, likes, or recent activity.

Parameters
search, author, task, tags, sort, direction, limit, offset

Generic CLI call

kosmo integrations:call huggingface.huggingface_list_models '{"search":"example_search","author":"example_author","task":"example_task","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_list_models '{"search":"example_search","author":"example_author","task":"example_task","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json

huggingface.huggingface_get_model

Read read

Get detailed information about a specific Hugging Face model, including its card, tags, pipeline tag, library, downloads, likes, and file listing.

Parameters
model_id

Generic CLI call

kosmo integrations:call huggingface.huggingface_get_model '{"model_id":"example_model_id"}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_get_model '{"model_id":"example_model_id"}' --json

huggingface.huggingface_list_datasets

Read read

Search and list datasets on the Hugging Face Hub. Filter by text search, author, tags, and sort by downloads, likes, or recent activity.

Parameters
search, author, tags, sort, direction, limit, offset

Generic CLI call

kosmo integrations:call huggingface.huggingface_list_datasets '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_list_datasets '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json

huggingface.huggingface_get_dataset

Read read

Get detailed information about a specific Hugging Face dataset, including its card, tags, downloads, likes, and file listing.

Parameters
dataset_id

Generic CLI call

kosmo integrations:call huggingface.huggingface_get_dataset '{"dataset_id":"example_dataset_id"}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_get_dataset '{"dataset_id":"example_dataset_id"}' --json

huggingface.huggingface_list_spaces

Read read

Search and list Spaces on the Hugging Face Hub. Filter by text search, author, tags, SDK, and sort by downloads, likes, or recent activity.

Parameters
search, author, tags, sort, direction, limit, offset

Generic CLI call

kosmo integrations:call huggingface.huggingface_list_spaces '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_list_spaces '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json

huggingface.huggingface_get_space

Read read

Get detailed information about a specific Hugging Face Space, including its SDK, hardware, runtime status, and settings.

Parameters
space_id

Generic CLI call

kosmo integrations:call huggingface.huggingface_get_space '{"space_id":"example_space_id"}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_get_space '{"space_id":"example_space_id"}' --json

huggingface.huggingface_get_current_user

Read read

Get the authenticated Hugging Face user's profile information, including name, username, type (user/org), and avatar.

Parameters
none

Generic CLI call

kosmo integrations:call huggingface.huggingface_get_current_user '{}' --json

Provider shortcut

kosmo integrations:huggingface huggingface_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

huggingface.huggingface_list_models

Search and list AI models on the Hugging Face Hub. Filter by text search, author, task (e.g. "text-generation", "image-classification"), tags, and sort by downloads, likes, or recent activity.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_list_models --json
ParameterTypeRequiredDescription
search string no Search query to filter models by name or description.
author string no Filter by organization or user (e.g. "meta-llama", "openai").
task string no Filter by pipeline task (e.g. "text-generation", "text-classification", "image-classification", "automatic-speech-recognition").
tags array no Filter by tags (e.g. ["pytorch", "safetensors"]).
sort string no Sort order: "downloads", "likes", "lastModified", "created". Defaults to "downloads".
direction string no Sort direction: "asc" or "desc". Defaults to "desc".
limit integer no Number of results per page (default: 20, max: 500).
offset integer no Offset for pagination.

huggingface.huggingface_get_model

Get detailed information about a specific Hugging Face model, including its card, tags, pipeline tag, library, downloads, likes, and file listing.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_get_model --json
ParameterTypeRequiredDescription
model_id string yes The model ID (e.g. "meta-llama/Llama-3.3-70B-Instruct", "bert-base-uncased").

huggingface.huggingface_list_datasets

Search and list datasets on the Hugging Face Hub. Filter by text search, author, tags, and sort by downloads, likes, or recent activity.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_list_datasets --json
ParameterTypeRequiredDescription
search string no Search query to filter datasets by name or description.
author string no Filter by organization or user (e.g. "HuggingFaceFW", "mozilla-foundation").
tags array no Filter by tags (e.g. ["text-classification", "english"]).
sort string no Sort order: "downloads", "likes", "lastModified", "created". Defaults to "downloads".
direction string no Sort direction: "asc" or "desc". Defaults to "desc".
limit integer no Number of results per page (default: 20, max: 500).
offset integer no Offset for pagination.

huggingface.huggingface_get_dataset

Get detailed information about a specific Hugging Face dataset, including its card, tags, downloads, likes, and file listing.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_get_dataset --json
ParameterTypeRequiredDescription
dataset_id string yes The dataset ID (e.g. "mozilla-foundation/common_voice_17_0", "imdb").

huggingface.huggingface_list_spaces

Search and list Spaces on the Hugging Face Hub. Filter by text search, author, tags, SDK, and sort by downloads, likes, or recent activity.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_list_spaces --json
ParameterTypeRequiredDescription
search string no Search query to filter Spaces by name or description.
author string no Filter by organization or user (e.g. "gradio", "stabilityai").
tags array no Filter by tags (e.g. ["gradio", "text-generation"]).
sort string no Sort order: "downloads", "likes", "lastModified", "created". Defaults to "downloads".
direction string no Sort direction: "asc" or "desc". Defaults to "desc".
limit integer no Number of results per page (default: 20, max: 500).
offset integer no Offset for pagination.

huggingface.huggingface_get_space

Get detailed information about a specific Hugging Face Space, including its SDK, hardware, runtime status, and settings.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_get_space --json
ParameterTypeRequiredDescription
space_id string yes The Space ID (e.g. "stabilityai/stable-diffusion-3.5", "gradio/chatbot").

huggingface.huggingface_get_current_user

Get the authenticated Hugging Face user's profile information, including name, username, type (user/org), and avatar.

Operation
Read read
Schema command
kosmo integrations:schema huggingface.huggingface_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.