{"id":132288,"date":"2026-08-07T11:17:56","date_gmt":"2026-08-07T11:17:56","guid":{"rendered":"https:\/\/www.hostinger.com\/my\/tutorials\/openclaw-ollama\/"},"modified":"2026-08-07T11:17:56","modified_gmt":"2026-08-07T11:17:56","slug":"openclaw-ollama","status":"publish","type":"post","link":"\/my\/tutorials\/openclaw-ollama\/","title":{"rendered":"How to set up OpenClaw with Ollama on a VPS"},"content":{"rendered":"<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\">Using OpenClaw with Ollama offers a different approach. Ollama lets you run open-source AI models on your own infrastructure. As a result, you only pay the hosting costs for OpenClaw and Ollama, such as the annual fee of 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\" 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 href=\"\/my\/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 href=\"\/my\/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\" 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\"><strong>1. Check the prerequisites<\/strong><\/h3><p class=\"wp-block-paragraph\">Before setting up Ollama with OpenClaw on your VPS, make sure you have a working OpenClaw installation and enough RAM, CPU, and storage for your chosen AI model.<\/p><p class=\"wp-block-paragraph\">The table below lists the minimum and recommended server resources. Requirements vary because larger <a href=\"https:\/\/ollama.com\/library\" target=\"_blank\" rel=\"noopener\">Ollama models<\/a> need more memory, processing power, and storage.<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Resource<\/strong><\/td><td><strong>Minimum<\/strong><\/td><td><strong>Recommended<\/strong><\/td><\/tr><tr><td>RAM<\/td><td><strong>4 GB<\/strong><\/td><td><strong>8&ndash;16 GB<\/strong>, depending on the model size<\/td><\/tr><tr><td>CPU<\/td><td><strong>1 vCPU<\/strong><\/td><td><strong>2&ndash;4 vCPUs<\/strong><\/td><\/tr><tr><td>Storage<\/td><td><strong>50 GB NVMe<\/strong><\/td><td><strong>100 GB or more of NVMe storage<\/strong> for local model files<\/td><\/tr><\/tbody><\/table><\/figure><p class=\"wp-block-paragraph\">If you don&rsquo;t have a VPS to <a href=\"\/my\/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 href=\"\/my\/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. After you complete the purchase, Hostinger will deploy the preconfigured OpenClaw environment for you.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/my\/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\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\"><strong>2. Install Ollama on your VPS<\/strong><\/h3><p class=\"wp-block-paragraph\">You can <a href=\"\/my\/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 href=\"\/my\/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><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a75ea66d82fc\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a75ea66d82fc\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1770\" height=\"540\" 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\/45\/2024\/10\/image3.png\/w=1024,h=1024,fit=scale-down\" alt=\"Ollama is successfully installed using the installer script\" class=\"wp-image-117005\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/10\/image3.png\/w=1770,fit=scale-down 1770w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/10\/image3.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/10\/image3.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/10\/image3.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/10\/image3.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/10\/image3.png\/w=1536,fit=scale-down 1536w\" sizes=\"(max-width: 1770px) 100vw, 1770px\" \/><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\">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 hPanel by going to <strong>VPS &rarr; Manage &rarr; Overview &rarr; IP<\/strong>.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a75ea66db5a0\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a75ea66db5a0\" 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 hPanel'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 for connections on <strong>127.0.0.1:11434<\/strong>, which means only applications on the same server can access it. To let OpenClaw connect from another VPS, configure Ollama to listen on the server&rsquo;s network interface.<\/p><p class=\"wp-block-paragraph\">Open the Ollama 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\">Next, while still connected to the Ollama VPS, <a href=\"\/my\/tutorials\/how-to-configure-firewall-on-ubuntu-using-ufw\/\">configure Uncomplicated Firewall (UFW)<\/a> to allow connections to port <strong>11434<\/strong> only from your OpenClaw VPS. Replace <strong>openclaw-vps-ip<\/strong> with the OpenClaw VPS IP address:<\/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\">Check the firewall 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<\/pre><h3 class=\"wp-block-heading\"><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\">Access the OpenClaw container:<\/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\":\"6a75ea66dea87\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a75ea66dea87\" 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. Open the OpenClaw configuration file inside the container with the <a href=\"\/my\/tutorials\/how-to-install-and-use-nano-text-editor\/\">nano text editor<\/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=\"\">nano ~\/.openclaw\/config.json<\/pre><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\"><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\":\"6a75ea66e1cd3\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a75ea66e1cd3\" 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\">If you chose a local model, test it before checking the OpenClaw connection. On your Ollama server and run the model directly:<\/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\":\"6a75ea66e5101\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a75ea66e5101\" 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 href=\"\/my\/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\"><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 \n&nbsp;&nbsp;&nbsp;-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\":\"6a75ea66e85f0\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a75ea66e85f0\" 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 \n&nbsp;&nbsp;&nbsp;--model ollama\/gemma4 \n&nbsp;&nbsp;&nbsp;--prompt \"Reply with exactly: pong\"<\/pre><p class=\"wp-block-paragraph\">If this command fails, check the <strong>baseUrl<\/strong>, <strong>api<\/strong>, and model name settings in <strong>~\/.openclaw\/config.json<\/strong>.<\/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\">The <strong>CONTEXT<\/strong> column should show <strong>65536<\/strong> or higher. If it shows <strong>4096<\/strong>, the <strong>num_ctx<\/strong> setting in <strong>~\/.openclaw\/config.json<\/strong> didn&rsquo;t take effect. Update the value, save the file, and restart the OpenClaw Gateway.<\/p><h3 class=\"wp-block-heading\"><strong>6. Secure the Ollama API on your VPS<\/strong><\/h3><p class=\"wp-block-paragraph\">If you installed Ollama on a separate server, the firewall rules already restrict API access to your OpenClaw VPS. For same-server setups, Ollama&rsquo;s default <strong>127.0.0.1<\/strong> binding automatically blocks external access.<\/p><p class=\"wp-block-paragraph\">The remaining concern is <a href=\"\/my\/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\" 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 are cloud models like <strong>kimi-k3:cloud<\/strong> and <strong>qwen3.5:cloud<\/strong> for complex agent tasks, or local models like <strong>gemma4<\/strong> and <strong>qwen3.5<\/strong> for greater data privacy.<\/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>qwen3.5:cloud<\/strong><\/td><td>256K tokens<\/td><td>Coding, document analysis, and image understanding<\/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<\/strong><\/td><td>9.6 GB<\/td><td>128K tokens<\/td><td>General reasoning, coding, and agent workflows<\/td><\/tr><tr><td><strong>qwen3.5<\/strong><\/td><td>6.6 GB<\/td><td>256K tokens<\/td><td>Coding, vision, and document processing<\/td><\/tr><tr><td><strong>qwen3-coder:30b<\/strong><\/td><td>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\">The maximum context column shows the highest value each model supports. The context window you can use in practice depends on your available RAM, model version, quantization, and other running services.<\/p><h2 class=\"wp-block-heading\" 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 href=\"\/my\/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>ollama run gemma4 &ldquo;&rdquo;<\/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\" 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>openclaw models list &ndash;provider ollama<\/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>journalctl -u ollama &ndash;no-pager &ndash;follow &ndash;pager-end<\/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\" 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 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 href=\"\/my\/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\" 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 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>openclaw config &ndash;section web<\/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>openclaw skills search &ldquo;keyword&rdquo;<\/strong> inside the OpenClaw container to find a <a href=\"\/my\/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=\"\/my\/tutorials\/openclaw-ollama\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":132289,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to set up OpenClaw with Ollama","rank_math_description":"Learn how to configure OpenClaw with Ollama to run local AI models, instead of using commercial cloud-based models that require ongoing subscription fees.","rank_math_focus_keyword":"openclaw ollama","footnotes":""},"categories":[22663],"tags":[],"class_list":["post-132288","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":1},{"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\/my\/tutorials\/wp-json\/wp\/v2\/posts\/132288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=132288"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/132288\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media\/132289"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=132288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=132288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=132288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}