How to set up OpenClaw with Ollama on a VPS

Aug 07, 2026 06:08 PM - 1 week ago 336

How to group up OpenClaw pinch Ollama connected a VPS

To group up OpenClaw pinch Ollama connected a VPS, instal Ollama, link it to OpenClaw arsenic an AI exemplary provider, take a exemplary to run, and trial the relationship earlier securing the setup.

Pairing OpenClaw pinch Ollama lets you create private, autonomous AI agents that tally connected your ain server alternatively of a commercialized AI provider’s infrastructure.

Many group commencement utilizing OpenClaw pinch commercialized ample connection models (LLMs), specified arsenic OpenAI’s GPT aliases Anthropic’s Claude models. However, these providers complaint per token. Every punctual your supplier sends and each consequence it generates adds to your usage costs.

Using OpenClaw pinch Ollama offers a different approach. Ollama lets you tally open-source AI models connected your ain infrastructure. As a result, you only salary the hosting costs for OpenClaw and Ollama, specified arsenic the yearly interest of a virtual backstage server (VPS).

Follow these steps to tally OpenClaw pinch Ollama:

  1. Check and hole the strategy prerequisites.
  2. Install Ollama connected the aforesaid server arsenic OpenClaw aliases connected a abstracted server.
  3. Configure Ollama arsenic an AI exemplary supplier successful OpenClaw.
  4. Choose an Ollama exemplary to tally locally aliases entree done a distant Ollama server.
  5. Confirm that the relationship betwixt OpenClaw and Ollama works.
  6. Secure OpenClaw and Ollama connected your VPS.

How do OpenClaw and Ollama activity together?

OpenClaw and Ollama activity together by pairing an AI supplier gateway (OpenClaw) pinch a section AI exemplary runner (Ollama). This relationship lets OpenClaw usage Ollama to process prompts and tally backstage AI workflows without commercialized API fees.

When you nonstop a connection done Telegram, Slack, aliases different messaging transmission connected to OpenClaw, the OpenClaw Gateway (a inheritance process that manages messaging channels, supplier sessions, tools, and exemplary connections) forwards your petition to Ollama.

Ollama past processes the petition pinch your selected AI exemplary and sends the consequence backmost done the Gateway to the messaging app.

This workflow lets you interact pinch the AI supplier straight from your preferred messaging level without opening the OpenClaw aliases Ollama interface.

This setup offers 3 main advantages:

  • Greater privacy. Ollama tin process prompts and responses connected your ain infrastructure alternatively of sending them to a commercialized AI provider.
  • More predictable costs. You don’t salary per-token API fees, though you still request to screen server, electricity, and attraction costs.
  • More control. You tin take which supported exemplary to tally and negociate wherever OpenClaw stores and processes your data.

How to configure OpenClaw pinch Ollama connected a VPS

To configure OpenClaw pinch Ollama connected a VPS, cheque the strategy requirements, instal Ollama connected the VPS, configure Ollama successful OpenClaw, and take an AI model. Then, trial the relationship and unafraid your setup if needed.

1. Check the prerequisites

Before mounting up Ollama pinch OpenClaw connected your VPS, make judge you person a moving OpenClaw installation and capable RAM, CPU, and retention for your chosen AI model.

The array beneath lists the minimum and recommended server resources. Requirements alteration because larger Ollama models request much memory, processing power, and storage.

ResourceMinimumRecommended
RAM4 GB8–16 GB, depending connected the exemplary size
CPU1 vCPU2–4 vCPUs
Storage50 GB NVMe100 GB aliases much of NVMe storage for section exemplary files

If you don’t person a VPS to set up OpenClaw and Ollama, you tin acquisition 1 from a reliable supplier specified arsenic Hostinger.

Hostinger offers a preconfigured OpenClaw template, truthful you don’t request to instal OpenClaw manually done the command-line interface (CLI).

Simply take a VPS scheme based connected the assets requirements of the exemplary you want to run. After you complete the purchase, Hostinger will deploy the preconfigured OpenClaw situation for you.

