ai
Hugging Face CLI for Shell Scripts
Use the Hugging Face CLI for shell scripts with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 7 read 0 write Bearer token auth
Hugging Face CLI for Shell Scripts
Call integration functions from shell scripts with stable JSON input and output.
Use shell scripts for small local automations that need one or more integration calls. The Hugging Face CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Hugging Face CLI for Shell Scripts
kosmokrator integrations:configure huggingface --set access_token="$HUGGINGFACE_ACCESS_TOKEN" --enable --read allow --write ask --json
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 Discovery Before Execution
Agents and scripts can inspect Hugging Face docs and schemas 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 Useful Hugging Face CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
huggingface.huggingface_list_models | Read | search, author, task, tags, sort, direction, limit, offset | 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. |
huggingface.huggingface_get_model | Read | model_id | Get detailed information about a specific Hugging Face model, including its card, tags, pipeline tag, library, downloads, likes, and file listing. |
huggingface.huggingface_list_datasets | Read | search, author, tags, sort, direction, limit, offset | Search and list datasets on the Hugging Face Hub. Filter by text search, author, tags, and sort by downloads, likes, or recent activity. |
huggingface.huggingface_get_dataset | Read | dataset_id | Get detailed information about a specific Hugging Face dataset, including its card, tags, downloads, likes, and file listing. |
huggingface.huggingface_list_spaces | Read | search, author, tags, sort, direction, limit, offset | Search and list Spaces on the Hugging Face Hub. Filter by text search, author, tags, SDK, and sort by downloads, likes, or recent activity. |
huggingface.huggingface_get_space | Read | space_id | Get detailed information about a specific Hugging Face Space, including its SDK, hardware, runtime status, and settings. |
huggingface.huggingface_get_current_user | Read | none | Get the authenticated Hugging Face user's profile information, including name, username, type (user/org), and avatar. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.