Skip to main content
kRouter
All providers

Pay-per-token

hf/

HuggingFace

HuggingFace — connect via API key.

huggingface.co

Quick setup

  1. Open the kRouter dashboard at http://localhost:20128

  2. Go to Providers → click HuggingFace

  3. Paste your API key, click Save

  4. Test the connection

Use in your IDE

Point any OpenAI-compatible client at kRouter using your local API key.

ide configbash
# Endpoint
http://localhost:20128/v1

# API key (from Dashboard → API Keys)
sk-krouter-XXXX

# Model
hf/<model-id>

How HuggingFace billing works with kRouter

HuggingFace is pay-per-token. You bring your own API key and kRouter routes to it, so you keep your own rate limits and billing relationship. kRouter authenticates it via apikey. 4 models are routable as hf/<model>.

Through kRouter, HuggingFace serves image generation, exposed on /v1/images/generations, image understanding (OCR / vision-to-text), text-to-speech, exposed on /v1/audio/speech, speech-to-text, exposed on /v1/audio/transcriptions. Requests reach it through the same local OpenAI-compatible endpoint as every other provider, so switching to or from HuggingFace is a one-line model change in your client rather than a rewrite.

HuggingFace models & pricing

These are the model ids kRouter routes to. This provider does not publish per-token rates.

ModelRoute as
FLUX.1 Schnellhf/black-forest-labs/FLUX.1-schnell
SDXL Base 1.0hf/stabilityai/stable-diffusion-xl-base-1.0
Whisper Large v3 (HF)hf/openai/whisper-large-v3
Whisper Small (HF)hf/openai/whisper-small

HuggingFace links

HuggingFace FAQ

Is HuggingFace free through kRouter?

HuggingFace is pay-per-token: you bring your own API key and are billed by HuggingFace at their rates. kRouter adds nothing on top and is free and MIT-licensed.

How do I use HuggingFace with Claude Code or Cursor?

Connect HuggingFace in the kRouter dashboard, then point your tool at kRouter's local endpoint (http://localhost:20128/v1) with a kRouter API key. Any OpenAI-compatible client works, and models are addressed as hf/<model>.

Which HuggingFace models can kRouter route to?

4 models, including FLUX.1 Schnell, SDXL Base 1.0, Whisper Large v3 (HF). Every one is addressed as hf/<model> from any client.

What happens when HuggingFace is rate limited?

kRouter detects the limit, parks that account until its real reset time, and fails over to your next connected account or provider — so the request still completes instead of erroring.