Package Information
Released: 6/8/2025
Downloads: 20 weeklyĀ /Ā 92 monthly
Latest Version: 1.0.0
Author: activadee
Documentation
n8n-nodes-gradio-client
A comprehensive n8n community node that enables seamless integration with Gradio Spaces, allowing you to call AI models and APIs hosted on HuggingFace Spaces directly from your n8n workflows.
Features
- š Universal Gradio Support: Call any Gradio Space API function with automatic endpoint discovery
- š HuggingFace Authentication: Support for private spaces with API tokens
- š File Upload Handling: Seamless file uploads with automatic processing and metadata handling
- ā” Real-time Streaming: Server-Sent Events (SSE) support for live AI model responses
- š Smart API Discovery: Automatic endpoint detection via OpenAPI specification with config fallback
- š”ļø Comprehensive Error Handling: Detailed error types with HTTP status mapping and recovery suggestions
- š Adaptive Retry Logic: Exponential backoff retry mechanisms for robust API interactions
- šÆ Production Ready: Debug mode, configurable timeouts, and session management
Installation
For n8n Cloud/Self-hosted
npm install @activadee/n8n-nodes-gradio-client
For Local Development
cd ~/.n8n/custom
npm install @activadee/n8n-nodes-gradio-client
Usage
Basic Function Call
- Add the Gradio Client node to your workflow
- Configure the Space URL: Enter the full URL (e.g.,
https://username-spacename.hf.space
) - Set the API endpoint: Specify the function name (e.g.,
/predict
,/generate
) - Provide input parameters: Supply inputs as a JSON array matching the expected format
File Uploads
For models that require file inputs:
- Enable file upload in the File Upload Options
- Specify parameter index: Set which parameter position expects the file
- Set binary property: Configure the n8n binary property containing your file
- Optional filename: Provide a custom filename if needed
Authentication
For private HuggingFace Spaces:
- Toggle authentication: Enable "Requires Authentication"
- Add HuggingFace credentials: Configure your API token in n8n credentials
- Automatic token handling: The node automatically adds Bearer token to requests
Example Use Cases
- šµ Text-to-Speech: Generate audio from text using Chatterbox TTS or similar models
- šØ Image Generation: Create images with DALL-E, Stable Diffusion, or Midjourney spaces
- š¬ LLM Inference: Chat with Llama, Mistral, Claude, or other language models
- š Document Analysis: Process PDFs, images, or text with specialized AI models
- š„ Video Processing: Generate or analyze video content with AI models
- š Text Processing: Summarization, translation, sentiment analysis, and more
Development
Prerequisites
- Node.js 16+
- npm or yarn
- n8n-workflow peer dependency
Project Structure
nodes/gradio/
āāā credentials/
ā āāā HuggingFaceApi.credentials.ts # HuggingFace API credentials
āāā nodes/GradioClient/
ā āāā GradioClient.node.ts # Main node entry point
ā āāā nodeDefinition.ts # Node UI configuration
ā āāā operations.ts # Business logic for API calls
ā āāā client.ts # Gradio API client implementation
ā āāā types.ts # TypeScript interfaces
ā āāā utils.ts # Helper functions
ā āāā errors.ts # Error handling classes
ā āāā loadOptions.ts # Dynamic option loading
ā āāā gradio.svg # Node icon
āāā package.json
āāā tsconfig.json
āāā README.md
Development Commands
# Install dependencies
npm install
# Build the project (compiles TypeScript to dist/)
npm run build
# Development mode with file watching
npm run dev
# Run semantic release (automated via CI)
npm run semantic-release
Local Development Setup
Clone the repository:
git clone https://github.com/activadee/n8n-nodes-gradio-client.git cd n8n-nodes-gradio-client
Install dependencies:
npm install
Build the project:
npm run build
Link to your n8n installation:
# For global n8n installation npm link cd ~/.n8n/custom npm link @activadee/n8n-nodes-gradio-client # For local n8n development cd path/to/your/n8n npm link ../path/to/@activadee/n8n-nodes-gradio-client
Start n8n and the node will be available in the node palette
Development Workflow
- Make changes to TypeScript files in
nodes/GradioClient/
- Run build with
npm run build
or use watch modenpm run dev
- Test in n8n by restarting your n8n instance
- Commit changes using conventional commit format
- Create PR - releases are automated via semantic-release
Testing
Currently, the project uses manual testing through n8n workflows. To test:
- Build the project:
npm run build
- Create test workflows in n8n with various Gradio spaces
- Test different scenarios:
- Public spaces without authentication
- Private spaces with HuggingFace tokens
- File uploads and downloads
- Error handling and edge cases
Code Architecture
Core Components
- GradioClient.node.ts: Main n8n node implementation that handles execution flow
- nodeDefinition.ts: Defines the node's UI properties and configuration options
- operations.ts: Contains business logic for different operations (get info, call function)
- client.ts: Low-level Gradio API client with polling and streaming support
- types.ts: TypeScript interfaces and enums for type safety
- utils.ts: Helper functions for URL cleaning, parameter normalization, etc.
- errors.ts: Custom error classes for better error handling
Key Features Implementation
- Polling Logic: Implements intelligent polling for long-running Gradio functions
- File Handling: Converts n8n binary data to Gradio-compatible file objects
- Authentication: Handles HuggingFace API token integration
- Error Recovery: Comprehensive error handling with retry mechanisms
Release Process
This project uses automated semantic versioning and releasing:
- Conventional Commits: Use conventional commit format for automatic version bumping
- Automated Releases: GitHub Actions automatically publishes to npm on main branch pushes
- Beta Releases: Push to
beta
branch for pre-release versions - Changelog: Automatically generated changelog based on commit messages
Commit Message Format
type(scope): description
feat: add new feature
fix: bug fix
docs: documentation changes
style: formatting changes
refactor: code refactoring
test: adding tests
chore: maintenance tasks
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature
- Make your changes following the code style
- Test thoroughly with different Gradio spaces
- Commit using conventional format:
git commit -m "feat: add new feature"
- Push and create a Pull Request
Troubleshooting
Common Issues
Authentication Errors:
- Verify HuggingFace API token is correct
- Ensure the space requires authentication
- Check token permissions
Timeout Errors:
- Increase timeout values for long-running models
- Check if the Gradio space is responsive
- Verify space URL is correct
File Upload Issues:
- Ensure binary data property exists
- Check file parameter index matches the model's expected input
- Verify file types are supported by the space
API Endpoint Not Found:
- Use "Get Space Info" operation to discover available endpoints
- Check if the space is public and accessible
- Verify the API name format (should start with
/
)
Support
- š Bug Reports: GitHub Issues
- š” Feature Requests: GitHub Discussions
- š Documentation: n8n Community Nodes
- š¬ Community: n8n Discord