bitsrun

Serve a LoRA fine-tune as an API

Serve a LoRA fine-tune as a private, OpenAI-compatible API. Choose between merged weights and adapters on one base model, with the real limits and costs.

Updated

On this page

You trained a LoRA fine-tune and now want to serve it as an API your app can call. This guide covers the two ways to do that on BitsRun: merge the LoRA into the base model and upload the result, or register the adapter and serve it next to the base model on one endpoint. Either way you end with a private, OpenAI-compatible URL that bills by the second, in about 15 minutes.

A LoRA adapter (low-rank adaptation) is a small set of extra weights that changes how a base model answers: your task, your tone, your format. It is far smaller than the model it changes.

Before you start

  • A BitsRun account with credit. Create your account and add credit from $10. Uploads and adapters need a positive balance, because the files are stored for you.
  • Your LoRA, saved by PEFT (adapter_config.json and adapter_model.safetensors), on Hugging Face or on your computer.
  • For the merged path: Python with transformers and peft installed, and enough disk space for the full model.
  • Optional: the bitsrun command line, installed with curl -fsSL https://get.bitsrun.com | sh, then bitsrun login.

Merged weights or adapters: which is better

Merged weights (upload)Adapters on Qwen3 8B
Base modelAny text or embedding model BitsRun can serveQwen3 8B only
What you uploadThe full model: a safetensors folder or one GGUF fileadapter_config.json and adapter_model.safetensors, up to 1 GB
RuntimevLLM (safetensors) or llama.cpp (GGUF)vLLM
Fine-tunes per endpointOneUp to 4, plus the base model
LimitsUp to 20 uploads per accountUp to 10 adapters per account; plain LoRA, rank up to 64
StorageThe full model sizeThe adapter size
Extra costStorage above your plan's free amountNone beyond storage; the endpoint's GPU price is the same

Choose adapters when your fine-tunes are on Qwen3 8B and you have more than one: a support tone, a JSON extractor and a summarizer can share one endpoint, one GPU and one bill. Pay as you go allows 2 endpoints, so this also keeps you within the plan.

Choose merged weights when your base model is anything other than Qwen3 8B, when you want a GGUF quant on llama.cpp for lower memory, or when your adapter uses something we do not serve as an adapter (DoRA, modules_to_save, rank above 64).

How to serve LoRA adapters on Qwen3 8B

What we accept, from LoRA adapters:

  • base_model_name_or_path in adapter_config.json is Qwen/Qwen3-8B (or a copy such as unsloth/Qwen3-8B).
  • Plain LoRA with rank (r) up to 64, on any of q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj and down_proj.
  • No DoRA, no prompt tuning, no modules_to_save, no per-layer settings. No .bin files.

Steps:

  1. Register the adapter. In the dashboard, open Adapters and select Register adapter. Type hf:owner/repo or paste the repo page, or choose Upload a folder and pick the folder PEFT saved. Only the two adapter files are sent. Select Register adapter. The row shows Ready, usually in under a minute.

  2. Deploy the base model. Run:

    bash
    bitsrun deploy hf:Qwen/Qwen3-8B-FP8 --name "Tuned Qwen" --key

    Or use New endpoint in the dashboard with hf:Qwen/Qwen3-8B-FP8. Save the API key the command prints: it is shown once.

  3. Add the adapters. On the endpoint card, select Performance, choose up to 4 ready adapters under Settings, then Review changes and Apply settings. The endpoint restarts on its next request with the new set. (For a new endpoint you can also choose them under Adapters right after Check model.)

  4. Copy the adapter id. It starts with lora- and is shown on the Adapters page, with a ready-made sample for your endpoint.

The adapters' memory comes out of the endpoint's context, so a long context may get a little shorter.

How to call an adapter

Send the adapter id as model. Replace <endpoint-id> with the id from your endpoint URL and <adapter-id> with the rest of the adapter id:

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": "lora-<adapter-id>", "messages": [{"role": "user", "content": "Hello"}]}'

Any other model name answers with the base Qwen3 8B, so one endpoint serves the base model and every adapter you added. With the OpenAI SDKs, set the base URL to https://<endpoint-id>.endpoint.bitsrun.com/v1 and pass the adapter id as model.

How to serve merged LoRA weights

Merging folds the LoRA into the base weights, so the result is a normal standalone model. PEFT's merge_and_unload() does it:

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base = "Qwen/Qwen3-8B"
adapter = "./my-lora"

