bitsrun

Run a Hugging Face model as a private API

Run a Hugging Face model as a private, OpenAI-compatible API. Paste the repo link, check the GPU and price, deploy, and pay only by the second while it runs.

Updated

On this page

This guide shows how to run a Hugging Face model as a private API: your own HTTPS endpoint that speaks the OpenAI API, sleeps when nobody calls it and bills by the second while it is awake. You paste the repo link, BitsRun picks the file, the runtime and the GPU, and you call it with any OpenAI client. It takes about 10 minutes, most of it the first start of the GPU.

Before you start

  • A BitsRun account with credit. Create your account and add credit from $10.
  • A text generation or embedding model on Hugging Face, in GGUF or safetensors format.
  • For a gated repo (such as Llama or Gemma): a Hugging Face account that has accepted the model's terms.
  • Optional: the bitsrun command line, installed with curl -fsSL https://get.bitsrun.com | sh, then bitsrun login.

How to copy the right name from Hugging Face

Copy the address of the model page from your browser, for example https://huggingface.co/unsloth/Qwen3-8B-GGUF. You can also write it as hf:unsloth/Qwen3-8B-GGUF.

Do not type owner/repo on its own. A name in that shape is read as an Ollama community model. Put hf: in front or paste the full link. Copy the right name from Hugging Face shows every place on the page you can copy from.

GGUF or safetensors: which runtime runs your model

Open Files and versions on the model page. The files decide how the model runs:

You see in the repoRuntime on BitsRunGood for
Single .gguf files named after their quant (...-Q4_K_M.gguf)llama.cppLow memory and good speed on one GPU. BitsRun uses Q4_K_M unless you add another, such as :Q8_0
.safetensors files with a config.json, chat modelvLLMMany users at once, tool calling for supported families
.safetensors files with a config.json, embedding modelText Embeddings InferenceSearch and RAG
GGUF files ending in -00001-of-00003.ggufNone yetSplit files are not supported. Find a repo with single-file quants
Only .bin or .pt filesNonePickle files can run code when loaded, so they are never used

As a measured example, Qwen3 8B FP8 on vLLM on one L4 writes about 29 tokens a second for one user and about 214 tokens a second in total with 8 users at once.

How to deploy a Hugging Face model

  1. Check the model. In the dashboard, open Endpoints, select New endpoint, paste the link in Model and select Check model. Or run:

    bash
    bitsrun size hf:unsloth/Qwen3-8B-GGUF

    You see the weight size, the GPU it fits, the runtime, the context it can read and whether tool calling works. Nothing is created and nothing is billed.

  2. Add your Hugging Face token (gated or private repos only). Accept the terms on the model page, create a read token at huggingface.co/settings/tokens, then run:

    bash
    bitsrun hf-token set

    It asks for the token without showing it. In the dashboard it is under API keys, then Hugging Face token. Details in Gated and private repos.

  3. Deploy. Select Create and start in the dashboard, or run:

    bash
    bitsrun deploy hf:unsloth/Qwen3-8B-GGUF --name "Support chat" --key

    The command prints the endpoint URL and, because of --key, an API key that only works with this endpoint. Save the key: it is shown once.

    For a gated or private repo, BitsRun first copies the files into your private storage and shows the progress. No GPU time is billed while it copies.

  4. Wait for the first start. The card shows each step: getting a GPU machine ready, downloading the model, loading it, then Running. On a new GPU machine this takes about 2 to 3 minutes for GGUF models and about 3 to 4 minutes for vLLM models. None of it is billed.

How to call your endpoint

Store the key in an environment variable, then send a request. Replace <endpoint-id> with the id from your endpoint URL:

bash
export BITSRUN_API_KEY="brk_your_key"

curl https://<endpoint-id>.endpoint.bitsrun.com/v1/chat/completions \
  -H "Authorization: Bearer $BITSRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "Qwen3-8B", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'

You get a normal OpenAI chat completion back. Any OpenAI SDK works too: set the base URL to https://<endpoint-id>.endpoint.bitsrun.com/v1 and the API key to your BitsRun key. See Call your endpoint.

If the endpoint is asleep, the request wakes it and waits on the open connection for up to 8 minutes, then answers. You do not need to retry.

