{"id":132114,"date":"2026-08-07T11:17:52","date_gmt":"2026-08-07T11:17:52","guid":{"rendered":"https:\/\/www.hostinger.com\/ph\/tutorials\/openclaw-ollama\/"},"modified":"2026-11-03T04:16:32","modified_gmt":"2026-11-03T04:16:32","slug":"openclaw-ollama","status":"publish","type":"post","link":"\/ph\/tutorials\/openclaw-ollama\/","title":{"rendered":"How to set up OpenClaw with Ollama on a VPS"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p class=\"wp-block-paragraph\">To set up OpenClaw with Ollama on a VPS, install Ollama, connect it to OpenClaw as an AI model provider, choose a model to run, and test the connection before securing the setup.<\/p><p class=\"wp-block-paragraph\">Pairing OpenClaw with Ollama lets you create private, autonomous AI agents that run on your own server instead of a commercial AI provider&rsquo;s infrastructure.<\/p><p class=\"wp-block-paragraph\">Many people start using OpenClaw with commercial large language models (LLMs), such as OpenAI&rsquo;s GPT or Anthropic&rsquo;s Claude models. However, these providers charge per token. Every prompt your agent sends and every response it generates adds to your usage costs.<\/p><p class=\"wp-block-paragraph\">An OpenClaw Ollama setup offers a different approach. Ollama lets you run open-source AI models on your own infrastructure. When you run models locally, you avoid per-token model API fees, but still pay infrastructure costs, such as hosting a virtual private server (VPS).<\/p><p class=\"wp-block-paragraph\">Follow these steps to run OpenClaw with Ollama:<\/p><ol class=\"wp-block-list\">\n<li>Check and prepare the system prerequisites.<\/li>\n\n\n\n<li>Install Ollama on the same server as OpenClaw or on a separate server.<\/li>\n\n\n\n<li>Configure Ollama as an AI model provider in OpenClaw.<\/li>\n\n\n\n<li>Choose an Ollama model to run locally or access through a remote Ollama server.<\/li>\n\n\n\n<li>Confirm that the connection between OpenClaw and Ollama works.<\/li>\n\n\n\n<li>Secure OpenClaw and Ollama on your VPS.<\/li>\n<\/ol><p class=\"wp-block-paragraph\"><\/p><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-how-do-openclaw-and-ollama-work-together\"><strong>How do OpenClaw and Ollama work together?<\/strong><\/h2><p class=\"wp-block-paragraph\">OpenClaw and Ollama work together by pairing an AI agent gateway (<a data-click-id=\"hgr-post-content-link-openclaw\" href=\"\/ph\/tutorials\/what-is-openclaw\/\">OpenClaw<\/a>) with a local AI model runner (Ollama). This connection lets OpenClaw use Ollama to process prompts and run private AI workflows without commercial API fees.<\/p><p class=\"wp-block-paragraph\">When you send a message through Telegram, Slack, or another messaging channel connected to OpenClaw, the OpenClaw Gateway (a background process that manages messaging channels, agent sessions, tools, and model connections) forwards your request to <a data-click-id=\"hgr-post-content-link-ollama\" href=\"\/ph\/tutorials\/what-is-ollama\/\">Ollama<\/a>.<\/p><p class=\"wp-block-paragraph\">Ollama then processes the request with your selected AI model and sends the response back through the Gateway to the messaging app.<\/p><p class=\"wp-block-paragraph\">This workflow lets you interact with the AI agent directly from your preferred messaging platform without opening the OpenClaw or Ollama interface.<\/p><p class=\"wp-block-paragraph\">This setup offers three main advantages:<\/p><ul class=\"wp-block-list\">\n<li><strong>Greater privacy.<\/strong> Ollama can process prompts and responses on your own infrastructure instead of sending them to a commercial AI provider.<\/li>\n\n\n\n<li><strong>More predictable costs.<\/strong> You don&rsquo;t pay per-token API fees, although you still need to cover server, electricity, and maintenance costs.<\/li>\n\n\n\n<li><strong>More control.<\/strong> You can choose which supported model to run and manage where OpenClaw stores and processes your data.<\/li>\n<\/ul><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-how-to-configure-openclaw-with-ollama-on-a-vps\"><strong>How to configure OpenClaw with Ollama on a VPS<\/strong><\/h2><p class=\"wp-block-paragraph\">To configure OpenClaw with Ollama on a VPS, check the system requirements, install Ollama on the VPS, configure Ollama in OpenClaw, and choose an AI model. Then, test the connection and secure your setup if needed.<\/p><h3 class=\"wp-block-heading h-t-title-3\"><strong>1. Check the prerequisites<\/strong><\/h3><p class=\"wp-block-paragraph\">Before setting up Ollama with OpenClaw, make sure you have a working OpenClaw installation. The resources you need depend on where Ollama runs and whether you use a local or cloud model.<\/p><ul class=\"wp-block-list\">\n<li><strong>Same VPS<\/strong>. Allow enough RAM, CPU, and storage for OpenClaw, Ollama, and your chosen local model.<\/li>\n\n\n\n<li><strong>Separate servers<\/strong>. Size the OpenClaw VPS for OpenClaw and the Ollama server for the local model. The OpenClaw VPS doesn&rsquo;t need to load the model itself.<\/li>\n\n\n\n<li><strong>Cloud models:<\/strong> Ollama runs the model remotely, so your VPS doesn&rsquo;t need enough RAM or storage to load the full model.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">For local <a data-click-id=\"hgr-post-content-link-ollama-models\" href=\"https:\/\/ollama.com\/library\" target=\"_blank\" rel=\"noopener\">Ollama models<\/a>, check the download size to plan storage. Note that RAM requirements also depend on the context window and other running services.<\/p><p class=\"wp-block-paragraph\">If you don&rsquo;t have a VPS to <a data-click-id=\"hgr-post-content-link-set-up-openclaw\" href=\"\/ph\/tutorials\/how-to-set-up-openclaw\/\">set up OpenClaw<\/a> and Ollama, you can purchase one from a reliable provider such as Hostinger.<\/p><p class=\"wp-block-paragraph\">Hostinger offers a <a data-click-id=\"hgr-post-content-link-preconfigured-openclaw-template\" href=\"\/ph\/applications\/openclaw\">preconfigured OpenClaw template<\/a>, so you don&rsquo;t need to install OpenClaw manually through the command-line interface (CLI).<\/p><p class=\"wp-block-paragraph\">Simply choose a VPS plan based on the resource requirements of the model you want to run. For reference, Hostinger&rsquo;s KVM 4 plan includes 16 GB of RAM. Check your model&rsquo;s memory use before selecting a plan, especially if OpenClaw and Ollama will share the same VPS.<\/p><p class=\"wp-block-paragraph\">After you complete the purchase, Hostinger will deploy the preconfigured OpenClaw environment for you.<\/p><figure class=\"wp-block-image size-large\"><a data-click-id=\"hgr-post-content-link-ph-vps-hosting\" aria-label=\"Vps hosting\" href=\"\/ph\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading h-t-title-3\"><strong>2. Install Ollama on your VPS<\/strong><\/h3><p class=\"wp-block-paragraph\">You can <a data-click-id=\"hgr-post-content-link-install-ollama\" href=\"\/ph\/tutorials\/how-to-install-ollama\/\">install Ollama<\/a> on the same VPS as OpenClaw, or on a separate one to isolate resource usage and give Ollama access to more powerful hardware.<\/p><p class=\"wp-block-paragraph\">The installation process is nearly identical for both setups. First, update the package index and install <a data-click-id=\"hgr-post-content-link-curl\" href=\"\/ph\/tutorials\/curl-command\/\">curl<\/a>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt update &amp;&amp; sudo apt install curl -y<\/pre><p class=\"wp-block-paragraph\">Then, run Ollama&rsquo;s official installation script:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -fsSL https:\/\/ollama.com\/install.sh | sh<\/pre><p class=\"wp-block-paragraph\">Run the following command to confirm that Ollama was installed successfully:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ollama --version<\/pre><p class=\"wp-block-paragraph\">The installation script configures Ollama as a system service. Check its status with:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl status ollama<\/pre><p class=\"wp-block-paragraph\">If the service isn&rsquo;t running, start it with:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl start ollama<\/pre><p class=\"wp-block-paragraph\">You can also configure Ollama to start automatically when the server boots:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl enable ollama<\/pre><p class=\"wp-block-paragraph\">If you installed Ollama on a separate VPS, note its IP address. You&rsquo;ll need it later when configuring Ollama as the AI model provider in OpenClaw. Hostinger VPS customers can find the IP address in Hostinger dashboard by going to <strong>VPS &rarr; Manage &rarr; Overview &rarr; IP<\/strong>.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6aeca726bd9c1\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6aeca726bd9c1\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2026\/08\/hpanel-vps-ip-highlighted.png\/w=1024,h=1024,fit=scale-down\" alt=\"The IP information on Hostinger dashboard's VPS\" class=\"wp-image-154214\" title=\"hpanel-vps-ip-highlighted\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" data-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.thisImage.buttonRight\" data-wp-style--top=\"state.thisImage.buttonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">By default, Ollama listens on <strong>127.0.0.1:11434<\/strong>, so only applications on the same server can access it. If OpenClaw runs on a separate VPS, first restrict access to the Ollama API with <a data-click-id=\"hgr-post-content-link-uncomplicated-firewall-ufw\" href=\"\/ph\/tutorials\/how-to-configure-firewall-on-ubuntu-using-ufw\/\">Uncomplicated Firewall (UFW)<\/a>. Then, configure Ollama to accept connections from the OpenClaw server.<\/p><p class=\"wp-block-paragraph\">Check whether UFW is installed and review its status and existing rules:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw status verbose<\/pre><p class=\"wp-block-paragraph\">If UFW isn&rsquo;t installed, install it with <strong>sudo apt install ufw<\/strong>.<\/p><p class=\"wp-block-paragraph\">Allow SSH access before enabling the firewall:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw allow OpenSSH<\/pre><p class=\"wp-block-paragraph\">This rule allows the default SSH port, <strong>22<\/strong>. If your server uses a custom SSH port, allow that port instead. Also allow any other services you need before enabling UFW.<\/p><p class=\"wp-block-paragraph\">Next, allow the OpenClaw VPS to connect to Ollama. Replace <strong>openclaw-vps-ip<\/strong> with the IP address your OpenClaw VPS uses to reach the Ollama server:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw allow from openclaw-vps-ip to any port 11434 proto tcp<\/pre><p class=\"wp-block-paragraph\">If UFW is inactive, enable it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw enable<\/pre><p class=\"wp-block-paragraph\">Check the firewall configuration again:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw status verbose<\/pre><p class=\"wp-block-paragraph\">Confirm that the status is <strong>active<\/strong>, the default incoming policy is <strong>deny<\/strong>, and the rule for port <strong>11434<\/strong> allows your OpenClaw VPS IP. Check for any broader rule that allows other IPs to access port <strong>11434<\/strong> and remove it before continuing.<\/p><p class=\"wp-block-paragraph\">Configure Ollama to accept network connections. Open its systemd configuration editor:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl edit ollama<\/pre><p class=\"wp-block-paragraph\">Add the following configuration:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[Service]\nEnvironment=\"OLLAMA_HOST=0.0.0.0:11434\"<\/pre><p class=\"wp-block-paragraph\">Save the file, then reload systemd and restart Ollama:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl daemon-reload\nsudo systemctl restart ollama<\/pre><p class=\"wp-block-paragraph\">The firewall limits which IP address can reach the API, but it doesn&rsquo;t encrypt traffic between the servers. Use a private network or VPN if the connection would otherwise pass over the public internet.<\/p><h3 class=\"wp-block-heading h-t-title-3\"><strong>3. Configure the Ollama provider in OpenClaw<\/strong><\/h3><p class=\"wp-block-paragraph\">After installing Ollama, connect it to OpenClaw as the AI model provider.<\/p><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                Important! If you set up OpenClaw and Ollama on separate VPSs, run all commands in this step on your OpenClaw server, not on the Ollama server.\n            <\/p><\/div>\n\n\n\n<\/p><p class=\"wp-block-paragraph\">On the OpenClaw VPS, list the running Docker containers:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker ps<\/pre><p class=\"wp-block-paragraph\">Find the OpenClaw container and copy its name from the <strong>NAMES<\/strong> column. Replace <strong>your-openclaw-container<\/strong> with that name to open a shell inside it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -it your-openclaw-container bash<\/pre><p class=\"wp-block-paragraph\">Once you&rsquo;re inside the container, start the onboarding tool:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">openclaw onboard<\/pre><p class=\"wp-block-paragraph\">The onboarding tool guides you through the configuration. When prompted, select <strong>Ollama<\/strong> as the model provider.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6aeca726c0c8d\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6aeca726c0c8d\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2026\/08\/terminal-openclaw-model-auth-provider-ollama-selected.png\/w=1024,h=1024,fit=scale-down\" alt=\"The Model\/auth provider selection in the OpenClaw onboarding tool\" class=\"wp-image-154218\" title=\"terminal-openclaw-model-auth-provider-ollama-selected\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" data-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.thisImage.buttonRight\" data-wp-style--top=\"state.thisImage.buttonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">Then, choose one of these deployment modes:<\/p><ul class=\"wp-block-list\">\n<li><strong>Ollama<\/strong>. Use both local and cloud models, with cloud models available as a fallback for more demanding tasks.<\/li>\n\n\n\n<li><strong>Ollama Cloud<\/strong>. Use Ollama Cloud models without installing locally.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">The tool then asks for the Ollama host address. Enter the address that matches your setup:<\/p><ul class=\"wp-block-list\">\n<li><strong>http:\/\/host.docker.internal:11434<\/strong>. Use this address if Ollama runs on the same VPS. It lets the OpenClaw container connect to Ollama on the host machine.<\/li>\n\n\n\n<li><strong>http:\/\/your-ollama-vps-ip:11434<\/strong>. Use this address if Ollama runs on a separate server. Replace <strong>your-ollama-vps-ip<\/strong> with the IP address you noted during installation.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">Skip this prompt if you chose <strong>Ollama Cloud<\/strong>, because OpenClaw connects directly to <strong>ollama.com<\/strong>.<\/p><p class=\"wp-block-paragraph\">If the onboarding command doesn&rsquo;t work or you need to customize specific settings, configure the connection manually. First, find the active configuration file by running this command inside the OpenClaw container.<\/p><blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">openclaw config file<\/pre>\n<\/blockquote><p class=\"wp-block-paragraph\">OpenClaw prints the configuration file path. Open that file with the <a data-click-id=\"hgr-post-content-link-nano-text-editor\" href=\"\/ph\/tutorials\/how-to-install-and-use-nano-text-editor\/\">nano text editor<\/a>, replacing <strong>path-to-config-file<\/strong> with the path from the output:<\/p><blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano path-to-config-file<\/pre>\n<\/blockquote><p class=\"wp-block-paragraph\">The default path is <strong>~\/.openclaw\/openclaw.json<\/strong>, but your setup may use a different location.<\/p><p class=\"wp-block-paragraph\">Add the following Ollama provider settings to the existing configuration. Preserve any settings already in the file, and merge the <strong>models<\/strong> and <strong>providers<\/strong> objects if they already exist:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n   \"models\": {\n      \"providers\": {\n         \"ollama\": {\n            \"baseUrl\": \"http:\/\/host.docker.internal:11434\",\n            \"apiKey\": \"ollama-local\",\n            \"api\": \"ollama\",\n            \"models\": [\n               {\n                  \"id\": \"gemma4\",\n                  \"name\": \"gemma4\",\n                  \"input\": [\"text\"],\n                  \"params\": {\n                     \"num_ctx\": 65536\n                  }\n               }\n            ]\n         }\n      }\n   }\n}\n<\/pre><p class=\"wp-block-paragraph\">Adjust these settings based on your setup:<\/p><ul class=\"wp-block-list\">\n<li><strong>baseUrl<\/strong>. Use <strong>http:\/\/host.docker.internal:11434<\/strong> if Ollama runs on the same VPS. If it runs on a separate server, use <strong>http:\/\/your-ollama-vps-ip:11434<\/strong> instead.<\/li>\n\n\n\n<li><strong>Model name and API key<\/strong>. Replace <strong>gemma4<\/strong> with the model you want to use. For cloud models, replace <strong>ollama-local<\/strong> with your Ollama API key and change the model name to a cloud model, such as <strong>kimi-k3:cloud<\/strong>.<\/li>\n\n\n\n<li><strong>params.num_ctx<\/strong>. Set this value to at least <strong>65536<\/strong> for local models. OpenClaw agents need at least <strong>64,000 tokens<\/strong> of context to handle multi-step tasks without losing track of earlier steps. Cloud models manage context automatically, so you can remove this setting if you only use cloud models.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">Save the file by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>. Then, restart the OpenClaw Gateway to apply the changes:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">openclaw gateway restart<\/pre><p>    <div class=\"announcement-block announcement-block--warning\">\n        <span class=\"announcement-block__heading\">\n            <svg width=\"24\" height=\"26\" viewBox=\"0 0 24 26\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                d=\"M12 23.5C17.799 23.5 22.5 18.799 22.5 13C22.5 7.20101 17.799 2.5 12 2.5C6.20101 2.5 1.5 7.20101 1.5 13C1.5 18.799 6.20101 23.5 12 23.5ZM13.637 8.65198C13.637 7.74791 12.9041 7.01501 12 7.01501C11.0959 7.01501 10.363 7.74791 10.363 8.65198C10.5335 10.5375 10.875 14.383 10.875 14.383C10.875 15.0043 11.3787 15.508 12 15.508C12.6213 15.508 13.125 15.0043 13.125 14.383V14.38L13.637 8.65198ZM11.9927 16.714C11.3714 16.714 10.8677 17.2177 10.8677 17.839C10.8677 18.4603 11.3714 18.964 11.9927 18.964H12.0073C12.6286 18.964 13.1323 18.4603 13.1323 17.839C13.1323 17.2177 12.6286 16.714 12.0073 16.714H11.9927Z\"\n                fill=\"#BE1025\"\/>\n            <\/svg>\n            Warning        <\/span>\n        <p class=\"announcement-block__content\">\n            <strong>Warning!<\/strong> Don&rsquo;t append <strong>\/v1<\/strong> to the Ollama base URL. The <strong>\/v1<\/strong> path activates OpenAI-compatible mode, which breaks tool calling and can cause the agent to output raw JSON as plain text instead of producing functional responses.        <\/p>\n    <\/div>\n\n    \n\n\n\n<\/p><h3 class=\"wp-block-heading h-t-title-3\"><strong>4. Choose an Ollama model for OpenClaw<\/strong><\/h3><p class=\"wp-block-paragraph\">Choose a specific Ollama model for your agent. Your pick affects how well the agent reasons, how quickly it responds, and how much RAM it uses.<\/p><p class=\"wp-block-paragraph\">If OpenClaw and Ollama run on the same VPS, you can run these commands on that server. If they run on separate VPSs, pay close attention to where you run each command.<\/p><p class=\"wp-block-paragraph\">For local models, start by downloading the model. Run this command on the server where Ollama is installed:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ollama pull gemma4<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6aeca726c52e0\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6aeca726c52e0\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2026\/08\/terminal-ollama-pull-gemma4.jpg\/w=1024,h=1024,fit=scale-down\" alt=\"The gemma4 model pulling on Ollama\" class=\"wp-image-154215\" title=\"terminal-ollama-pull-gemma4\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" data-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.thisImage.buttonRight\" data-wp-style--top=\"state.thisImage.buttonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">Then, switch to your OpenClaw VPS. If you&rsquo;re not already inside the container, enter it first, then set the model:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -it your-openclaw-container bash\nopenclaw models set ollama\/gemma4<\/pre><p class=\"wp-block-paragraph\">For cloud models, run these commands instead on your OpenClaw server:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -it your-openclaw-container bash\nopenclaw models set ollama\/kimi-k3:cloud<\/pre><p class=\"wp-block-paragraph\"><\/p><p class=\"wp-block-paragraph\">If you chose a local model, test it before checking the OpenClaw connection. Run the model directly on the server where Ollama is installed:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ollama run gemma4<\/pre><p class=\"wp-block-paragraph\">Start with a basic conversational prompt. Then, ask the model to complete a structured task, such as formatting data into a specific layout or following a multi-step instruction.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6aeca726d7849\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6aeca726d7849\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2026\/08\/terminal-ollama-run-gemma4.jpg\/w=1024,h=1024,fit=scale-down\" alt=\"The gemma4 model running on Ollama\" class=\"wp-image-154216\" title=\"terminal-ollama-run-gemma4\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" data-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.thisImage.buttonRight\" data-wp-style--top=\"state.thisImage.buttonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">While the model runs, <a data-click-id=\"hgr-post-content-link-monitor-your-vps-memory-usage\" href=\"\/ph\/tutorials\/how-to-monitor-vps-performance\/\">monitor your VPS memory usage<\/a> and response speed.<\/p><p class=\"wp-block-paragraph\">If the system becomes unstable or too slow to use, the model is too large for your server. Switch to a smaller local model or a cloud model before continuing.<\/p><h3 class=\"wp-block-heading h-t-title-3\"><strong>5. Test the OpenClaw and Ollama connection<\/strong><\/h3><p class=\"wp-block-paragraph\">Verify that OpenClaw can reach Ollama, send prompts, and receive responses. Run all these commands inside the OpenClaw container except the last one.<\/p><p class=\"wp-block-paragraph\">First, check that OpenClaw can reach Ollama over the network. Send a test request directly to the <strong>Ollama API<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl http:\/\/host.docker.internal:11434\/api\/chat -d '{\"model\":\"gemma4\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with: pong\"}]}'<\/pre><p class=\"wp-block-paragraph\">Replace <strong>host.docker.internal<\/strong> with your Ollama server&rsquo;s IP address if Ollama runs on a separate VPS. Also, replace <strong>gemma4<\/strong> with the model you selected.<\/p><p class=\"wp-block-paragraph\">A JSON response containing &ldquo;pong&rdquo; confirms the network connection works. If the request fails, make sure the Ollama service is running, the firewall allows access, and the server address is correct.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6aeca726da5f3\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6aeca726da5f3\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2026\/08\/terminal-openclaw-curl-pong.jpg\/w=1024,h=1024,fit=scale-down\" alt='A JSON response containing \"pong\" using curl' class=\"wp-image-154217\" title=\"terminal-openclaw-curl-pong\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" data-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.thisImage.buttonRight\" data-wp-style--top=\"state.thisImage.buttonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">Next, verify that OpenClaw is configured correctly. Run a test prompt through OpenClaw that bypasses the agent&rsquo;s tools:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">openclaw infer model run --model ollama\/gemma4 --prompt \"Reply with exactly: pong\"<\/pre><p class=\"wp-block-paragraph\">Replace <strong>gemma4<\/strong> with the model you selected before.<\/p><p class=\"wp-block-paragraph\">If this command fails, check the <strong>baseUrl<\/strong>, <strong>api<\/strong>, and model name settings in the OpenClaw configuration file you located before.<\/p><p class=\"wp-block-paragraph\">Then, confirm that the model can handle tool calls. Enable a low-risk tool, such as file reading, then ask the agent to complete a task that requires it. For example, ask the agent to list the files in a directory.<\/p><p class=\"wp-block-paragraph\">If the agent completes the task correctly, your setup is working. If it makes up the result instead of calling the tool, the model doesn&rsquo;t reliably support OpenClaw&rsquo;s tool-calling format. Pull a different model and set it as the active model.<\/p><p class=\"wp-block-paragraph\">After all three checks pass, verify the context window configuration on your Ollama VPS:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ollama ps<\/pre><p class=\"wp-block-paragraph\">Check the <strong>CONTEXT<\/strong> column against the context window you configured for the model. If it shows a lower value than expected, review the <strong>params.num_ctx<\/strong> setting in the OpenClaw configuration file you located previously.<\/p><h3 class=\"wp-block-heading h-t-title-3\"><strong>6. Secure the Ollama API on your VPS<\/strong><\/h3><p class=\"wp-block-paragraph\">If you installed Ollama on a separate server, confirm that its firewall allows API connections only from your OpenClaw VPS. Use a private network or VPN to protect traffic between the servers.<\/p><p class=\"wp-block-paragraph\">If both tools run on the same server, keep Ollama bound to <strong>127.0.0.1<\/strong> when your OpenClaw setup can reach it there. Check the container&rsquo;s network configuration if the connection fails.<\/p><p class=\"wp-block-paragraph\">The remaining concern is <a data-click-id=\"hgr-post-content-link-how-secure-openclaw-is\" href=\"\/ph\/tutorials\/openclaw-security\/\">how secure OpenClaw is<\/a>. When you enable tools, the agent can read files, run commands, and send messages on your behalf.<\/p><p class=\"wp-block-paragraph\">A misunderstood instruction or malicious prompt can cause real damage if the agent has unrestricted access.<\/p><p class=\"wp-block-paragraph\">Take these steps to secure OpenClaw:<\/p><ul class=\"wp-block-list\">\n<li>Run the OpenClaw container under a dedicated user with limited file system access instead of running it as root.<\/li>\n\n\n\n<li>Disable tools that your workflow doesn&rsquo;t need, such as shell access, browser access, and file writing. Start with the minimum permissions required, then expand them only after testing the workflow safely.<\/li>\n\n\n\n<li>Enable approval prompts for any action that modifies files, sends messages, or runs commands. Review the tool arguments in the approval prompt, not just the tool name, because the agent can call the correct tool with unsafe parameters.<\/li>\n\n\n\n<li>Review OpenClaw logs regularly for unexpected tool calls, especially after tasks that produced unusual or incorrect results.<\/li>\n<\/ul><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-what-are-the-best-ollama-models-for-openclaw\"><strong>What are the best Ollama models for OpenClaw?<\/strong><\/h2><p class=\"wp-block-paragraph\">The best Ollama models for OpenClaw on a VPS include cloud models such as <strong>kimi-k3:cloud<\/strong> and <strong>glm-5.3:cloud<\/strong> for complex agent tasks, and local models such as <strong>gemma4<\/strong> and <strong>qwen3.5<\/strong> for processing prompts on your own server.<\/p><p class=\"wp-block-paragraph\">The right choice depends on how much RAM your VPS has, whether you need your data to stay on the server, and how reliably the model handles OpenClaw&rsquo;s tool calls.<\/p><p class=\"wp-block-paragraph\">Here are some recommended Ollama cloud models:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Model<\/strong><\/td><td><strong>Context window<\/strong><\/td><td><strong>Best for<\/strong><\/td><\/tr><tr><td><strong>kimi-k3:cloud<\/strong><\/td><td>1 million tokens<\/td><td>Research, multimodal tasks, and long agent workflows<\/td><\/tr><tr><td><strong>kimi-k2.7-code:cloud<\/strong><\/td><td>256K tokens<\/td><td>Coding and multi-step tool use<\/td><\/tr><tr><td><strong>glm-5.3:cloud<\/strong><\/td><td>1 million tokens<\/td><td>Coding and long-running agent workflows<\/td><\/tr><tr><td><strong>gemma4:cloud<\/strong><\/td><td>256K tokens<\/td><td>General reasoning, coding, and multimodal tasks<\/td><\/tr><\/tbody><\/table><\/figure><p class=\"wp-block-paragraph\">Cloud models are a practical starting point for most VPS users because Ollama runs the model remotely instead of using your server&rsquo;s RAM and CPU.<\/p><p class=\"wp-block-paragraph\">Some recommended Ollama local models include:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Model<\/strong><\/td><td><strong>Download size<\/strong><\/td><td><strong>Maximum context<\/strong><\/td><td><strong>Best for<\/strong><\/td><\/tr><tr><td><strong>gemma4:e4b<\/strong><\/td><td>Approximately 6.6&ndash;9.5 GB, depending on the format<\/td><td>128K tokens<\/td><td>General reasoning, coding, and agent workflows<\/td><\/tr><tr><td><strong>qwen3.5:9b<\/strong><\/td><td>Approximately 6.6&ndash;7.6 GB, depending on the format<\/td><td>256K tokens<\/td><td>Coding, vision, and document processing<\/td><\/tr><tr><td><strong>qwen3-coder:30b<\/strong><\/td><td>Approximately 19 GB<\/td><td>256K tokens (natively), 1M tokens (extrapolation)<\/td><td>Coding-focused agent tasks<\/td><\/tr><\/tbody><\/table><\/figure><p class=\"wp-block-paragraph\">Local models run entirely on your VPS. Since most VPS plans don&rsquo;t include a dedicated GPU, they may respond more slowly than cloud models, especially during multi-step tasks. However, your prompts and responses stay on your server.<\/p><p class=\"wp-block-paragraph\">Download size refers to storage space, not total RAM requirements. On a CPU-only server, Ollama uses system RAM to run the model, with additional memory needed for the context window and other processes.<\/p><p class=\"wp-block-paragraph\">The maximum context column shows the model&rsquo;s supported limit. Your server may need a smaller context window to fit within its available memory. These requirements apply to the server running Ollama, whether it shares a VPS with OpenClaw or runs separately.<\/p><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-best-practices-for-running-openclaw-with-ollama\"><strong>Best practices for running OpenClaw with Ollama<\/strong><\/h2><p class=\"wp-block-paragraph\">Some of the <a data-click-id=\"hgr-post-content-link-best-practices-for-running-openclaw\" href=\"\/ph\/tutorials\/openclaw-best-practices\/\">best practices for running OpenClaw<\/a> with Ollama include preloading local models, using specific model tags, backing up OpenClaw regularly, and testing other models as your workflows become more complex.<\/p><ul class=\"wp-block-list\">\n<li><strong>Preload local models before important tasks.<\/strong> Ollama unloads models after five minutes of inactivity by default. The next request may take longer while the model reloads. Run <strong><code>ollama run gemma4 \"\"<\/code><\/strong> on your Ollama server before starting a time-sensitive task. You can also use Ollama&rsquo;s <strong>keep_alive<\/strong> setting to keep the model loaded longer.<\/li>\n\n\n\n<li><strong>Use a specific model tag.<\/strong> When you configure OpenClaw or run <strong>ollama pull<\/strong>, specify the exact model tag you tested instead of relying on the floating <strong>latest<\/strong> tag. This keeps your agent on the same model version until you intentionally update it.<\/li>\n\n\n\n<li><strong>Back up OpenClaw regularly.<\/strong> Run <strong>openclaw backup create<\/strong> on a schedule to back up your configuration, credentials, agent state, and workspace data. Store the backup in a secure location because it may contain sensitive information. You can also verify a backup with <strong>openclaw backup verify<\/strong>.<\/li>\n\n\n\n<li><strong>Switch models when tasks become more complex<\/strong>. A model that handles simple prompts may struggle with long conversations or workflows that require several tool calls. Consider switching to a stronger model when your current one loses context or produces unreliable tool calls. Test the candidates with your actual OpenClaw tasks instead of relying only on model size or benchmark scores.<\/li>\n<\/ul><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-how-to-troubleshoot-common-openclaw-and-ollama-errors\"><strong>How to troubleshoot common OpenClaw and Ollama errors<\/strong><\/h2><p class=\"wp-block-paragraph\">To troubleshoot common OpenClaw and Ollama errors, verify that OpenClaw can reach the Ollama server, confirm that both tools use the same model name and provider URL, check the context window, and review the Ollama logs for memory or timeout issues.<\/p><ul class=\"wp-block-list\">\n<li><strong>OpenClaw can&rsquo;t reach Ollama.<\/strong> Run the <strong>curl<\/strong> connection test inside the OpenClaw container. If it returns <strong>&ldquo;Connection refused,&rdquo;<\/strong> switch to the Ollama VPS and run <strong>systemctl status ollama<\/strong> to confirm that the service is running. If Ollama runs on a separate VPS, make sure <strong>OLLAMA_HOST<\/strong> is set to <strong>0.0.0.0:11434<\/strong> and the firewall allows connections from the OpenClaw VPS IP address to port <strong>11434<\/strong>. After changing <strong>OLLAMA_HOST<\/strong>, restart Ollama with <strong>sudo systemctl restart ollama<\/strong>.<\/li>\n\n\n\n<li><strong>OpenClaw can&rsquo;t find the model.<\/strong> On the Ollama VPS, run <strong>ollama list<\/strong> to confirm that you downloaded the model. Then, run <strong><code>openclaw models list --provider ollama<\/code><\/strong> inside the OpenClaw container to check which Ollama models OpenClaw recognizes. Make sure the model name and tag match exactly. For example, <strong>gemma4<\/strong> uses the default <strong>latest<\/strong> tag, while <strong>gemma4:12b<\/strong> selects a specific variant. After correcting the name, set the model again with <strong>openclaw models set ollama\/model-name<\/strong>.<\/li>\n\n\n\n<li><strong>The agent outputs raw JSON instead of calling tools.<\/strong> Inside the OpenClaw container, check whether the Ollama <strong>baseUrl<\/strong> ends with <strong>\/v1<\/strong>. OpenClaw&rsquo;s native Ollama provider requires the base URL without this suffix, such as <strong>http:\/\/host.docker.internal:11434<\/strong> or <strong>http:\/\/your-ollama-ip:11434<\/strong>. Remove <strong>\/v1<\/strong>, save the configuration, and restart the Gateway with <strong>openclaw gateway restart<\/strong>.<\/li>\n\n\n\n<li><strong>The agent runs out of context during multi-step tasks.<\/strong> On the Ollama VPS, run <strong>ollama ps<\/strong> and check the <strong>CONTEXT<\/strong> column. If the value is too low for your workflow, run <strong>openclaw config file<\/strong> inside the OpenClaw container to locate the active configuration file. Increase <strong>params.num_ctx<\/strong>, save the file, and restart the Gateway with <strong>openclaw gateway restart<\/strong>. Note that larger context windows use more memory, so choose a value your server can handle.<\/li>\n\n\n\n<li><strong>Ollama returns incomplete responses or stops unexpectedly.<\/strong> On the Ollama VPS, run <strong><code>journalctl -u ollama --no-pager --follow --pager-end<\/code><\/strong> to view the service logs. If the logs indicate memory pressure, reduce the context window or switch to a smaller model. If slow inference causes requests to time out, increase the Ollama provider&rsquo;s <strong>timeoutSeconds<\/strong> value in the OpenClaw configuration file. Then, restart the Gateway from the OpenClaw container.<\/li>\n<\/ul><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-how-does-running-ollama-compare-to-using-external-ai-apis\"><strong>How does running Ollama compare to using external AI APIs?<\/strong><\/h2><p class=\"wp-block-paragraph\">Running Ollama locally means hosting open-source AI models on your own infrastructure, while Ollama Cloud and external AI APIs run models on infrastructure managed by third-party providers.<\/p><p class=\"wp-block-paragraph\">The main tradeoff is greater control and data privacy versus easier scaling, faster setup, and less infrastructure maintenance.<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Factor<\/strong><\/td><td><strong>Self-hosted Ollama<\/strong><\/td><td><strong>Ollama Cloud<\/strong><\/td><td><strong>External API, such as OpenAI or Anthropic<\/strong><\/td><\/tr><tr><td>Model usage cost<\/td><td>No per-token model fees<\/td><td>Free and paid plans with usage limits<\/td><td>Usually charged by input and output token usage<\/td><\/tr><tr><td>Infrastructure cost<\/td><td>VPS hosting and computing resources<\/td><td>VPS hosting for OpenClaw<\/td><td>VPS hosting for OpenClaw<\/td><\/tr><tr><td>Data handling<\/td><td>Prompts and responses stay on your server<\/td><td>Ollama processes prompts and responses temporarily in the cloud<\/td><td>The API provider processes prompts and responses according to its data policies<\/td><\/tr><tr><td>Model maintenance<\/td><td>You manage Ollama, model files, updates, and server resources<\/td><td>Ollama manages the model infrastructure<\/td><td>The API provider manages the model infrastructure<\/td><\/tr><tr><td>Performance<\/td><td>Depends on your VPS hardware and Ollama&rsquo;s model size<\/td><td>Optimized by Ollama&rsquo;s cloud infrastructure<\/td><td>Depends on the provider&rsquo;s cloud infrastructure<\/td><\/tr><tr><td>Scaling<\/td><td>Upgrade your VPS or add more servers<\/td><td>Managed by Ollama within your plan limits<\/td><td>Managed by the provider within your account limits<\/td><\/tr><\/tbody><\/table><\/figure><p class=\"wp-block-paragraph\">Self-hosted Ollama removes per-token model fees, but you&rsquo;re responsible for installing and updating Ollama, managing model files, and providing enough RAM, storage, and processing power on your VPS.<\/p><p class=\"wp-block-paragraph\">Ollama doesn&rsquo;t receive your prompts or responses when you run models locally.<\/p><p class=\"wp-block-paragraph\">With Ollama Cloud, the models run on remote infrastructure, so they don&rsquo;t use your VPS RAM or GPU. Ollama offers free and paid plans with different cloud usage limits.<\/p><p class=\"wp-block-paragraph\">According to <a data-click-id=\"hgr-post-content-link-ollamas-privacy-policy\" href=\"https:\/\/ollama.com\/privacy\" target=\"_blank\" rel=\"noopener\">Ollama&rsquo;s privacy policy<\/a>, it processes cloud prompts and responses temporarily to provide the service. Ollama says it doesn&rsquo;t log this content, use it for training, or retain it after processing.<\/p><p class=\"wp-block-paragraph\">External APIs such as OpenAI and Anthropic also manage the model infrastructure. They generally charge different rates for input and output tokens, although pricing varies by model and may include separate charges for tools or other features.<\/p><p class=\"wp-block-paragraph\">Ultimately, your choice affects the total <a data-click-id=\"hgr-post-content-link-cost-of-running-your-existing-openclaw-setup\" href=\"\/ph\/tutorials\/openclaw-costs\/\">cost of running your existing OpenClaw setup<\/a>. Self-hosted Ollama shifts more of the cost to VPS resources and maintenance, while cloud models and external APIs add subscription or usage-based costs.<\/p><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-how-to-expand-the-openclaw-and-ollama-setup\"><strong>How to expand the OpenClaw and Ollama setup<\/strong><\/h2><p class=\"wp-block-paragraph\">You can expand your OpenClaw and Ollama setup by adding models, connecting messaging channels, enabling web search, installing skills, and documenting your configuration as a safety net.<\/p><ul class=\"wp-block-list\">\n<li><strong>Add or switch models.<\/strong> Run <strong>ollama pull model-name<\/strong> on your Ollama server to download another local model. Then, run <strong>openclaw models set ollama\/model-name<\/strong> inside the OpenClaw container to make it the default model. To use an Ollama Cloud model, sign in to Ollama and set the model with <strong>openclaw models set ollama\/cloud-model-name<\/strong>.<\/li>\n\n\n\n<li><strong>Connect a messaging channel.<\/strong> Run <strong>openclaw channels add<\/strong> inside the OpenClaw container. Then, select a channel and enter the required credentials. Add one channel at a time, and test incoming and outgoing messages before connecting another. Hostinger customers can follow our guide on <a data-click-id=\"hgr-post-content-link-connecting-openclaw-to-telegram-and-whatsapp\" href=\"\/support\/how-to-connect-and-troubleshoot-telegram-and-whatsapp-channels-in-openclaw-on-hostinger-vps\/\">connecting OpenClaw to Telegram and WhatsApp<\/a>.<\/li>\n\n\n\n<li><strong>Enable web search.<\/strong> Run <strong>ollama signin<\/strong> on your Ollama server, then run <strong><code>openclaw config --section web<\/code><\/strong> inside the OpenClaw container. Follow the prompts to select and configure a search provider.<\/li>\n\n\n\n<li><strong>Add skills for specific workflows.<\/strong> Run <strong><code>openclaw skills search \"keyword\"<\/code><\/strong> inside the OpenClaw container to find a <a data-click-id=\"hgr-post-content-link-skill-on-clawhub\" href=\"\/ph\/tutorials\/openclaw-skills\/\">skill on ClawHub<\/a>. Install it with <strong>openclaw skills install @owner\/skill-name<\/strong>, then test it with a low-risk task before giving it access to sensitive files, accounts, or commands.<\/li>\n\n\n\n<li><strong>Document your setup.<\/strong> Record the model name and tag, Ollama host address, connected channels, enabled skills, firewall rules, and backup location. Store this information outside the VPS so you can access it if you migrate the server or a faulty update makes the current installation unusable.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To set up OpenClaw with Ollama on a VPS, install Ollama, connect it to OpenClaw as an AI model provider, choose a model to run, and test the connection before securing the setup. Pairing OpenClaw with Ollama lets you create private, autonomous AI agents that run on your own server instead of a commercial AI [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ph\/tutorials\/openclaw-ollama\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":137916,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"OpenClaw Ollama setup: Run local AI models on a VPS","rank_math_description":"OpenClaw Ollama setup on a VPS: install Ollama, add it as a provider, pick a model, test the connection, and keep the Ollama API private.","rank_math_focus_keyword":"openclaw ollama","footnotes":""},"categories":[22663],"tags":[],"class_list":["post-132114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/openclaw-ollama","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/openclaw-ollama","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/openclaw-ollama","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/openclaw-ollama","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/openclaw-ollama","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/openclaw-ollama","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/openclaw-ollama","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/openclaw-ollama","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/132114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/comments?post=132114"}],"version-history":[{"count":3,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/132114\/revisions"}],"predecessor-version":[{"id":137915,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/132114\/revisions\/137915"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media\/137916"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media?parent=132114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/categories?post=132114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/tags?post=132114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}