> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/cheahjs/free-llm-api-resources/llms.txt
> Use this file to discover all available pages before exploring further.

# HuggingFace Inference Providers

> Free serverless inference for open-source models

<Note>
  HuggingFace provides free serverless inference for various open-source models with a monthly credit allocation.
</Note>

## Overview

HuggingFace Inference Providers offer free API access to thousands of open-source models through serverless inference endpoints.

## Rate Limits

<Info>
  **Monthly Credits**: \$0.10/month in free credits for serverless inference
</Info>

[View detailed pricing](https://huggingface.co/docs/inference-providers/en/pricing)

## Model Support

<Warning>
  **Size Limitation**: HuggingFace Serverless Inference is limited to models smaller than 10GB. However, some popular models are supported even if they exceed 10GB.
</Warning>

### Available Models

* Various open-source models across supported providers
* Text generation models (Llama, Mistral, Gemma, etc.)
* Text embedding models
* Image generation models
* Audio models
* Computer vision models

<Card title="Browse Models" icon="magnifying-glass" href="https://huggingface.co/models">
  Explore thousands of available models on HuggingFace
</Card>

## API Usage

<CodeGroup>
  ```python Python theme={null}
  from huggingface_hub import InferenceClient

  client = InferenceClient(token="YOUR_HF_TOKEN")

  response = client.chat_completion(
      model="meta-llama/Llama-3.3-70B-Instruct",
      messages=[
          {"role": "user", "content": "Hello, how are you?"}
      ],
      max_tokens=500
  )

  print(response.choices[0].message.content)
  ```

  ```javascript JavaScript theme={null}
  import { HfInference } from '@huggingface/inference';

  const client = new HfInference(process.env.HF_TOKEN);

  const response = await client.chatCompletion({
      model: 'meta-llama/Llama-3.3-70B-Instruct',
      messages: [
          { role: 'user', content: 'Hello, how are you?' }
      ],
      max_tokens: 500
  });

  console.log(response.choices[0].message.content);
  ```

  ```bash cURL theme={null}
  curl https://api-inference.huggingface.co/models/meta-llama/Llama-3.3-70B-Instruct/v1/chat/completions \
    -H "Authorization: Bearer YOUR_HF_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "meta-llama/Llama-3.3-70B-Instruct",
      "messages": [
        {"role": "user", "content": "Hello, how are you?"}
      ],
      "max_tokens": 500
    }'
  ```
</CodeGroup>

## Getting Started

<Steps>
  <Step title="Create Account">
    Sign up at [huggingface.co](https://huggingface.co)
  </Step>

  <Step title="Generate Access Token">
    Create a user access token from your settings
  </Step>

  <Step title="Choose Model">
    Browse the model hub and select a model
  </Step>

  <Step title="Start Inferencing">
    Use the API or Python client to run inference
  </Step>
</Steps>

## Inference Providers

HuggingFace partners with multiple inference providers:

<CardGroup cols={2}>
  <Card title="AWS" icon="aws">
    Amazon Web Services infrastructure
  </Card>

  <Card title="Azure" icon="microsoft">
    Microsoft Azure cloud platform
  </Card>

  <Card title="Google Cloud" icon="google">
    Google Cloud Platform
  </Card>

  <Card title="HuggingFace" icon="face-smile">
    Native HuggingFace infrastructure
  </Card>
</CardGroup>

## Key Features

<Info>
  * Access to thousands of open-source models
  * Automatic model loading and scaling
  * No infrastructure management required
  * Pay-as-you-go pricing with free monthly credits
  * Support for various model types (text, image, audio, etc.)
</Info>

## Use Cases

* **Prototyping**: Quickly test different models
* **Research**: Experiment with latest open-source models
* **Development**: Build applications without infrastructure setup
* **Comparison**: Test multiple models to find the best fit

## Additional Resources

<CardGroup cols={2}>
  <Card title="HuggingFace Hub" icon="browser" href="https://huggingface.co">
    Explore models and datasets
  </Card>

  <Card title="Documentation" icon="book" href="https://huggingface.co/docs/inference-providers">
    API documentation
  </Card>

  <Card title="Python Client" icon="python" href="https://huggingface.co/docs/huggingface_hub">
    Python library documentation
  </Card>

  <Card title="Pricing" icon="dollar-sign" href="https://huggingface.co/docs/inference-providers/en/pricing">
    Detailed pricing information
  </Card>
</CardGroup>