2. Install Ollama connected your VPS

You tin install Ollama connected the aforesaid VPS arsenic OpenClaw, aliases connected a abstracted 1 to isolate assets usage and springiness Ollama entree to much powerful hardware.

The installation process is astir identical for some setups. First, update the package scale and instal curl:

sudo apt update && sudo apt instal curl -y

Then, tally Ollama’s charismatic installation script:

curl -fsSL https://ollama.com/install.sh | sh

Run the pursuing bid to corroborate that Ollama was installed successfully:

ollama --version
Ollama is successfully installed utilizing the installer script

The installation book configures Ollama arsenic a strategy service. Check its position with:

systemctl position ollama

If the work isn’t running, commencement it with:

sudo systemctl commencement ollama

You tin besides configure Ollama to commencement automatically erstwhile the server boots:

sudo systemctl alteration ollama

If you installed Ollama connected a abstracted VPS, statement its IP address. You’ll request it later erstwhile configuring Ollama arsenic the AI exemplary supplier successful OpenClaw. Hostinger VPS customers tin find the IP reside successful hPanel by going to VPS → Manage → Overview → IP.

The IP accusation connected hPanel's VPS

By default, Ollama listens for connections connected 127.0.0.1:11434, which intends only applications connected the aforesaid server tin entree it. To fto OpenClaw link from different VPS, configure Ollama to perceive connected the server’s web interface.

Open the Ollama systemd configuration editor:

sudo systemctl edit ollama

Add the pursuing configuration:

[Service] Environment="OLLAMA_HOST=0.0.0.0:11434"

Save the file. Then, reload systemd and restart Ollama:

sudo systemctl daemon-reload sudo systemctl restart ollama

Next, while still connected to the Ollama VPS, configure Uncomplicated Firewall (UFW) to let connections to larboard 11434 only from your OpenClaw VPS. Replace openclaw-vps-ip pinch the OpenClaw VPS IP address:

sudo ufw let from openclaw-vps-ip to immoderate larboard 11434 proto tcp

Check the firewall rules:

sudo ufw status

3. Configure the Ollama supplier successful OpenClaw

After installing Ollama, link it to OpenClaw arsenic the AI exemplary provider.

Important

Important! If you group up OpenClaw and Ollama connected abstracted VPSs, tally each commands successful this measurement connected your OpenClaw server, not connected the Ollama server.

Access the OpenClaw container:

docker exec -it your-openclaw-container bash

Once you’re wrong the container, commencement the onboarding tool:

openclaw onboard

The onboarding instrumentality guides you done the configuration. When prompted, prime Ollama arsenic the exemplary provider.

The Model/auth supplier action successful the OpenClaw onboarding tool

Then, take 1 of these deployment modes:

  • Ollama. Use some section and unreality models, pinch unreality models disposable arsenic a fallback for much demanding tasks.
  • Ollama Cloud. Use Ollama Cloud models without installing locally.

The instrumentality past asks for the Ollama big address. Enter the reside that matches your setup:

  • http://host.docker.internal:11434. Use this reside if Ollama runs connected the aforesaid VPS. It lets the OpenClaw instrumentality link to Ollama connected the big machine.
  • http://your-ollama-vps-ip:11434. Use this reside if Ollama runs connected a abstracted server. Replace your-ollama-vps-ip pinch the IP reside you noted during installation.

Skip this punctual if you chose Ollama Cloud, because OpenClaw connects straight to ollama.com.

If the onboarding bid doesn’t activity aliases you request to customize circumstantial settings, configure the relationship manually. Open the OpenClaw configuration record wrong the instrumentality pinch the nano matter editor:

nano ~/.openclaw/config.json{ "models": { "providers": { "ollama": { "baseUrl": "http://host.docker.internal:11434", "apiKey": "ollama-local", "api": "ollama", "models": [ { "id": "gemma4", "name": "gemma4", "input": ["text"], "params": { "num_ctx": 65536 } } ] } } } }