What gets refused, and why

BitsRun never runs code that comes with a model, and serves text and embedding models only. Check model tells you before you pay anything.

CodeMeaningWhat to try
model_custom_codeThe repo needs its own Python code (trust_remote_code)A version that works without it, or a GGUF version
model_task_unsupportedNot a text or embedding model (image, speech, rerankers)A text generation or embedding model. Vision-language models are served as text only
model_split_unsupportedGGUF split into partsA repo with single-file quants
model_too_largeBigger than the largest GPU (4x L4, 96 GB)A lower quant such as Q4_K_M

Every reason is in Models that cannot be deployed.

How much does it cost to run a Hugging Face model

You pay for GPU time by the second, only while the model is ready or waiting before sleep. Starting and loading are free.

GPUPer secondPer hour
NVIDIA L4, 24 GB$0.000264$0.95
NVIDIA L40S, 48 GB$0.000889$3.20
4x NVIDIA L4, 96 GB$0.002367$8.52

Example: a support chat on an L4 answers questions for 10 minutes ($0.16), then waits 2 minutes before it sleeps ($0.03). The burst costs about $0.19.

Public repos are free to keep. Gated and private repos are copied into your storage, which is free up to 10 GB on Pay as you go, then $0.05 per GB a month. Not sure which GPU your model needs? The VRAM calculator and How much VRAM do you need to run an LLM explain it.

How this compares with Hugging Face Inference Endpoints

Hugging Face's own Inference Endpoints list a lower hourly price for the same GPUs (on 2026-11-14, $0.80 an hour for one L4 and $1.80 for one L40S on AWS) and run many more kinds of models. They bill by the minute while an endpoint is initializing or running. Scale to zero is optional and happens after 1 hour without requests by default (a schedule can set 15 minutes to 12 hours), and while a new replica starts, requests get 503 unless they send the X-Scale-Up-Timeout header. BitsRun bills by the second, never bills the start, can sleep after 60 seconds, and holds the first request open until the model answers. If your model runs all day, their hourly price is lower; if it runs in bursts, the shorter idle time and free starts can cost less.

If something goes wrong

Message or codeWhat to do
model_gatedAccept the terms on the repo page, add your Hugging Face token, deploy again
model_no_accessThe author has not approved your request yet. Wait for their email
model_choose_fileThe GGUF files are in folders. Open the .gguf file you want and paste its link
model_helper_fileThat file is a draft model, speed-up heads or a vision add-on. Paste the repo link and pick a size
credit_requiredCopying a gated repo needs a positive balance. Add credit first
unauthorizedSend Authorization: Bearer brk_... with a valid key

All codes are in Error codes.

Next step

Create your account and paste your first Hugging Face link. Related guides: Host a GGUF model as an OpenAI-compatible API, Deploy an Ollama model to the cloud, Self-hosted embeddings API and Serve a LoRA fine-tune as an API.

Frequently asked questions

Can I deploy any Hugging Face model?

You can deploy text generation and embedding models stored as single-file GGUF or as safetensors. Models that need their own Python code, pickle-only repos, split GGUF files and image, speech or reranking models are refused, and Check model says why before you pay.

Do I need a Hugging Face token?

Only for gated or private repos, such as Llama or Gemma. Accept the terms on the model page, create a read token on Hugging Face and save it once with bitsrun hf-token set or on the API keys page.

Which runtime will my model use?

GGUF files run on llama.cpp, safetensors chat models on vLLM and safetensors embedding models on Text Embeddings Inference. BitsRun picks it from the files in the repo.

How long does the first request take?

On a new GPU machine, about 2 to 3 minutes for GGUF models and 3 to 4 minutes for vLLM models; on a GPU that ran recently, a few seconds to about 40 seconds. The request waits up to 8 minutes on its own, and the start is never billed.

Is the API private?

Yes. Each endpoint has its own URL and only answers requests with one of your BitsRun API keys, and prompts and outputs are never logged.

Try it on your own model

Sign up with your email, add $10 of credit and deploy from an Ollama name or a Hugging Face repo. An L4 costs $0.95 an hour, billed per second only while your model is awake. Waking up is never billed, and credit you buy does not expire.