Overview
LiteLLM provides support for HuggingFace models through multiple deployment options: HuggingFace Inference API, dedicated endpoints, and provider-specific routing.Quick Start
1
Install LiteLLM
2
Set API Key
3
Make Your First Call
Deployment Options
- Inference API
- Dedicated Endpoint
- Provider Routing
Use HuggingFace’s serverless Inference API.
Authentication
- Environment Variable
- Direct Parameter
Chat Completions
Streaming
Embeddings
HuggingFace supports various embedding models.- Sentence Transformers
- BGE Models
- Custom Endpoint
Reranking
Use HuggingFace reranking models for improved search.Provider-Specific Routing
Route requests through different inference providers.Provider availability varies by model. LiteLLM validates provider support automatically.
Configuration
Supported Parameters
Not all parameters are supported by all HuggingFace models. Check model documentation.
Error Handling
LiteLLM Proxy
Best Practices
Model Selection
Model Selection
- Use Inference API for testing and prototyping
- Use dedicated endpoints for production workloads
- Check model availability on HuggingFace Hub
Performance
Performance
- Dedicated endpoints provide better latency
- Provider routing offers alternative inference options
- Monitor staging vs production provider status
Cost Optimization
Cost Optimization
- Inference API is free tier available
- Dedicated endpoints are billed separately
- Compare provider pricing when routing