Adjust these settings based connected your setup:

  • baseUrl. Use http://host.docker.internal:11434 if Ollama runs connected the aforesaid VPS. If it runs connected a abstracted server, usage http://your-ollama-vps-ip:11434 instead.
  • Model sanction and API key. Replace gemma4 pinch the exemplary you want to use. For unreality models, switch ollama-local pinch your Ollama API cardinal and alteration the exemplary sanction to a unreality model, specified arsenic kimi-k3:cloud.
  • params.num_ctx. Set this worth to astatine slightest 65536 for section models. OpenClaw agents request astatine slightest 64,000 tokens of discourse to grip multi-step tasks without losing way of earlier steps. Cloud models negociate discourse automatically, truthful you tin region this mounting if you only usage unreality models.

Save the record by pressing Ctrl + X → Y → Enter. Then, restart the OpenClaw Gateway to use the changes:

openclaw gateway restart

Warning

Warning! Don’t append /v1 to the Ollama guidelines URL. The /v1 way activates OpenAI-compatible mode, which breaks instrumentality calling and tin origin the supplier to output earthy JSON arsenic plain matter alternatively of producing functional responses.

4. Choose an Ollama exemplary for OpenClaw

Choose a circumstantial Ollama exemplary for your agent. Your prime affects really good the supplier reasons, really quickly it responds, and really overmuch RAM it uses.

If OpenClaw and Ollama tally connected the aforesaid VPS, you tin tally these commands connected that server. If they tally connected abstracted VPSs, salary adjacent attraction to wherever you tally each command.

For section models, commencement by downloading the model. Run this bid connected the server wherever Ollama is installed:

ollama propulsion gemma4
The gemma4 exemplary pulling connected Ollama

Then, move to your OpenClaw VPS. If you’re not already wrong the container, participate it first, past group the model:

docker exec -it your-openclaw-container bash openclaw models group ollama/gemma4

For unreality models, tally these commands alternatively connected your OpenClaw server:

docker exec -it your-openclaw-container bash openclaw models group ollama/kimi-k3:cloud

If you chose a section model, trial it earlier checking the OpenClaw connection. On your Ollama server and tally the exemplary directly:

ollama tally gemma4

Start pinch a basal conversational prompt. Then, inquire the exemplary to complete a system task, specified arsenic formatting information into a circumstantial layout aliases pursuing a multi-step instruction.

The gemma4 exemplary moving connected Ollama

While the exemplary runs, monitor your VPS representation usage and consequence speed.

If the strategy becomes unstable aliases excessively slow to use, the exemplary is excessively ample for your server. Switch to a smaller section exemplary aliases a unreality exemplary earlier continuing.

5. Test the OpenClaw and Ollama connection

Verify that OpenClaw tin scope Ollama, nonstop prompts, and person responses. Run each these commands wrong the OpenClaw instrumentality isolated from the past one.

First, cheque that OpenClaw tin scope Ollama complete the network. Send a trial petition straight to the Ollama API:

curl http://host.docker.internal:11434/api/chat \    -d '{"model":"gemma4","messages":[{"role":"user","content":"Reply with: pong"}]}'

Replace host.docker.internal pinch your Ollama server’s IP reside if Ollama runs connected a abstracted VPS. Also, switch gemma4 pinch the exemplary you selected.

A JSON consequence containing “pong” confirms the web relationship works. If the petition fails, make judge the Ollama work is running, the firewall allows access, and the server reside is correct.

A JSON consequence containing "pong" utilizing curl

Next, verify that OpenClaw is configured correctly. Run a trial punctual done OpenClaw that bypasses the agent’s tools:

openclaw infer exemplary tally \    --model ollama/gemma4 \    --prompt "Reply pinch exactly: pong"

If this bid fails, cheque the baseUrl, api, and exemplary sanction settings successful ~/.openclaw/config.json.

Then, corroborate that the exemplary tin grip instrumentality calls. Enable a low-risk tool, specified arsenic record reading, past inquire the supplier to complete a task that requires it. For example, inquire the supplier to database the files successful a directory.

