Skip to main content

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

Use HuggingFace’s serverless Inference API.

Authentication

Chat Completions

Streaming

Embeddings

HuggingFace supports various embedding models.

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

  • Use Inference API for testing and prototyping
  • Use dedicated endpoints for production workloads
  • Check model availability on HuggingFace Hub
  • Dedicated endpoints provide better latency
  • Provider routing offers alternative inference options
  • Monitor staging vs production provider status
  • Inference API is free tier available
  • Dedicated endpoints are billed separately
  • Compare provider pricing when routing

Common Models