data
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.Hugging Face CLI Setup
Hugging Face can be configured headlessly with `kosmokrator integrations:configure hugging-face`.
# 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 hugging-face --set access_token="$HUGGING_FACE_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor hugging-face --json
kosmokrator integrations:status --json Credentials
Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | HUGGING_FACE_ACCESS_TOKEN | Secret secret | yes | Access Token |
url | HUGGING_FACE_URL | URL url | no | API Base URL |
inference_url | HUGGING_FACE_INFERENCE_URL | URL url | no | Inference Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call hugging-face.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 kosmo integrations:hugging-face 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 Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs hugging-face --json
kosmo integrations:docs hugging-face.huggingface_list_models --json
kosmo integrations:schema hugging-face.huggingface_list_models --json
kosmo integrations:search "Hugging Face" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
hugging-face.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.
read - Parameters
- search, author, task, tags, sort, direction, limit, offset
kosmo integrations:call hugging-face.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 kosmo integrations:hugging-face 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 hugging-face.huggingface_get_model
Get detailed information about a specific Hugging Face model, including its card, tags, pipeline tag, library, downloads, likes, and file listing.
read - Parameters
- model_id
kosmo integrations:call hugging-face.huggingface_get_model '{"model_id":"example_model_id"}' --json kosmo integrations:hugging-face huggingface_get_model '{"model_id":"example_model_id"}' --json hugging-face.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.
read - Parameters
- search, author, tags, sort, direction, limit, offset
kosmo integrations:call hugging-face.huggingface_list_datasets '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json kosmo integrations:hugging-face huggingface_list_datasets '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json hugging-face.huggingface_get_dataset
Get detailed information about a Hugging Face dataset, including card data, tags, downloads, likes, and files.
read - Parameters
- dataset_id
kosmo integrations:call hugging-face.huggingface_get_dataset '{"dataset_id":"example_dataset_id"}' --json kosmo integrations:hugging-face huggingface_get_dataset '{"dataset_id":"example_dataset_id"}' --json hugging-face.huggingface_inference
Run inference on a Hugging Face model via the serverless Inference API. Supports text generation, summarization, translation, classification, image analysis, and more. The payload structure depends on the model's task; refer to the Hugging Face Inference API docs for model-specific formats.
write - Parameters
- model_id, inputs, parameters, data
kosmo integrations:call hugging-face.huggingface_inference '{"model_id":"example_model_id","inputs":"example_inputs","parameters":"example_parameters","data":"example_data"}' --json kosmo integrations:hugging-face huggingface_inference '{"model_id":"example_model_id","inputs":"example_inputs","parameters":"example_parameters","data":"example_data"}' --json hugging-face.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.
read - Parameters
- search, author, tags, sort, direction, limit, offset
kosmo integrations:call hugging-face.huggingface_list_spaces '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json kosmo integrations:hugging-face huggingface_list_spaces '{"search":"example_search","author":"example_author","tags":"example_tags","sort":"example_sort","direction":"example_direction","limit":1,"offset":1}' --json hugging-face.huggingface_get_space
Get detailed information about a Hugging Face Space, including SDK, runtime, tags, likes, and files.
read - Parameters
- space_id
kosmo integrations:call hugging-face.huggingface_get_space '{"space_id":"example_space_id"}' --json kosmo integrations:hugging-face huggingface_get_space '{"space_id":"example_space_id"}' --json hugging-face.huggingface_get_current_user
Get the authenticated Hugging Face user's profile information, including name, username, type (user/org), and avatar.
read - Parameters
- none
kosmo integrations:call hugging-face.huggingface_get_current_user '{}' --json kosmo integrations:hugging-face huggingface_get_current_user '{}' --json hugging-face.huggingface_list_commits
List commits for a Hugging Face model, dataset, or Space repository at a revision.
read - Parameters
- repo_type, repo_id, revision
kosmo integrations:call hugging-face.huggingface_list_commits '{"repo_type":"example_repo_type","repo_id":"example_repo_id","revision":"example_revision"}' --json kosmo integrations:hugging-face huggingface_list_commits '{"repo_type":"example_repo_type","repo_id":"example_repo_id","revision":"example_revision"}' --json hugging-face.huggingface_list_refs
List branches, tags, and refs for a Hugging Face model, dataset, or Space repository.
read - Parameters
- repo_type, repo_id
kosmo integrations:call hugging-face.huggingface_list_refs '{"repo_type":"example_repo_type","repo_id":"example_repo_id"}' --json kosmo integrations:hugging-face huggingface_list_refs '{"repo_type":"example_repo_type","repo_id":"example_repo_id"}' --json hugging-face.huggingface_list_tree
List repository tree contents for a model, dataset, or Space at a revision and optional nested path.
read - Parameters
- repo_type, repo_id, revision, path, params
kosmo integrations:call hugging-face.huggingface_list_tree '{"repo_type":"example_repo_type","repo_id":"example_repo_id","revision":"example_revision","path":"example_path","params":"example_params"}' --json kosmo integrations:hugging-face huggingface_list_tree '{"repo_type":"example_repo_type","repo_id":"example_repo_id","revision":"example_revision","path":"example_path","params":"example_params"}' --json hugging-face.huggingface_get_scan_status
Get the Hugging Face Hub security scan status for a model, dataset, or Space repository.
read - Parameters
- repo_type, repo_id
kosmo integrations:call hugging-face.huggingface_get_scan_status '{"repo_type":"example_repo_type","repo_id":"example_repo_id"}' --json kosmo integrations:hugging-face huggingface_get_scan_status '{"repo_type":"example_repo_type","repo_id":"example_repo_id"}' --json hugging-face.huggingface_list_model_tags
List Hugging Face model tags grouped by type, such as task, library, language, and license.
read - Parameters
- none
kosmo integrations:call hugging-face.huggingface_list_model_tags '{}' --json kosmo integrations:hugging-face huggingface_list_model_tags '{}' --json hugging-face.huggingface_list_dataset_tags
List Hugging Face dataset tags grouped by type, such as task category, language, modality, and license.
read - Parameters
- none
kosmo integrations:call hugging-face.huggingface_list_dataset_tags '{}' --json kosmo integrations:hugging-face huggingface_list_dataset_tags '{}' --json hugging-face.huggingface_list_space_hardware
List Hugging Face Space hardware options for creating or upgrading Spaces.
read - Parameters
- none
kosmo integrations:call hugging-face.huggingface_list_space_hardware '{}' --json kosmo integrations:hugging-face huggingface_list_space_hardware '{}' --json hugging-face.huggingface_create_repo
Create a Hugging Face model, dataset, or Space repository. Use type values "model", "dataset", or "space".
write - Parameters
- name, type, organization, private, sdk, license, extra
kosmo integrations:call hugging-face.huggingface_create_repo '{"name":"example_name","type":"example_type","organization":"example_organization","private":true,"sdk":"example_sdk","license":"example_license","extra":"example_extra"}' --json kosmo integrations:hugging-face huggingface_create_repo '{"name":"example_name","type":"example_type","organization":"example_organization","private":true,"sdk":"example_sdk","license":"example_license","extra":"example_extra"}' --json hugging-face.huggingface_api_get
Call a relative Hugging Face Hub API GET path, such as "/models-tags-by-type". Absolute URLs are rejected.
read - Parameters
- path, params
kosmo integrations:call hugging-face.huggingface_api_get '{"path":"example_path","params":"example_params"}' --json kosmo integrations:hugging-face huggingface_api_get '{"path":"example_path","params":"example_params"}' --json hugging-face.huggingface_api_post
Call a relative Hugging Face Hub API POST path with a JSON body. Absolute URLs are rejected.
write - Parameters
- path, payload
kosmo integrations:call hugging-face.huggingface_api_post '{"path":"example_path","payload":"example_payload"}' --json kosmo integrations:hugging-face huggingface_api_post '{"path":"example_path","payload":"example_payload"}' --json hugging-face.huggingface_api_put
Call a relative Hugging Face Hub API PUT path with a JSON body. Absolute URLs are rejected.
write - Parameters
- path, payload
kosmo integrations:call hugging-face.huggingface_api_put '{"path":"example_path","payload":"example_payload"}' --json kosmo integrations:hugging-face huggingface_api_put '{"path":"example_path","payload":"example_payload"}' --json hugging-face.huggingface_api_delete
Call a relative Hugging Face Hub API DELETE path. Absolute URLs are rejected.
write - Parameters
- path, payload
kosmo integrations:call hugging-face.huggingface_api_delete '{"path":"example_path","payload":"example_payload"}' --json kosmo integrations:hugging-face huggingface_api_delete '{"path":"example_path","payload":"example_payload"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
hugging-face.huggingface_list_models 8 parameters
kosmo integrations:schema hugging-face.huggingface_list_models --json | Parameter | Type | Required | Description |
|---|---|---|---|
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. |
hugging-face.huggingface_get_model 1 parameters
kosmo integrations:schema hugging-face.huggingface_get_model --json | Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | yes | The model ID (e.g. "meta-llama/Llama-3.3-70B-Instruct", "bert-base-uncased"). |
hugging-face.huggingface_list_datasets 7 parameters
kosmo integrations:schema hugging-face.huggingface_list_datasets --json | Parameter | Type | Required | Description |
|---|---|---|---|
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. |
hugging-face.huggingface_get_dataset 1 parameters
kosmo integrations:schema hugging-face.huggingface_get_dataset --json | Parameter | Type | Required | Description |
|---|---|---|---|
dataset_id | string | yes | Dataset ID, for example "mozilla-foundation/common_voice_17_0". |
hugging-face.huggingface_inference 4 parameters
kosmo integrations:schema hugging-face.huggingface_inference --json | Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | yes | The model ID to run inference on (e.g. "meta-llama/Llama-3.3-70B-Instruct", "facebook/bart-large-cnn"). |
inputs | string | no | The input text or data for the model. For text tasks, this is the prompt or text to process. |
parameters | object | no | Model-specific parameters (e.g. {"max_new_tokens": 256, "temperature": 0.7, "top_p": 0.95} for text generation). |
data | string | no | Base64-encoded data for image/audio tasks. Use this instead of "inputs" for non-text models. |
hugging-face.huggingface_list_spaces 7 parameters
kosmo integrations:schema hugging-face.huggingface_list_spaces --json | Parameter | Type | Required | Description |
|---|---|---|---|
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. |
hugging-face.huggingface_get_space 1 parameters
kosmo integrations:schema hugging-face.huggingface_get_space --json | Parameter | Type | Required | Description |
|---|---|---|---|
space_id | string | yes | Space ID, for example "organization/space-name". |
hugging-face.huggingface_get_current_user 0 parameters
kosmo integrations:schema hugging-face.huggingface_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
hugging-face.huggingface_list_commits 3 parameters
kosmo integrations:schema hugging-face.huggingface_list_commits --json | Parameter | Type | Required | Description |
|---|---|---|---|
repo_type | string | yes | Repository type. Singular values are also accepted. |
repo_id | string | yes | Repository ID, for example "meta-llama/Llama-3.3-70B-Instruct". |
revision | string | no | Revision, branch, or tag. Defaults to "main". |
hugging-face.huggingface_list_refs 2 parameters
kosmo integrations:schema hugging-face.huggingface_list_refs --json | Parameter | Type | Required | Description |
|---|---|---|---|
repo_type | string | yes | Repository type. Singular values are also accepted. |
repo_id | string | yes | Repository ID. |
hugging-face.huggingface_list_tree 5 parameters
kosmo integrations:schema hugging-face.huggingface_list_tree --json | Parameter | Type | Required | Description |
|---|---|---|---|
repo_type | string | yes | Repository type. Singular values are also accepted. |
repo_id | string | yes | Repository ID. |
revision | string | no | Revision, branch, or tag. Defaults to "main". |
path | string | no | Nested folder path inside the repository. |
params | object | no | Optional Hub API query parameters, such as recursive or expand when supported. |
hugging-face.huggingface_get_scan_status 2 parameters
kosmo integrations:schema hugging-face.huggingface_get_scan_status --json | Parameter | Type | Required | Description |
|---|---|---|---|
repo_type | string | yes | Repository type. Singular values are also accepted. |
repo_id | string | yes | Repository ID. |
hugging-face.huggingface_list_model_tags 0 parameters
kosmo integrations:schema hugging-face.huggingface_list_model_tags --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
hugging-face.huggingface_list_dataset_tags 0 parameters
kosmo integrations:schema hugging-face.huggingface_list_dataset_tags --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
hugging-face.huggingface_list_space_hardware 0 parameters
kosmo integrations:schema hugging-face.huggingface_list_space_hardware --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
hugging-face.huggingface_create_repo 7 parameters
kosmo integrations:schema hugging-face.huggingface_create_repo --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Repository name without owner prefix. |
type | string | yes | Repository type. |
organization | string | no | Optional organization owner. Omit for the authenticated user. |
private | boolean | no | Whether the repository should be private. |
sdk | string | no | Space SDK when creating a Space, for example "gradio", "streamlit", "docker", or "static". |
license | string | no | Optional license identifier. |
extra | object | no | Additional official repository creation fields to pass through. |
hugging-face.huggingface_api_get 2 parameters
kosmo integrations:schema hugging-face.huggingface_api_get --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Hub API path, with or without leading slash. |
params | object | no | Query parameters. |
hugging-face.huggingface_api_post 2 parameters
kosmo integrations:schema hugging-face.huggingface_api_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Hub API path, with or without leading slash. |
payload | object | no | JSON request body. |
hugging-face.huggingface_api_put 2 parameters
kosmo integrations:schema hugging-face.huggingface_api_put --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Hub API path, with or without leading slash. |
payload | object | no | JSON request body. |
hugging-face.huggingface_api_delete 2 parameters
kosmo integrations:schema hugging-face.huggingface_api_delete --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Hub API path, with or without leading slash. |
payload | object | no | Optional JSON request body. |
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.