If the supplier completes the task correctly, your setup is working. If it makes up the consequence alternatively of calling the tool, the exemplary doesn’t reliably support OpenClaw’s tool-calling format. Pull a different exemplary and group it arsenic the progressive model.

After each 3 checks pass, verify the discourse model configuration connected your Ollama VPS:

ollama ps

The CONTEXT file should show 65536 aliases higher. If it shows 4096, the num_ctx mounting successful ~/.openclaw/config.json didn’t return effect. Update the value, prevention the file, and restart the OpenClaw Gateway.

6. Secure the Ollama API connected your VPS

If you installed Ollama connected a abstracted server, the firewall rules already restrict API entree to your OpenClaw VPS. For same-server setups, Ollama’s default 127.0.0.1 binding automatically blocks outer access.

The remaining interest is how unafraid OpenClaw is. When you alteration tools, the supplier tin publication files, tally commands, and nonstop messages connected your behalf.

A misunderstood instruction aliases malicious punctual tin origin existent harm if the supplier has unrestricted access.

Take these steps to unafraid OpenClaw:

  • Run the OpenClaw instrumentality nether a dedicated personification pinch constricted record strategy entree alternatively of moving it arsenic root.
  • Disable devices that your workflow doesn’t need, specified arsenic ammunition access, browser access, and record writing. Start pinch the minimum permissions required, past grow them only aft testing the workflow safely.
  • Enable support prompts for immoderate action that modifies files, sends messages, aliases runs commands. Review the instrumentality arguments successful the support prompt, not conscionable the instrumentality name, because the supplier tin telephone the correct instrumentality pinch unsafe parameters.
  • Review OpenClaw logs regularly for unexpected instrumentality calls, particularly aft tasks that produced different aliases incorrect results.

What are the champion Ollama models for OpenClaw?

The champion Ollama models for OpenClaw connected a VPS are unreality models for illustration kimi-k3:cloud and qwen3.5:cloud for analyzable supplier tasks, aliases section models for illustration gemma4 and qwen3.5 for greater information privacy.

The correct prime depends connected really overmuch RAM your VPS has, whether you request your information to enactment connected the server, and really reliably the exemplary handles OpenClaw’s instrumentality calls.

Here are immoderate recommended Ollama unreality models:

ModelContext windowBest for
kimi-k3:cloud1 cardinal tokensResearch, multimodal tasks, and agelong supplier workflows
kimi-k2.7-code:cloud256K tokensCoding and multi-step instrumentality use
qwen3.5:cloud256K tokensCoding, archive analysis, and image understanding
gemma4:cloud256K tokensGeneral reasoning, coding, and multimodal tasks

Cloud models are a applicable starting constituent for astir VPS users because Ollama runs the exemplary remotely alternatively of utilizing your server’s RAM and CPU.

Some recommended Ollama section models include:

ModelDownload sizeMaximum contextBest for
gemma49.6 GB128K tokensGeneral reasoning, coding, and supplier workflows
qwen3.56.6 GB256K tokensCoding, vision, and archive processing
qwen3-coder:30b19 GB256K tokens (natively), 1M tokens (extrapolation)Coding-focused supplier tasks

Local models tally wholly connected your VPS. Since astir VPS plans don’t see a dedicated GPU, they whitethorn respond much slow than unreality models, particularly during multi-step tasks. However, your prompts and responses enactment connected your server.

The maximum discourse file shows the highest worth each exemplary supports. The discourse model you tin usage successful believe depends connected your disposable RAM, exemplary version, quantization, and different moving services.

Best practices for moving OpenClaw pinch Ollama

