bitsrun

Deploy an Ollama model to the cloud as a private API

Deploy an Ollama model to the cloud as a private, OpenAI-compatible API in minutes. Use the same model name, pay per second only while it is awake.

Updated

On this page

You run a model with Ollama on your laptop and now your app needs to call it from a server. This guide shows how to deploy an Ollama model to the cloud as a private API, using the same name you already type, such as qwen3:8b. It takes about 10 minutes, and at the end you have an HTTPS address with an API key that answers like the OpenAI API (and like Ollama's own API).

Should you expose your laptop or a VPS instead?

Sometimes, yes. Here is the honest comparison.

Ollama binds to 127.0.0.1 port 11434 by default, so only your own machine can reach it. You can change that with the OLLAMA_HOST variable (Ollama FAQ), but then you are responsible for the rest: HTTPS, an API key check in front of it, keeping the machine on, and making sure strangers cannot find it.

OptionGood whenWatch out for
Your laptop or home GPUOnly you use it, from your own networkIt must stay on and online. Opening it to the internet safely takes a proxy, TLS and authentication you set up yourself
A rented GPU server, monthlyThe model is busy most hours of the dayYou pay every hour, used or not, and you run the updates and security
BitsRunTraffic comes in bursts, or you are not sure yet how much you will useA sleeping endpoint takes seconds to a few minutes to wake. Text and embedding models only, context up to 65,536 tokens

If your model answers requests around the clock, a flat-rate GPU server can be cheaper than paying by the second. An L4 kept awake every hour of a 30-day month on BitsRun costs about $684 ($0.95 an hour), so compare against that. If your traffic is spread over a few busy hours, paying only while the endpoint is awake usually wins.

Before you start

  • A BitsRun account with credit (from $10). Create your account, then add credit.
  • The Ollama name of your model, exactly as on its Ollama page, for example qwen3:8b or gemma3:12b.
  • For the terminal route: macOS, Linux or Windows with a shell.

How to deploy an Ollama model from the dashboard

  1. Open Endpoints and select New endpoint.
  2. In Model, type qwen3:8b. You can also write ollama:qwen3:8b.
  3. Select Check model. For qwen3:8b the green box says it has 5.2 GB of weights, fits an NVIDIA L4, runs on llama.cpp and remembers up to 40,960 tokens.
  4. Leave GPU on the suggested size. BitsRun picks the cheapest GPU that fits.
  5. Give it a Name, such as "Support chat", and keep Sleep after at 2 minutes for now.
  6. Select Create and start. The card shows each step, then Running: answering requests now.
  7. Select Copy on the dark bar of the card to copy the endpoint URL.

Ollama names are GGUF models and run on llama.cpp, the same engine Ollama uses under the hood. Community models work too, as user/model:tag. More in Model names you can deploy.

How to deploy an Ollama model with the bitsrun command

  1. Install the command line tool:

    bash
    curl -fsSL https://get.bitsrun.com | sh

    If the installer says ~/.local/bin is not on your PATH, run the line it prints and open a new terminal.

  2. Sign in through your browser:

    bash
    bitsrun login
  3. Deploy the model and create a key that works only with it:

    bash
    bitsrun deploy qwen3:8b --name "Support chat" --key

    You see the endpoint id, the GPU (1x L4 (24 GB)), the state sleeping and the URL. The API key starts with brk_ and is printed once, so save it now.

Want to check the size first without creating anything? bitsrun size qwen3:8b tells you the GPU and context and bills nothing.

How to call your Ollama model in the cloud

In the examples below, replace <endpoint-id> with the id from your endpoint URL, and set your key once:

bash
export BITSRUN_API_KEY="brk_your_key"

With curl

bash
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."}]}'

With the OpenAI SDK for Python

bash
pip install openai
python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://<endpoint-id>.endpoint.bitsrun.com/v1",
    api_key=os.environ["BITSRUN_API_KEY"],
)
reply = client.chat.completions.create(
    model="qwen3:8b",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(reply.choices[0].message.content)

The endpoint always serves its own model, so the model field can be any name. Keep the real one there so your logs stay readable.

With Ollama's own API

GGUF models, which includes every Ollama name, also answer Ollama's native API on the same host without /v1. If your code already uses the Ollama Python library, change the host and add your key as a header:

bash
pip install ollama
python
import os
from ollama import Client

client = Client(
    host="https://<endpoint-id>.endpoint.bitsrun.com",
    headers={"Authorization": f"Bearer {os.environ['BITSRUN_API_KEY']}"},
)
reply = client.chat(model="qwen3:8b", messages=[{"role": "user", "content": "Say hello in one sentence."}])
print(reply.message.content)

The chat, generate, embed and tags paths answer. Commands that change the server (pull, create, delete) do not. The ollama command line app cannot send the key header, so ollama run against your endpoint gets a 401. Details in Chat and completions.

What happens when the endpoint is asleep

After 2 minutes without requests (your Sleep after setting, from 60 seconds to 1 hour), the endpoint sleeps and billing stops. The next request wakes it:

SituationWait for the first answer
GGUF model on a warm GPU (ran recently)A few seconds to about 40 seconds
GGUF model on a new GPU machineAbout 2 to 3 minutes

The wait is never billed. Your request stays open for up to 8 minutes and then answers normally, so you do not need retry code. If you would rather get a quick 503 model_starting and retry yourself, send the header X-BitsRun-Wait: 0. To avoid the wait, select Start a few minutes early, choose a longer Sleep after, or turn on Always on. See Cold starts.

Once awake, speed depends on the model. In our own tests on one L4, Q4 builds of Llama 3.1 8B wrote about 46 to 50 tokens per second for a single user, and Gemma 3 12B about 31.

How much does it cost to run an Ollama model in the cloud?

You pay $0.000264 a second on an NVIDIA L4 ($0.95 an hour) while the endpoint is awake: answering, plus the Sleep after wait. Starting the GPU, loading the model and sleeping are free. There is no charge per token or per request.

Example: a small internal tool on qwen3:8b. People use it in 20 sessions a day. Each session keeps the model answering for 3 minutes, then it waits 2 minutes before sleeping.

20 sessions x (3 min + 2 min) = 100 min a day = 6,000 s
6,000 s x $0.000264 = $1.58 a day
30 days = about $47.52 a month

The same L4 kept always on costs about $1,180 a month. Ollama models and public Hugging Face repos are not stored in your account, so keeping the endpoint costs nothing while it sleeps. Try your own numbers in the cost calculator, and if you want a bigger model, check what fits first with the VRAM calculator or How much VRAM to run an LLM.

If something goes wrong

Message or codeWhat to do
"We could not find that model."Check the spelling and tag: qwen3:8b, not qwen3-8b.
401 unauthorizedSend Authorization: Bearer brk_.... The ollama app cannot send it; use a library or curl.
402 payment_requiredYour balance is $0. Add credit and the endpoint answers again within seconds.
model_startingThe start took longer than 8 minutes, or you sent X-BitsRun-Wait: 0. Send the request again.
400 context_too_longThe conversation is longer than the endpoint's memory length. Drop older messages.
429 rate_limitedToo many requests open at once for your plan (10 on Pay as you go). Retry after a short pause.

Every code is on Error codes.

Ready to try it with your own model? Create your account.

Frequently asked questions

Can I use the same model name I use in Ollama?

Yes. Type the name and tag from the model's Ollama page, such as qwen3:8b, in the dashboard or after bitsrun deploy. Community models work as user/model:tag.

Does my existing Ollama code still work?

Code that uses an Ollama library which can send an Authorization header works after you change the host to your endpoint and add your BitsRun key. The ollama command line app cannot send that header, so use the OpenAI API or a library instead.

How long does the first request take after the endpoint sleeps?

A few seconds to about 40 seconds on a GPU that ran recently, and about 2 to 3 minutes when a new GPU machine starts. That wait is never billed, and the request waits on the open connection, so you do not need to retry.

Are my prompts stored?

No. BitsRun never logs or stores your prompts or the model's answers, and each endpoint runs your model for you alone. See Privacy and your data.

When is a VPS or my own GPU the better choice?

When the model is busy most hours of every day, a flat-rate GPU server can cost less than paying by the second, and a GPU you already own costs nothing extra if only you use it. BitsRun fits best when traffic comes in bursts and you want HTTPS, keys and sleep handled for you.

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.