model = AutoModelForCausalLM.from_pretrained(base, torch_dtype="auto")
model = PeftModel.from_pretrained(model, adapter)
model = model.merge_and_unload()

model.save_pretrained("./my-finetune")
AutoTokenizer.from_pretrained(base).save_pretrained("./my-finetune")

merge_and_unload() returns the merged model rather than changing it in place, so keep the returned value. Check that ./my-finetune holds config.json, the tokenizer files and .safetensors weights (not .bin).

  1. Upload and deploy the folder (it runs on vLLM):

    bash
    bitsrun deploy ./my-finetune --name "My fine-tune" --key

    The CLI uploads the folder, checks it and creates the endpoint. You can also use Or upload your own model on the New endpoint form.

  2. Or make a GGUF quant first (it runs on llama.cpp, with less memory). llama.cpp's quantize guide converts with convert_hf_to_gguf.py, then quantizes with llama-quantize. Run these from a built llama.cpp checkout:

    bash
    python convert_hf_to_gguf.py ./my-finetune --outfile my-finetune-bf16.gguf --outtype bf16
    ./build/bin/llama-quantize my-finetune-bf16.gguf my-finetune-Q4_K_M.gguf Q4_K_M
    bitsrun deploy ./my-finetune-Q4_K_M.gguf --name "My fine-tune" --key

Uploads must be one GGUF file (not split into parts) or a safetensors folder of up to 64 files, with no code or pickle files. Call the endpoint like any other, with any model name. See Upload your own model.

How much does it cost to serve a fine-tune

The GPU is billed by the second while the endpoint is awake. Starting and loading are free.

GPUPer hourFits (examples)
NVIDIA L4, 24 GB$0.95Qwen3 8B FP8 with adapters, an 8B fine-tune at Q4_K_M or in BF16
NVIDIA L40S, 48 GB$3.2014B fine-tunes in BF16, 32B at Q4_K_M
4x NVIDIA L4, 96 GB$8.5232B fine-tunes in BF16, 70B at Q4_K_M

Storage is free up to 10 GB on Pay as you go (200 GB on Pro, 1 TB on Business), then $0.05 per GB a month. A merged Qwen3 8B in BF16 is about 16.4 GB, so on Pay as you go it costs about 6.4 GB x $0.05 = $0.32 a month to keep. A Q4_K_M GGUF of the same model is about 5 GB and fits in the free amount. Adapters on your endpoint cost nothing extra.

Check sizes before you upload with the VRAM calculator and How much VRAM do you need to run an LLM, and the monthly bill with the cost calculator.

If something goes wrong

Message or codeWhat to do
adapter_wrong_baseThe adapter was not trained on Qwen3 8B. Train on Qwen/Qwen3-8B or merge and upload instead
adapter_rank_too_highTrain again with r at 64 or less, or merge and upload
adapter_endpoint_unsupportedAdapters need an endpoint from hf:Qwen/Qwen3-8B-FP8 or hf:Qwen/Qwen3-8B
adapter_not_foundCheck the lora- id and that the adapter is added to this endpoint
upload_is_adapterYou uploaded an adapter as a model. Register it on the Adapters page instead
upload_invalid_modelThe folder needs config.json and valid .safetensors weights
storage_quota_reachedDelete a model you no longer use, or move to a bigger plan

All codes are in Error codes.

Next step

Create your account and register your first adapter, or upload your merged model. Related guides: Run a Hugging Face model as a private API and Host a GGUF model as an OpenAI-compatible API.

Frequently asked questions

Which base models support LoRA adapters on BitsRun?

Today only Qwen3 8B, served by vLLM on an endpoint deployed from hf:Qwen/Qwen3-8B-FP8 or hf:Qwen/Qwen3-8B. For any other base model, merge the LoRA into the weights and upload the merged model.

How many adapters can one endpoint serve?

Up to 4 adapters per endpoint, next to the base model, and up to 10 adapters per account. Each request picks one by sending its lora- id as model.

Do adapters cost extra?

No. You pay the endpoint's GPU price by the second while it runs, as always. An adapter's files count toward your model storage, like an upload.

Should I merge my LoRA or serve it as an adapter?

Serve it as an adapter if it is a plain LoRA on Qwen3 8B, especially when you have several. Merge it when the base is another model, when you want a smaller GGUF quant, or when it uses DoRA, modules_to_save or a rank above 64.

Can I upload a LoRA adapter saved as .bin files?

No. Only adapter_model.safetensors is accepted, because pickle files can run code when loaded. Save the adapter again with PEFT, which writes safetensors by default.

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.