Some of the best practices for moving OpenClaw pinch Ollama see preloading section models, utilizing circumstantial exemplary tags, backing up OpenClaw regularly, and testing different models arsenic your workflows go much complex.

  • Preload section models earlier important tasks. Ollama unloads models aft 5 minutes of inactivity by default. The adjacent petition whitethorn return longer while the exemplary reloads. Run ollama tally gemma4 “” connected your Ollama server earlier starting a time-sensitive task. You tin besides usage Ollama’s keep_alive mounting to support the exemplary loaded longer.
  • Use a circumstantial exemplary tag. When you configure OpenClaw aliases tally ollama pull, specify the nonstop exemplary tag you tested alternatively of relying connected the floating latest tag. This keeps your supplier connected the aforesaid exemplary type until you intentionally update it.
  • Back up OpenClaw regularly. Run openclaw backup create connected a schedule to backmost up your configuration, credentials, supplier state, and workspace data. Store the backup successful a unafraid location because it whitethorn incorporate delicate information. You tin besides verify a backup pinch openclaw backup verify.
  • Switch models erstwhile tasks go much complex. A exemplary that handles elemental prompts whitethorn struggle pinch agelong conversations aliases workflows that require respective instrumentality calls. Consider switching to a stronger exemplary erstwhile your existent 1 loses discourse aliases produces unreliable instrumentality calls. Test the candidates pinch your existent OpenClaw tasks alternatively of relying only connected exemplary size aliases benchmark scores.

How to troubleshoot communal OpenClaw and Ollama errors

To troubleshoot communal OpenClaw and Ollama errors, verify that OpenClaw tin scope the Ollama server, corroborate that some devices usage the aforesaid exemplary sanction and supplier URL, cheque the discourse window, and reappraisal the Ollama logs for representation aliases timeout issues.

  • OpenClaw can’t scope Ollama. Run the curl relationship trial wrong the OpenClaw container. If it returns “Connection refused,” move to the Ollama VPS and tally systemctl position ollama to corroborate that the work is running. If Ollama runs connected a abstracted VPS, make judge OLLAMA_HOST is group to 0.0.0.0:11434 and the firewall allows connections from the OpenClaw VPS IP reside to larboard 11434. After changing OLLAMA_HOST, restart Ollama pinch sudo systemctl restart ollama.
  • OpenClaw can’t find the model. On the Ollama VPS, tally ollama list to corroborate that you downloaded the model. Then, tally openclaw models database –provider ollama wrong the OpenClaw instrumentality to cheque which Ollama models OpenClaw recognizes. Make judge the exemplary sanction and tag lucifer exactly. For example, gemma4 uses the default latest tag, while gemma4:12b selects a circumstantial variant. After correcting the name, group the exemplary again pinch openclaw models group ollama/model-name.
  • The supplier outputs earthy JSON alternatively of calling tools. Inside the OpenClaw container, cheque whether the Ollama baseUrl ends pinch /v1. OpenClaw’s autochthonal Ollama supplier requires the guidelines URL without this suffix, specified arsenic http://host.docker.internal:11434 aliases http://your-ollama-ip:11434. Remove /v1, prevention the configuration, and restart the Gateway pinch openclaw gateway restart.
  • The supplier runs retired of discourse during multi-step tasks. On the Ollama VPS, tally ollama ps and cheque the CONTEXT column. If the worth is excessively debased for your workflow, tally openclaw config file wrong the OpenClaw instrumentality to find the progressive configuration file. Increase params.num_ctx, prevention the file, and restart the Gateway pinch openclaw gateway restart. Note that larger discourse windows usage much memory, truthful take a worth your server tin handle.
  • Ollama returns incomplete responses aliases stops unexpectedly. On the Ollama VPS, tally journalctl -u ollama –no-pager –follow –pager-end to position the work logs. If the logs bespeak representation pressure, trim the discourse model aliases move to a smaller model. If slow conclusion causes requests to clip out, summation the Ollama provider’s timeoutSeconds worth successful the OpenClaw configuration file. Then, restart the Gateway from the OpenClaw container.

How does moving Ollama comparison to utilizing outer AI APIs?

Running Ollama locally intends hosting open-source AI models connected your ain infrastructure, while Ollama Cloud and outer AI APIs tally models connected infrastructure managed by third-party providers.

The main tradeoff is greater power and information privateness versus easier scaling, faster setup, and little infrastructure maintenance.

