Hugging Face

Base URL
Card required✅ No
NotesFree inference API, rate limited
Last verified2026-06-28
Advertisement

Free Models

Model IDContextModalitiesRPMRPD
mistralai/Mistral-7B-Instruct-v0.2 33K text

Quick Start

Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://router.huggingface.co/v1",
    api_key="YOUR_API_KEY",  # get at https://huggingface.co/settings/tokens
)
response = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
curl
curl https://router.huggingface.co/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Advertisement