FactorSelf-hosted OllamaOllama CloudExternal API, specified arsenic OpenAI aliases Anthropic
Model usage costNo per-token exemplary feesFree and paid plans pinch usage limitsUsually charged by input and output token usage
Infrastructure costVPS hosting and computing resourcesVPS hosting for OpenClawVPS hosting for OpenClaw
Data handlingPrompts and responses enactment connected your serverOllama processes prompts and responses temporarily successful the cloudThe API supplier processes prompts and responses according to its information policies
Model maintenanceYou negociate Ollama, exemplary files, updates, and server resourcesOllama manages the exemplary infrastructureThe API supplier manages the exemplary infrastructure
PerformanceDepends connected your VPS hardware and Ollama’s exemplary sizeOptimized by Ollama’s unreality infrastructureDepends connected the provider’s unreality infrastructure
ScalingUpgrade your VPS aliases adhd much serversManaged by Ollama wrong your scheme limitsManaged by the supplier wrong your relationship limits

Self-hosted Ollama removes per-token exemplary fees, but you’re responsible for installing and updating Ollama, managing exemplary files, and providing capable RAM, storage, and processing powerfulness connected your VPS.

Ollama doesn’t person your prompts aliases responses erstwhile you tally models locally.

With Ollama Cloud, the models tally connected distant infrastructure, truthful they don’t usage your VPS RAM aliases GPU. Ollama offers free and paid plans pinch different unreality usage limits.

According to Ollama’s privateness policy, it processes unreality prompts and responses temporarily to supply the service. Ollama says it doesn’t log this content, usage it for training, aliases clasp it aft processing.

External APIs specified arsenic OpenAI and Anthropic besides negociate the exemplary infrastructure. They mostly complaint different rates for input and output tokens, though pricing varies by exemplary and whitethorn see abstracted charges for devices aliases different features.

Ultimately, your prime affects the full cost of moving your existing OpenClaw setup. Self-hosted Ollama shifts much of the costs to VPS resources and maintenance, while unreality models and outer APIs adhd subscription aliases usage-based costs.

How to grow the OpenClaw and Ollama setup

You tin grow your OpenClaw and Ollama setup by adding models, connecting messaging channels, enabling web search, installing skills, and documenting your configuration arsenic a information net.

  • Add aliases move models. Run ollama propulsion model-name connected your Ollama server to download different section model. Then, tally openclaw models group ollama/model-name wrong the OpenClaw instrumentality to make it the default model. To usage an Ollama Cloud model, motion successful to Ollama and group the exemplary pinch openclaw models group ollama/cloud-model-name.
  • Connect a messaging channel. Run openclaw channels add wrong the OpenClaw container. Then, prime a transmission and participate the required credentials. Add 1 transmission astatine a time, and trial incoming and outgoing messages earlier connecting another. Hostinger customers tin travel our guideline connected connecting OpenClaw to Telegram and WhatsApp.
  • Enable web search. Run ollama signin connected your Ollama server, past tally openclaw config –section web wrong the OpenClaw container. Follow the prompts to prime and configure a hunt provider.
  • Add skills for circumstantial workflows. Run openclaw skills hunt “keyword” wrong the OpenClaw instrumentality to find a skill connected ClawHub. Install it pinch openclaw skills instal @owner/skill-name, past trial it pinch a low-risk task earlier giving it entree to delicate files, accounts, aliases commands.
  • Document your setup. Record the exemplary sanction and tag, Ollama big address, connected channels, enabled skills, firewall rules, and backup location. Store this accusation extracurricular the VPS truthful you tin entree it if you migrate the server aliases a faulty update makes the existent installation unusable.

All of the tutorial contented connected this website is taxable to Hostinger's rigorous editorial standards and values.

Author

The author

Ariffud Muhammad

Add arsenic Google Prefered Source

Ariffud is simply a Technical Content Writer pinch an acquisition inheritance successful Informatics. He has extended expertise successful Linux and VPS, authoring complete 200 articles connected server guidance and web development. Follow him connected LinkedIn.

More